本文整理汇总了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);
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}