C# Windows phone 8自定义消息框问题
我正在使用Microsoft.Phone.Controls.Toolkit程序集中的自定义消息框 我在这里有一个关于解雇事件的问题C# Windows phone 8自定义消息框问题,c#,windows-phone,windows-phone-8.1,C#,Windows Phone,Windows Phone 8.1,我正在使用Microsoft.Phone.Controls.Toolkit程序集中的自定义消息框 我在这里有一个关于解雇事件的问题 var emControl = new EmailAddressUserControl(); var messageBox = new CustomMessageBox() { IsFullScreen = false, Caption = AppResourc
var emControl = new EmailAddressUserControl();
var messageBox = new CustomMessageBox()
{
IsFullScreen = false,
Caption = AppResources.AppResources.SettingTitle4,
LeftButtonContent = AppResources.AppResources.Ok,
RightButtonContent = AppResources.AppResources.Cancel,
Content = emControl
};
messageBox.Dismissed += async (s1, e1) =>
{
switch (e1.Result)
{
case CustomMessageBoxResult.LeftButton:
bool isValidEmail = emControl.finishButton_Click();
if (isValidEmail)
{
string TempVarUserEmail = SharedProperties.EmailId.Value;
SharedProperties.EmailId.Value = emControl.getUserEmail();
ifEmailUpdate = await UpdateEmail();
if (ifEmailUpdate)
{
_instance.subTbEmailAddr.Text = SharedProperties.EmailId.Value;
}
else
{
// restoring user email address if updation failed.
SharedProperties.EmailId.Value = TempVarUserEmail;
MessageBox.Show("Email updation failed. Try again later", "Email update failed!!!", MessageBoxButton.OK);
}
}
else
{
MessageBox.Show("Please enter valid Email address", "Invalid email address!!!", MessageBoxButton.OK);
}
break;
}
};
我的EmailAddressUserControl中有一个文本框,它基本上接受电子邮件地址,当我单击消息框上的OK时,它会检查电子邮件地址的有效性
我现在遇到的问题是,如果它无效,它将在else条件下显示常规消息框,当我在该消息框上单击OK时,甚至自定义消息框也会被取消
有没有办法克服这个问题?我是否可以在单击“确定”后仍保留该消息?我知道我正在确认“确定”按钮上的电子邮件地址,并且它位于已解除的事件处理程序中,我认为这是一种不好的方式
我愿意接受任何意见和批评 我不是100%确定我得到了你的要求。如果用户单击“无效电子邮件地址”消息框上的“确定”,是否可以再次打开自定义消息框
MessageBoxResult msg = MessageBox.Show("Please enter valid Email address", "Invalid email address!", MessageBoxButton.OK);
if (msg == MessageBoxResult.OK)
{
//OK Clicked
//Open up the custom messsage box here again
}