当前位置: 首页>>代码示例>>C#>>正文


C# CustomMessageBox.Show方法代码示例

本文整理汇总了C#中CustomMessageBox.Show方法的典型用法代码示例。如果您正苦于以下问题:C# CustomMessageBox.Show方法的具体用法?C# CustomMessageBox.Show怎么用?C# CustomMessageBox.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CustomMessageBox的用法示例。


在下文中一共展示了CustomMessageBox.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: appbar_buttonAdd_Click

        //添加商家
        private void appbar_buttonAdd_Click(object sender, EventArgs e)
        {
            TextBox txtBox = new TextBox();
            CustomMessageBox msgBox = new CustomMessageBox()
            {
                Caption = "添加商家",
                LeftButtonContent = "保存",
                RightButtonContent = "取消",
                Content = txtBox
            };

            msgBox.Dismissing += (s1, e1) =>
            {
                switch (e1.Result)
                {
                    case CustomMessageBoxResult.LeftButton:
                        SaveStore(txtBox.Text.Trim());
                        StoreListBox.ItemsSource = Common.GetAllStore();
                        break;
                    case CustomMessageBoxResult.RightButton:
                        break;
                    case CustomMessageBoxResult.None:
                        break;
                    default: break;
                }
            };
            msgBox.Show();
        }
开发者ID:TomHGTang,项目名称:AccountBook,代码行数:29,代码来源:StoreSetting.xaml.cs

示例2: Prompt

 public void Prompt(string message, string title, Action<string> onPrompt, Action onCancel = null)
 {
     var textBox = new TextBox();
     var messageBox = new CustomMessageBox()
     {
         Caption = title,
         LeftButtonContent = "Подтвердить",
         RightButtonContent = "Отмена",
         Message = message,
         Content = textBox
     };
     messageBox.Dismissed += (sender, args) =>
     {
         switch (args.Result)
         {
             case CustomMessageBoxResult.LeftButton:
                 onPrompt(textBox.Text);
                 // Do something.
                 break;
             case CustomMessageBoxResult.RightButton:
                 // Do something.
                 if (onCancel != null) onCancel();
                 break;
             case CustomMessageBoxResult.None:
                 // Do something.
                 if (onCancel != null) onCancel();
                 break;
             default:
                 if (onCancel != null) onCancel();
                 break;
         }
     };
     messageBox.Show();
 }
开发者ID:raveclassic,项目名称:icontowp8,代码行数:34,代码来源:BasePage.cs

示例3: ShowDialogBox

        public void ShowDialogBox(string caption, string message, string leftbuttonContent, string rightButtonContent, Action leftButtonAction, Action rightButtonAction)
        {
            var messagebox = new CustomMessageBox()
            {
                Caption = caption,
                Message = message,
                LeftButtonContent = leftbuttonContent,
                RightButtonContent = rightButtonContent
            };

            messagebox.Dismissed += (s,e) =>
            {
                switch (e.Result)
                {
                    case CustomMessageBoxResult.LeftButton:
                        leftButtonAction();
                        break;
                    case CustomMessageBoxResult.RightButton:
                        rightButtonAction();
                        break;
                    case CustomMessageBoxResult.None:
                        break;
                };
            };

            messagebox.Show();
        }
开发者ID:TheAngryByrd,项目名称:MetroPass,代码行数:27,代码来源:DialogService.cs

示例4: CheckForPreviousException

        internal static void CheckForPreviousException(bool isFirstRun)
        {
            try
            {
                string contents = null;
                using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    if (store.FileExists(filename))
                    {
                        using (TextReader reader = new StreamReader(store.OpenFile(filename, FileMode.Open, FileAccess.Read, FileShare.None)))
                        {
                            contents = reader.ReadToEnd();
                        }
                        SafeDeleteFile(store);
                    }
                }

                if (contents != null)
                {
                    string messageBoxText = null;
                    if (isFirstRun)
                        messageBoxText = "An unhandled error occurred the last time you ran this application. Would you like to send an email to report it?";
                    else
                        messageBoxText = "An unhandled error has just occurred. Would you like to send an email to report it?";

                    CustomMessageBox messageBox = new CustomMessageBox()
                    {
                        Caption = "Error Report",
                        Message = messageBoxText,
                        LeftButtonContent = "yes",
                        RightButtonContent = "no",
                        IsFullScreen = false
                    };

                    messageBox.Dismissed += (s1, e1) =>
                    {
                        switch (e1.Result)
                        {
                            case CustomMessageBoxResult.LeftButton:
                                FeedbackHelper.Default.Feedback(contents, true);

                                SafeDeleteFile(IsolatedStorageFile.GetUserStoreForApplication());

                                break;
                            default:
                                break;
                        }
                    };

                    messageBox.Show();
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                SafeDeleteFile(IsolatedStorageFile.GetUserStoreForApplication());
            }
        }
开发者ID:cglong,项目名称:HackerNews,代码行数:60,代码来源:LittleWatson.cs

示例5: appbar_buttonAdd_Click

        //添加分类
        private void appbar_buttonAdd_Click(object sender, EventArgs e)
        {
            string kind = pivot.SelectedIndex > 0 ? "收入" : "支出";
            TextBox txtBox = new TextBox();
            CustomMessageBox msgBox = new CustomMessageBox()
            {
                Caption = "添加" + kind + "分类",
                LeftButtonContent = "保存",
                RightButtonContent = "取消",
                Content = txtBox
            };

            msgBox.Dismissing += (s1, e1) =>
            {
                switch(e1.Result)
                {
                    case CustomMessageBoxResult.LeftButton:
                        SaveCategory(txtBox.Text.Trim());
                        FreshList();
                        break;
                    case CustomMessageBoxResult.RightButton:
                        break;
                    case CustomMessageBoxResult.None:
                        break;
                    default: break;
                }
            };
            msgBox.Show();
        }
开发者ID:TomHGTang,项目名称:AccountBook,代码行数:30,代码来源:CategorySetting.xaml.cs

示例6: MainPage

        public MainPage()
        {
            InitializeComponent();

            messageBox = new CustomMessageBox()
            {
                Message = "Приложение может использовать данные о вашем местоположении для отображения их на карте (эти данные никуда не передаются и не хранятся). Вы можете отключить это в настройках программы.",
                Caption = "Разрешить использовать сведения о местоположении?",
                LeftButtonContent = "Разрешить",
                RightButtonContent = "Запретить",
            };

            messageBox.Dismissed += (s1, e1) =>
            {
                switch (e1.Result)
                {
                    case CustomMessageBoxResult.LeftButton:
                        Settings.IsNavigationEnabled = true;
                        break;
                    case CustomMessageBoxResult.RightButton:
                    case CustomMessageBoxResult.None:
                        Settings.IsNavigationEnabled = false;
                        break;
                    default:
                        break;
                }
            };

            this.Loaded += (s, e) =>
            {
                if(!IsolatedStorageSettings.ApplicationSettings.Contains("IsNavigationEnabled"))
                    messageBox.Show();
            };
        }
开发者ID:e-novikov,项目名称:SpbBridge2013,代码行数:34,代码来源:MainPage.xaml.cs

示例7: BasicMessageBox_Click

        /// <summary>
        /// Displays a CustomMessageBox with no content.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event information.</param>
        private void BasicMessageBox_Click(object sender, RoutedEventArgs e)
        {
            CustomMessageBox messageBox = new CustomMessageBox()
            {                
                Caption = "Do you like this sample?",
                Message = "There are tons of things you can do using custom message boxes. To learn more, be sure to check out the source code at Codeplex.",
                LeftButtonContent = "yes",
                RightButtonContent = "no",
                IsFullScreen = (bool)FullScreenCheckBox.IsChecked
            };

            messageBox.Dismissed += (s1, e1) =>
                {
                    switch (e1.Result)
                    {
                        case CustomMessageBoxResult.LeftButton:
                            // Do something.
                            break;
                        case CustomMessageBoxResult.RightButton:
                            // Do something.
                            break;
                        case CustomMessageBoxResult.None:
                            // Do something.
                            break;
                        default:
                            break;
                    }
                };

            messageBox.Show();
        }
开发者ID:sanjayasl,项目名称:WPtoolkit,代码行数:36,代码来源:CustomMessageBoxSample.xaml.cs

示例8: ShowDialogBox

        public Task<bool> ShowDialogBox(string caption, string message, string leftbuttonContent, string rightButtonContent, Func<Task> leftButtonAction, Func<Task> rightButtonAction)
        {
            var messagebox = new CustomMessageBox()
            {
                Caption = caption,
                Message = message,
                LeftButtonContent = leftbuttonContent,
                RightButtonContent = rightButtonContent
            };

            var tcs = new TaskCompletionSource<bool>();
            messagebox.Dismissed += async (s, e) =>
            {
                switch (e.Result)
                {
                    case CustomMessageBoxResult.LeftButton:
                         await leftButtonAction();
                        tcs.SetResult(true);
                        break;
                    case CustomMessageBoxResult.RightButton:
                        await rightButtonAction();

                        tcs.SetResult(true);
                        break;
                    case CustomMessageBoxResult.None:

                        tcs.SetResult(false);
                        break;
                };
            };

            messagebox.Show();

            return tcs.Task;
        }
开发者ID:TheAngryByrd,项目名称:ThePaperWallApps,代码行数:35,代码来源:DialogService.cs

示例9: Use_Zip_Code

        private void Use_Zip_Code(object sender, System.Windows.RoutedEventArgs e)
        {
            TextBox textBox = new TextBox();
            // restrict input to digits:
            InputScope inputScope = new InputScope();
            InputScopeName inputScopeName = new InputScopeName();
            inputScopeName.NameValue = InputScopeNameValue.Digits;
            inputScope.Names.Add(inputScopeName);
            textBox.InputScope = inputScope;

            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Message = "Enter your US zip code:",
                LeftButtonContent = "okay",
                RightButtonContent = "cancel",
                Content = textBox
            };
            messageBox.Loaded += (a, b) =>
            {
                textBox.Focus();
            };
            messageBox.Show();
            messageBox.Dismissed += (s, args) =>
            {
                if (args.Result == CustomMessageBoxResult.LeftButton)
                {
                    if (textBox.Text.Length >= 5)
                    {
                        geocodeUsingString(textBox.Text);
                    }
                }
            };
        }
开发者ID:nate-parrott,项目名称:weatherping,代码行数:33,代码来源:Location.xaml.cs

示例10: msgBuy

        public static void msgBuy()
        {
            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Caption = "Хотите приобрести расширенную версию?",
                Message = "Функции: словарь, озвучка слов и аудиролвание предоставляются только в расширенной версии приложения. Хотите приобрести (цена: 34 руб.)? Покупая расширенную версию, Вы поддерживаете дальнейшее создание уроков.",
                LeftButtonContent = "нет",
                RightButtonContent = "да",
                IsFullScreen = false
            };

            messageBox.Dismissed += (s1, e1) =>
            {
                switch (e1.Result)
                {
                    case CustomMessageBoxResult.LeftButton:
                        // Do something.
                        break;
                    case CustomMessageBoxResult.RightButton:
                        BuyPro();
                        break;
                    case CustomMessageBoxResult.None:
                        // Do something.
                        break;
                    default:
                        break;
                }
            };

            messageBox.Show();
        }
开发者ID:Malanin,项目名称:EnglishWithFriends,代码行数:31,代码来源:ProManager.cs

示例11: CreateTaskList_Click

        void CreateTaskList_Click(object sender, EventArgs e)
        {
            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Caption = "Create tasklist?",
                Message = "Give a name of a new list.",
                LeftButtonContent = "OK",
                RightButtonContent = "Cancel",
                ContentTemplate = (DataTemplate)Resources["CreateTaskListContentTemplate"]
            };

            messageBox.Dismissed += (s1, e1) =>
                {
                    switch (e1.Result)
                    {
                        case CustomMessageBoxResult.LeftButton:
                        {
                            if (_vm.CreateTaskListCommand.CanExecute(null))
                            {
                                _vm.CreateTaskListCommand.Execute(null);
                            }
                            break;
                        }
                    }
                };
            messageBox.Show();
        }
开发者ID:roosi,项目名称:done,代码行数:27,代码来源:MainPage.xaml.cs

示例12: Show

 public void Show(string text, string firstOption, string secondOption, Action firstAction, Action secondAction)
 {
     Mvx.Resolve<IMvxMainThreadDispatcher>().RequestMainThreadAction(() =>
     {
         _messageBox = new CustomMessageBox
         {
             AllowDrop = false,
             Message = text,
             IsLeftButtonEnabled = true,
             IsRightButtonEnabled = true,
             LeftButtonContent = firstOption,
             RightButtonContent = secondOption
         };
         _messageBox.Dismissed += (s, e) =>
         {
             if (e.Result == CustomMessageBoxResult.LeftButton && firstAction != null)
             {
                 firstAction();
             }
             else if (e.Result == CustomMessageBoxResult.RightButton && secondAction != null)
             {
                 secondAction();
             }
         };
         _messageBox.Show();
     });
 }
开发者ID:sbondini,项目名称:FriendList,代码行数:27,代码来源:WinPhoneAlertDialog.cs

示例13: lstAdapters_SelectionChanged

        private void lstAdapters_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            lstAdapterItem selItem = ((lstAdapterItem)lstAdapters.SelectedItem);
            TextBox dnsBox = new TextBox() { Text = selItem.PrimaryDNS };

            TiltEffect.SetIsTiltEnabled(dnsBox, true);

            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Caption = "Edit DNS for " + selItem.Name,
                Message = "Primary DNS Server:",
                Content = dnsBox,
                LeftButtonContent = "save",
                RightButtonContent = "cancel",
                IsFullScreen = false
            };

            messageBox.Dismissed += (s1, e1) =>
            {
                if (e1.Result == CustomMessageBoxResult.LeftButton)
                {
                    Registry.SetMultiStringValue(selItem.KeyRoot, selItem.KeyPath, "DNS", new string[] { dnsBox.Text });
                    //TODO: Clear the list first
                    refreshAdapters();
                }
                //TODO: Fix this
                //lstAdapters.SelectedIndex = -1;
            };

            messageBox.Show();
        }
开发者ID:Digiex,项目名称:DNSChangerWP7,代码行数:31,代码来源:MainPage.xaml.cs

示例14: SelectMode

 public Task<PhotoSelectionModeEnum> SelectMode()
 {
     var taskSource = new TaskCompletionSource<PhotoSelectionModeEnum>();
     var messageBox = new CustomMessageBox
         {
             Caption = "Photo selection",
             Message = "Specify the source of the photos please.",
             LeftButtonContent = "My photos",
             RightButtonContent = "Astral photos"
         };
     messageBox.Dismissed += (s, e) =>
         {
             switch (e.Result)
             {
                 case CustomMessageBoxResult.LeftButton:
                     taskSource.TrySetResult(PhotoSelectionModeEnum.MyPhotos);
                     break;
                 case CustomMessageBoxResult.RightButton:
                     taskSource.TrySetResult(PhotoSelectionModeEnum.BuiltinPhotos);
                     break;
                 default:
                     taskSource.TrySetResult(PhotoSelectionModeEnum.None);
                     break;
             }
         };
     messageBox.Show();
     return taskSource.Task;
 }
开发者ID:jorik041,项目名称:CrossChat,代码行数:28,代码来源:PhotoSelectorViewModel.cs

示例15: BasicMessageBox_Click

        private void BasicMessageBox_Click(object sender, RoutedEventArgs e)
        {
            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Caption = "Pregunta?",
                Message = "Mensaje del CustomMessageBox.",
                LeftButtonContent = "Si",
                RightButtonContent = "No",
                IsFullScreen = (bool)FullScreenCheckBox.IsChecked
            };

            messageBox.Dismissed += (s1, e1) =>
            {
                switch (e1.Result)
                {
                    case CustomMessageBoxResult.LeftButton:
                        // Acción.
                        break;
                    case CustomMessageBoxResult.RightButton:
                        // Acción.
                        break;
                    case CustomMessageBoxResult.None:
                        // Acción.
                        break;
                    default:
                        break;
                }
            };

            messageBox.Show();
        }
开发者ID:rwecho,项目名称:Windows-Phone-Samples,代码行数:31,代码来源:MainPage.xaml.cs


注:本文中的CustomMessageBox.Show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。