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


C# TaskDialog.ShowAndDispose方法代码示例

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


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

示例1: OnClosing

        protected override void OnClosing(CancelEventArgs e)
        {
            var rMode = Preference.Instance.UI.CloseConfirmationMode.Value;
            if (rMode == ConfirmationMode.Always || (rMode == ConfirmationMode.DuringSortie && KanColleGame.Current.Sortie is SortieInfo))
            {
                var rDialog = new TaskDialog()
                {
                    Caption = StringResources.Instance.Main.Product_Name,
                    Instruction = StringResources.Instance.Main.Window_ClosingConfirmation_Instruction,
                    Icon = TaskDialogIcon.Information,
                    Buttons =
                    {
                        new TaskDialogCommandLink(TaskDialogCommonButton.Yes, StringResources.Instance.Main.Window_ClosingConfirmation_Button_Yes),
                        new TaskDialogCommandLink(TaskDialogCommonButton.No, StringResources.Instance.Main.Window_ClosingConfirmation_Button_No),
                    },
                    DefaultCommonButton = TaskDialogCommonButton.No,

                    OwnerWindow = this,
                    ShowAtTheCenterOfOwner = true,
                };
                if (rDialog.ShowAndDispose().ClickedCommonButton == TaskDialogCommonButton.No)
                {
                    e.Cancel = true;
                    return;
                }
            }

            base.OnClosing(e);
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:29,代码来源:MainWindow.xaml.cs

示例2: HttpOnly_Checked

        void HttpOnly_Checked(object sender, RoutedEventArgs e)
        {
            if (!HttpOnly.IsChecked.Value)
                return;

            var rDialog = new TaskDialog()
            {
                Caption = StringResources.Instance.Main.Product_Name,
                Instruction = StringResources.Instance.Main.PreferenceWindow_Network_UseUpstreamProxy_HttpOnly_Dialog_Instruction,
                Icon = TaskDialogIcon.Information,
                Content = StringResources.Instance.Main.PreferenceWindow_Network_UseUpstreamProxy_HttpOnly_Dialog_Content,
                Buttons =
                {
                    new TaskDialogButton(TaskDialogCommonButton.Yes, StringResources.Instance.Main.PreferenceWindow_Network_UseUpstreamProxy_HttpOnly_Dialog_Button_Yes),
                    new TaskDialogButton(TaskDialogCommonButton.No, StringResources.Instance.Main.PreferenceWindow_Network_UseUpstreamProxy_HttpOnly_Dialog_Button_No),
                },
                DefaultCommonButton = TaskDialogCommonButton.No,

                OwnerWindow = WindowUtil.GetTopWindow(),
                ShowAtTheCenterOfOwner = true,
            };
            if (rDialog.ShowAndDispose().ClickedCommonButton == TaskDialogCommonButton.No)
                HttpOnly.IsChecked = false;
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:24,代码来源:Network.xaml.cs

示例3: ShowUnhandledExceptionDialog

        void ShowUnhandledExceptionDialog(Exception rpException)
        {
            var rLogFilename = Logger.GetNewExceptionLogFilename();
            try
            {
                using (var rStreamWriter = new StreamWriter(Logger.GetNewExceptionLogFilename(), false, new UTF8Encoding(true)))
                {
                    rStreamWriter.WriteLine("Unhandled Exception:");
                    rStreamWriter.WriteLine();
                    rStreamWriter.WriteLine(rpException.ToString());
                    rStreamWriter.WriteLine();
                }
            }
            catch
            {
                rLogFilename = null;
            }

            var rDialog = new TaskDialog()
            {
                Caption = UnhandledExceptionDialogStringResources.ProductName,
                Instruction = UnhandledExceptionDialogStringResources.Instruction,
                Icon = TaskDialogIcon.Error,
                Content = UnhandledExceptionDialogStringResources.Content,

                Detail = rpException.ToString(),
                ShowDetailAtTheBottom = true,

                OwnerWindowHandle = r_MainWindowHandle,
                ShowAtTheCenterOfOwner = true,
            };

            if (rLogFilename != null)
            {
                rDialog.EnableHyperlinks = true;
                rDialog.FooterIcon = TaskDialogIcon.Information;
                rDialog.Footer = string.Format(UnhandledExceptionDialogStringResources.Footer, $"<a href=\"{rLogFilename}\">{rLogFilename}</a>");

                EventHandler<string> rHyperlinkClicked = null;
                rHyperlinkClicked = delegate
                {
                    if (File.Exists(rLogFilename))
                        Process.Start(rLogFilename);
                };
                EventHandler rClosed = null;
                rClosed = delegate
                {
                    rDialog.HyperlinkClicked -= rHyperlinkClicked;
                    rDialog.Closed -= rClosed;
                };
                rDialog.HyperlinkClicked += rHyperlinkClicked;
                rDialog.Closed += rClosed;
            }

            rDialog.ShowAndDispose();
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:56,代码来源:App.xaml.cs

示例4: RestartGame

        void RestartGame()
        {
            var rMode = Preference.Instance.Browser.RefreshConfirmationMode.Value;
            if (rMode == ConfirmationMode.Always || (rMode == ConfirmationMode.DuringSortie && KanColleGame.Current.Sortie is SortieInfo))
            {
                var rDialog = new TaskDialog()
                {
                    Caption = StringResources.Instance.Main.Product_Name,
                    Instruction = StringResources.Instance.Main.Browser_RestartConfirmation_Instruction,
                    Icon = TaskDialogIcon.Information,
                    Buttons =
                    {
                        new TaskDialogCommandLink(TaskDialogCommonButton.Yes, StringResources.Instance.Main.Browser_RestartConfirmation_Button_Refresh),
                        new TaskDialogCommandLink(TaskDialogCommonButton.No, StringResources.Instance.Main.Browser_RestartConfirmation_Button_Stay),
                    },
                    DefaultCommonButton = TaskDialogCommonButton.No,

                    OwnerWindow = App.Current.MainWindow,
                    ShowAtTheCenterOfOwner = true,
                };

                if (rDialog.ShowAndDispose().ClickedCommonButton == TaskDialogCommonButton.No)
                    return;
            }

            r_Owner.Navigator.Refresh();
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:27,代码来源:GameController.cs

示例5: SetCookie

        void SetCookie()
        {
            var rYear = DateTime.Now.AddYears(4).ToString("yyyy");
            var rScript = $"javascript:void(eval(\"document.cookie = 'ckcy=1;expires=Sun, 09 Feb {rYear} 09:00:09 GMT;domain=osapi.dmm.com;path=/'; document.cookie = 'ckcy=1;expires=Sun, 09 Feb  {rYear} 09:00:09 GMT;domain=203.104.209.7;path=/'; document.cookie = 'ckcy=1;expires=Sun, 09 Feb  {rYear} 09:00:09 GMT;domain=www.dmm.com;path=/netgame/';\")); location.href = \"{Url}\";";

            Uri rUri;
            if (!Uri.TryCreate(rScript, UriKind.Absolute, out rUri))
                return;

            r_Owner.Communicator.Write(CommunicatorMessages.Navigate + ":" + rUri.ToString());

            var rDialog = new TaskDialog()
            {
                Caption = StringResources.Instance.Main.Product_Name,
                Instruction = StringResources.Instance.Main.Browser_Navigator_SetCookie_Instruction,
                Icon = TaskDialogIcon.Information,

                OwnerWindow = App.Current.MainWindow,
                ShowAtTheCenterOfOwner = true,
            };

            rDialog.ShowAndDispose();
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:23,代码来源:BrowserNavigator.cs


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