繁体   English   中英

Windows Phone 8自定义消息框问题

[英]Windows phone 8 Custom message box issues

我正在使用来自Microsoft.Phone.Controls.Toolkit程序集的自定义消息框。

关于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;
            }
        };

我的EmailAddressUserControl中有一个文本框,它基本上接收电子邮件地址,当我在消息框上单击“确定”时,它将检查电子邮件地址的有效性...

我现在遇到的问题是,如果它无效,它将在else条件下显示常规消息框,当我在该消息框上单击“确定”时,即使自定义消息框也被关闭了。

有没有办法覆盖这个? 即使单击确定,我是否仍可以显示该消息? 我知道我在单击“确定”按钮时正在验证电子邮件地址,并且该电子邮件地址位于被解雇的事件处理程序中,我认为这样做是一种不好的方式。

我愿意接受任何想法和批评。

我不确定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
        }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM