[英]Windows phone 8 Custom message box issues
I am using custom message box from Microsoft.Phone.Controls.Toolkit assembly. 我正在使用来自Microsoft.Phone.Controls.Toolkit程序集的自定义消息框。
I am have an issue here with respect to the Dismissed event. 关于Dismissed事件,我这里有一个问题。
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;
}
};
I have a textbox in my EmailAddressUserControl which basically takes email address and when i click on OK on the message box it checks the validity of the email address... 我的EmailAddressUserControl中有一个文本框,它基本上接收电子邮件地址,当我在消息框上单击“确定”时,它将检查电子邮件地址的有效性...
The problem i have right now is that, if its not valid, it will show up the regular message box in the else condition and when i click on OK on that messatge box, even the custom message box is dismissed. 我现在遇到的问题是,如果它无效,它将在else条件下显示常规消息框,当我在该消息框上单击“确定”时,即使自定义消息框也被关闭了。
Is there a way to override this ? 有没有办法覆盖这个? Can i have the message to still be present even after clicking on OK? 即使单击确定,我是否仍可以显示该消息? I know i am validating the email address on the OK button click and it is in the dismissed event handler, i think its a bad way of doing it. 我知道我在单击“确定”按钮时正在验证电子邮件地址,并且该电子邮件地址位于被解雇的事件处理程序中,我认为这样做是一种不好的方式。
I am open to any ideas and criticisms. 我愿意接受任何想法和批评。
I'm not 100% sure I got what you asked. 我不确定100%知道您的要求。 Can you just open the custom message box again if the user clicks OK on the "Invalid email address" message box? 如果用户在“无效的电子邮件地址”消息框中单击“确定”,是否可以再次打开自定义消息框?
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.