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


C# DialogMessage.ProcessCallback方法代码示例

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


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

示例1: OnStatusUpdateMessage

        private static void OnStatusUpdateMessage(DialogMessage dialogMessage)
        {
            if (dialogMessage != null)
            {
                MessageBoxResult result = MessageBox.Show(dialogMessage.Content,
                    dialogMessage.Caption, dialogMessage.Button);

                dialogMessage.ProcessCallback(result);
            }
        }
开发者ID:carriercomm,项目名称:InventoryManagement,代码行数:10,代码来源:MainPage.xaml.cs

示例2: ShowMessageBox

        /// <summary>
        /// Shows a message box.
        /// </summary>
        /// <param name="message">
        /// A <see cref="T:DialogMessage"/> that defines the message box.
        /// </param>
        public void ShowMessageBox(DialogMessage message)
        {
            MessageBoxResult result =
                MessageBox.Show(
                    message.Content,
                    message.Caption,
                    message.Button);

            message.ProcessCallback(result);
        }
开发者ID:yadyn,项目名称:ItsBeen,代码行数:16,代码来源:MessageBoxService.cs

示例3: ShowMessageBox

        /// <summary>
        /// Shows a message box.
        /// </summary>
        /// <param name="message">
        /// A <see cref="T:DialogMessage"/> that defines the message box.
        /// </param>
        public void ShowMessageBox(DialogMessage message)
        {
            TaskDialogOptions options = new TaskDialogOptions();

            options.Owner = DialogHelper.TryGetOwnerFromSender(message.Sender);
            options.MainInstruction = message.Content;
            options.Title = message.Caption;

            switch (message.Button)
            {
                case MessageBoxButton.OK:
                    options.CommonButtons = TaskDialogCommonButtons.Close;
                    options.DefaultButtonIndex = 0;
                    break;
                case MessageBoxButton.OKCancel:
                    options.CommonButtons = TaskDialogCommonButtons.OKCancel;
                    if (message.DefaultResult == MessageBoxResult.OK)
                        options.DefaultButtonIndex = 0;
                    else
                        options.DefaultButtonIndex = 1;
                    break;
                case MessageBoxButton.YesNo:
                    options.CommonButtons = TaskDialogCommonButtons.YesNo;
                    if (message.DefaultResult == MessageBoxResult.Yes)
                        options.DefaultButtonIndex = 0;
                    else
                        options.DefaultButtonIndex = 1;
                    break;
                case MessageBoxButton.YesNoCancel:
                    options.CommonButtons = TaskDialogCommonButtons.YesNoCancel;
                    if (message.DefaultResult == MessageBoxResult.Yes)
                        options.DefaultButtonIndex = 0;
                    else if (message.DefaultResult == MessageBoxResult.No)
                        options.DefaultButtonIndex = 1;
                    else
                        options.DefaultButtonIndex = 2;
                    break;
            }

            switch (message.Icon)
            {
                default:
                case MessageBoxImage.None:
                case MessageBoxImage.Question:
                    break;
                case MessageBoxImage.Information:
                    options.MainIcon = VistaTaskDialogIcon.Information;
                    break;
                case MessageBoxImage.Warning:
                    options.MainIcon = VistaTaskDialogIcon.Warning;
                    break;
                case MessageBoxImage.Error:
                    options.MainIcon = VistaTaskDialogIcon.Error;
                    break;
            }

            TaskDialogResult result = TaskDialog.Show(options);

            // TaskDialogSimpleResult is directly convertable to DialogResult (WinForms) and MessageBoxResult (WPF)
            message.ProcessCallback((MessageBoxResult)result.Result);
        }
开发者ID:yadyn,项目名称:ItsBeen,代码行数:67,代码来源:TaskDialogService.cs


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