簡體   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