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


C# TaskDialog.Close方法代码示例

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


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

示例1: PluginExc

        public static void PluginExc(Exception z,   jZmPlugin plug)
        {
            TaskDialog diag = new TaskDialog();
            diag.InstructionText = "'" + plug.Name + "' by '" + plug.Author + "' has thrown a exception.";
            diag.Text = "One of your plugins has thrown an unhandled exception.\nThis means that one of your plugin may be unstable.";
            diag.Caption = "WTF?";
            diag.Icon = TaskDialogStandardIcon.Error;
            diag.DetailsExpandedText = z.ToString();
            TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart jZm");
            linkz.ShowElevationIcon = true;
            linkz.Click += delegate(object sender, EventArgs argz)
            {
                diag.Close();
                Application.Restart();
            };
            diag.Controls.Add(linkz);
            linkz = new TaskDialogCommandLink("r", "Exit jZm");
            linkz.Click += delegate(object sender, EventArgs argz)
            {
                diag.Close();
                Environment.Exit(-1);
            };
            diag.Controls.Add(linkz);

            linkz = new TaskDialogCommandLink("r", "Ignore error", "Warning: Plugin might throw more errors, You'll probably be better off contacting the owner and/or removing the plugin.");
            linkz.Click += delegate(object sender, EventArgs argz)
            {
                diag.Close();
            };
            diag.Controls.Add(linkz);
            diag.Show();
        }
开发者ID:jariz,项目名称:jZm,代码行数:32,代码来源:Program.cs

示例2: Crash

 public static void Crash(Exception z)
 {
     TaskDialog diag = new TaskDialog();
     diag.InstructionText = "An unhandled exception was caught";
     diag.Text = "jZm has crashed because of a unhandled exception, this means something happend that shouldn't happen.";
     diag.Caption = "WTF?";
     diag.Icon = TaskDialogStandardIcon.Error;
     diag.DetailsExpandedText = z.ToString();
     TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart jZm");
     linkz.ShowElevationIcon = true;
     linkz.Click += delegate(object sender, EventArgs argz)
     {
         diag.Close();
         Application.Restart();
     };
     diag.Controls.Add(linkz);
     linkz = new TaskDialogCommandLink("r", "Exit jZm");
     linkz.Click += delegate(object sender, EventArgs argz)
     {
         diag.Close();
         Environment.Exit(-1);
     };
     diag.Controls.Add(linkz);
     diag.Show();
     Environment.Exit(-1);
 }
开发者ID:jariz,项目名称:jZm,代码行数:26,代码来源:Program.cs

示例3: ButtonTaskDialogCustomButtonClose_Click

        private void ButtonTaskDialogCustomButtonClose_Click(object sender, RoutedEventArgs e)
        {
            var helper = new WindowInteropHelper(this);
            var td = new TaskDialog {OwnerWindowHandle = helper.Handle};

            var closeLink = new TaskDialogCommandLink("close", "Close", "Closes the task dialog");
            closeLink.Click += (o, ev) => td.Close(TaskDialogResult.CustomButtonClicked);
            var closeButton = new TaskDialogButton("closeButton", "Close");
            closeButton.Click += (o, ev) => td.Close(TaskDialogResult.CustomButtonClicked);

            // Enable one or the other; can't have both at the same time
            td.Controls.Add(closeLink);
            //td.Controls.Add(closeButton);

            // needed since none of the buttons currently closes the TaskDialog
            td.Cancelable = true;

            switch (td.Show())
            {
                case TaskDialogResult.CustomButtonClicked:
                    MessageBox.Show("The task dialog was closed by a custom button");
                    break;
                case TaskDialogResult.Cancel:
                    MessageBox.Show("The task dialog was canceled");
                    break;
                default:
                    MessageBox.Show("The task dialog was closed by other means");
                    break;
            }
        }
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:30,代码来源:MainWindow.xaml.cs

示例4: ShowDialog

        public DialogResult ShowDialog(IWin32Window owner)
        {
            var isLogicError = !IsID10TError(_exception);

            var editReportLinkHref = "edit_report";

            var dialog = new TaskDialog
                         {
                             Cancelable = true,
                             DetailsExpanded = false,
                             HyperlinksEnabled = true,
                             ExpansionMode = TaskDialogExpandedDetailsLocation.ExpandFooter,
                             StartupLocation = TaskDialogStartupLocation.CenterOwner,

                             Icon = TaskDialogStandardIcon.Error,
                             Caption = _title,
                             InstructionText = "An unexpected error occured.",
                             Text = _exception.Message,
                             DetailsExpandedText = _exception.ToString(),

                             DetailsCollapsedLabel = "Show &details",
                             DetailsExpandedLabel = "Hide &details",

                             FooterText = string.Format("<a href=\"{0}\">Edit report contents</a>", editReportLinkHref),

                             OwnerWindowHandle = owner.Handle
                         };

            var sendButton = new TaskDialogCommandLink("sendButton", "&Report This Error\nFast and painless - I promise!");
            sendButton.Click += delegate
                                {
                                    new TaskBuilder()
                                        .OnCurrentThread()
                                        .DoWork((invoker, token) => ErrorReporter.Report(_exception))
                                        .Fail(args => ReportExceptionFail(owner, args))
                                        .Succeed(() => ReportExceptionSucceed(owner))
                                        .Build()
                                        .Start();
                                    dialog.Close(TaskDialogResult.Yes);
                                };

            var dontSendButton = new TaskDialogCommandLink("dontSendButton", "&No Thanks\nI don't feel like being helpful");
            dontSendButton.Click += delegate
                                    {
                                        dialog.Close(TaskDialogResult.No);
                                    };

            dialog.HyperlinkClick += (sender, args) => MessageBox.Show(owner, args.LinkText);

            if (true || isLogicError)
            {
                dialog.Controls.Add(sendButton);
                dialog.Controls.Add(dontSendButton);
            }

            return dialog.Show().ToDialogResult();
        }
开发者ID:JGTM2016,项目名称:bdhero,代码行数:57,代码来源:ExceptionDialog.cs

示例5: button1_Click

        // OMG, http://www.roblox.com/Game/PlaceLauncher.ashx?request=RequestGame&placeId=1818

        private void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine("f");
            TaskDialog dialog = new TaskDialog();
            dialog.Opened += dialog_Opened;
            TaskDialogProgressBar bar = new TaskDialogProgressBar(0, 100, 2);
            bar.State = TaskDialogProgressBarState.Marquee;
            dialog.Controls.Add(bar);

            dialog.StandardButtons = TaskDialogStandardButtons.None;

            backgroundWorker1.RunWorkerCompleted += (s, ev) =>
            {
                if (ev.Result == (object)true)
                {
                    try
                    {
                        dialog.Close(TaskDialogResult.Ok);
                    }
                    catch { }
                }
            };

            dialog.InstructionText = "Launching Roblox...";
            dialog.Text = "Getting Authentication Url, Ticket, and Join Script.";
            dialog.Closing += dialog_Closing;
            dialog.Show();
        }
开发者ID:gamenew09,项目名称:RobloxLauncher,代码行数:30,代码来源:Form1.cs

示例6: Open

		void Open(string fileName)
		{
			TaskDialogResult result;
			do
			{
				Activate();
				prevMain.ViewPane.Select();
				using (TaskDialog dialog = new TaskDialog())
				{
					dialog.Cancelable = false;
					dialog.Controls.Add(new TaskDialogButton("btnCancel", Properties.Resources.Cancel));
					dialog.Caption = Application.ProductName;
					dialog.Icon = TaskDialogStandardIcon.None;
					dialog.InstructionText = Properties.Resources.OpeningFile;
					dialog.OwnerWindowHandle = Handle;
					dialog.ProgressBar = new TaskDialogProgressBar(0, 100, 0);
					dialog.Opened += async (s, ev) =>
					{
						((TaskDialogButtonBase)dialog.Controls["btnCancel"]).Enabled = false;
						try
						{
							await icd.OpenAsync(fileName, new Progress<int>(value => dialog.ProgressBar.Value = value));
							dialog.Close(TaskDialogResult.Ok);
						}
						catch (OperationCanceledException)
						{
							dialog.Close(TaskDialogResult.Close);
						}
					};
					dialog.StartupLocation = TaskDialogStartupLocation.CenterOwner;
					result = dialog.Show();
				}
			} while (result == TaskDialogResult.Retry);
			if (result == TaskDialogResult.Close)
			{
				Close();
				return;
			}
			conBookmarks.Items.AddRange(icd.Bookmarks.Select(b => new ToolStripMenuItem(b.Name, null, (sen, eve) =>
			{
				current = spreads.FindIndex(sp => sp.Left == b.Target || sp.Right == b.Target);
				ViewCurrentPage();
			})).ToArray());
			spreads = new List<Spread>(icd.ConstructSpreads(false));
			openingFileName = "";
			ViewCurrentPage();
		}
开发者ID:kavenblog,项目名称:Comical,代码行数:47,代码来源:ViewerForm.cs

示例7: button1_Click

		private void button1_Click(object sender, EventArgs e)
		{
			DirtyMem();
			try
			{

				var tdError = new TaskDialog
				{
					DetailsExpanded = false,
					Cancelable = false,
					Icon = TaskDialogStandardIcon.Error,
					Caption = "This dialog works",
					InstructionText = "A good news for you - this dialog works!",
					Text = "It might be possible to continue by pressing Ignore button. This error has been reported to Credit Master Support.",
					DetailsExpandedLabel = "Hide details",
					DetailsCollapsedLabel = "Show details",
					ExpansionMode = TaskDialogExpandedDetailsLocation.Hide
				};

				tdError.DetailsExpandedText = "Exception Text";
				tdError.ExpansionMode = TaskDialogExpandedDetailsLocation.ExpandFooter;

				var ignoreButton = new TaskDialogCommandLink("ignore", "Ignore\nDo not close the application.");
				ignoreButton.Click += (s, e1) => tdError.Close(TaskDialogResult.Retry);
				tdError.Controls.Add(ignoreButton);

				var closeButton = new TaskDialogCommandLink("close", "Close\nClose the application and exit.");
				closeButton.Click += (s, e1) => tdError.Close(TaskDialogResult.Cancel);
				tdError.Controls.Add(closeButton);

				var copyButton = new TaskDialogCommandLink("copy", "Copy Details to Clipboard\nCopy error details to clipboard for further investigation.");
				copyButton.Click += (s, e1) => MessageBox.Show("");
				tdError.Controls.Add(copyButton);

				tdError.OwnerWindowHandle = Handle;
				Text = tdError.Show().ToString();
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.ToString());
			}
		}
开发者ID:gusarov,项目名称:Windows-API-Code-Pack-1.1,代码行数:42,代码来源:Form1.cs

示例8: tCached_Click

        private void tCached_Click(object sender, EventArgs e)
        {
            Forms.NewKnownFolder n = new Forms.NewKnownFolder();
            if (n.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    Folder f = (Folder)rightClickedNode.Tag;
                    if (!f.IsDeleted)
                    {
                        foreach (Folder Fol in f.Folders())
                        {
                            if (Fol.Name.ToLower() == (n.Selected.ToLower()))
                            {
                                MessageBox.Show("Folder already exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                        f.CreateNewFolder(n.Selected);
                        rightClickedNode.Tag = f;
                    }
                }
                catch(Exception x)
                {
                    if (!Aero)
                    {
                        MessageBox.Show("An exception was thrown: " + x.Message + "\r\n\r\nIf this appears to be a bug, press CTRL + C to copy the stack trace, then please email it to me at [email protected]:\r\n" + x.StackTrace);
                    }
                    else
                    {
                        TaskDialog td = new TaskDialog();
                        td.Caption = "Unhandled Exception";
                        td.InstructionText = "An Unhandled Exception was Thrown";
                        td.Text = string.Format("An exception was thrown: {0}\r\n\r\nIf this appears to be a bug, please email me at [email protected] with the details below", x.Message);
                        td.DetailsCollapsedLabel = "Details";
                        td.DetailsExpandedLabel = "Details";
                        td.DetailsExpandedText = x.StackTrace;

                        TaskDialogButton Copy = new TaskDialogButton("Copy", "Copy Details to Clipboard");
                        Copy.Click += (o, f) => { Clipboard.SetDataObject(x.StackTrace, true, 10, 200); };

                        TaskDialogButton Close = new TaskDialogButton("Close", "Close");
                        Close.Click += (o, f) => { td.Close(); };

                        td.Controls.Add(Copy);
                        td.Controls.Add(Close);
                    }
                    Clear();
                }
            }
        }
开发者ID:jkobrien,项目名称:Xbox360ForensicsToolkit,代码行数:50,代码来源:Main.cs

示例9: menuItem7_Click

        private void menuItem7_Click(object sender, EventArgs e)
        {
            string Text = "Party Buffalo was created by CLK Rebellion (Lander Griffith) with help from gabe_k.  You may contact me at [email protected]\r\n\r\nThis application is not affiliated with Microsoft Corp. \"Microsoft\", \"Xbox\", \"Xbox 360\" and \"Xbox LIVE\" are registered trademarks of Microsoft Corp.";
            string Thanks = "skitzo, gabe_k, Cody, hippie, Rickshaw, Cheater912, unknown_v2, sonic-iso, XeNoN.7\r\n\r\nCaboose (Nyan Cat progress bar), Mathieulh (stealing credit cards), idc \"Looks like a list of attendees for a furry convention to me\", roofus & angerwound for the first Xbox 360 FATX explorer which still keeps people satisfied...";
            string Version = "Version: " + Application.ProductVersion.ToString();

            if (Aero)
            {
                Microsoft.WindowsAPICodePack.Dialogs.TaskDialog td = new Microsoft.WindowsAPICodePack.Dialogs.TaskDialog();
                td.Caption = "About Party Buffalo";
                td.Text = Text;
                td.InstructionText = "About Party Buffalo";
                td.DetailsCollapsedLabel = "Special Thanks To...";
                td.DetailsExpandedText = Thanks;
                Microsoft.WindowsAPICodePack.Dialogs.TaskDialogButton Donate = new Microsoft.WindowsAPICodePack.Dialogs.TaskDialogButton("Donate", "Donate");
                Donate.Click += (o, f) => { MessageBox.Show("Thank you for your contribution!"); System.Diagnostics.Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JWATGN6RETA5Y&lc=US&item_name=Party%20Buffalo%20Drive%20Explorer&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"); };

                //Microsoft.WindowsAPICodePack.Dialogs.TaskDialogButton Visit = new Microsoft.WindowsAPICodePack.Dialogs.TaskDialogButton("Visit", "Visit CLKXU5.com");
                //Visit.Click += (o, f) => { System.Diagnostics.Process.Start("http://clkxu5.com"); };

                Microsoft.WindowsAPICodePack.Dialogs.TaskDialogButton Close = new Microsoft.WindowsAPICodePack.Dialogs.TaskDialogButton("Close", "Close");
                Close.Click += (o, f) => { td.Close(); };

                td.HyperlinksEnabled = true;
                td.HyperlinkClick += (o, f) => { switch (f.LinkText)
                {
                    case "Visit the Development Blog":
                        System.Diagnostics.Process.Start("http://clkxu5.com");
                        break;
                    default:
                        System.Diagnostics.Process.Start("http://free60.org/FATX");
                        break;
                }};
                td.FooterText = "Thank you for using Party Buffalo Drive Explorer\r\n" + Version + "\r\n<a href=\"http://clkxu5.com\">Visit the Development Blog</a> - <a href=\"http://free60.org/FATX\">FATX Research</a>";

                td.Controls.Add(Donate);
                //td.Controls.Add(Visit);
                td.Controls.Add(Close);
                td.Show();
            }
            else
            {
                if (MessageBox.Show(Text + "\r\n" + Thanks + "\r\n" + Version + "\r\nWould you like to donate?", "About Party Buffalo", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    MessageBox.Show("Thank you for your contribution!"); System.Diagnostics.Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JWATGN6RETA5Y&lc=US&item_name=Party%20Buffalo%20Drive%20Explorer&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted");
                }
            }
        }
开发者ID:jkobrien,项目名称:Xbox360ForensicsToolkit,代码行数:48,代码来源:Main.cs

示例10: m_CheckForUpdates_Click

        private void m_CheckForUpdates_Click(object sender, EventArgs e)
        {
            #region Update Shit

            Party_Buffalo.Update u = new Update();
            #if TRACE
            Party_Buffalo.Update.UpdateInfo ud = u.CheckForUpdates(new Uri("http://clkxu5.com/drivexplore/coolapplicationstuff.xml"));
            #endif
            #if DEBUG
            Party_Buffalo.Update.UpdateInfo ud = new Update.UpdateInfo();
            if (UpdateDebug)
            {
                if (!UpdateDebugForce)
                {
                    ud = u.CheckForUpdates(new Uri("http://clkxu5.com/drivexplore/dev/coolapplicationstuff.xml"));
                }
                else
                {
                    ud.Update = true;
                    ud.UpdateText = "This`Is`A`Test";
                    ud.UpdateVersion = "9000";
                }
            }
            #endif
            if (ud.Update)
            {
                if (!Aero)
                {
                    Forms.UpdateForm uf = new Party_Buffalo.Forms.UpdateForm(ud);
                    uf.ShowDialog();
                }
                else
                {
                    TaskDialog td = new TaskDialog();
                    td.Caption = "Update Available";
                    td.InstructionText = "Version " + ud.UpdateVersion + " is Available";
                    td.Text = "An update is available for Party Buffalo";
                    td.DetailsCollapsedLabel = "Change Log";
                    td.DetailsExpandedLabel = "Change Log";
                    td.ExpansionMode = TaskDialogExpandedDetailsLocation.ExpandFooter;
                    string[] Split = ud.UpdateText.Split('`');
                    string UpdateText = "";
                    for (int i = 0; i < Split.Length; i++)
                    {
                        if (i != 0)
                        {
                            UpdateText += "\r\n";
                        }
                        if (Split[i] == "")
                        {
                            continue;
                        }
                        UpdateText += "-" + Split[i];
                    }
                    td.DetailsExpandedText = UpdateText;
                    TaskDialogCommandLink Download = new TaskDialogCommandLink("Download", "Download Party Buffalo version " + ud.UpdateVersion, "");
                    Download.Click += (o, f) =>
                    {
                        Forms.UpdateDownloadForm udf = new Party_Buffalo.Forms.UpdateDownloadForm(ud);
                        udf.ShowDialog();
                    };

                    TaskDialogCommandLink DontDownload = new TaskDialogCommandLink("DontDownload", "Let me go about my business and I'll download this stuff later...", "");
                    DontDownload.Click += (o, f) =>
                    {
                        td.Close();
                    };
                    td.Controls.Add(Download);
                    td.Controls.Add(DontDownload);
                    td.Show();
                }
            }
            else
            {
                MessageBox.Show("Party Buffalo is up to date!");
            }
            if (ud.QuickMessage != null && ud.QuickMessage != "")
            {
                quickMessage.Text = ud.QuickMessage;
            }
            else
            {
                quickMessage.Text = "Could not load quick message";
            }

            #endregion
        }
开发者ID:jkobrien,项目名称:Xbox360ForensicsToolkit,代码行数:87,代码来源:Main.cs

示例11: FatalError

 public static void FatalError(Exception z)
 {
     Out.WritePlain("A unhandled exception was acquired. Below is the information (possibly repeated) of the exception which made EZCap crash.");
     Out.WriteError("\r\n----------- EZCAP FATALERROR -----------\r\n" + z.ToString() + "\r\n----------------------------------------");
     TaskDialog diag = new TaskDialog();
     diag.InstructionText = "EasyCapture has failed you, master.";
     diag.Text = "EasyCapture has encountered an fatal error.";
     diag.Icon = TaskDialogStandardIcon.Error;
     diag.DetailsExpandedText = z.ToString();
     TaskDialogCommandLink cmd1 = new TaskDialogCommandLink("exit", "Exit the application");
     TaskDialogCommandLink cmd2 = new TaskDialogCommandLink("continue", "Continue and ignore error");
     TaskDialogCommandLink cmd3 = new TaskDialogCommandLink("debug", "Debug the program", "Show the console and try to find out what happend");
     cmd1.Click += delegate(object a, EventArgs b) { Environment.Exit(1); };
     cmd2.Click += delegate(object a, EventArgs b) { diag.Close(); };
     cmd3.Click += delegate(object a, EventArgs b) {
         diag.Close();
         startConsole();
         Out.WritePlain("EZCap debug mode entered");
         Out.WritePlain("EZCap was forced to stop executing. Press enter to resume.");
         Console.Title = "EasyCapture Debug Session";
         Console.ReadLine();
         WINAPI.FreeConsole();
     };
     diag.Controls.Add(cmd1);
     diag.Controls.Add(cmd2);
     diag.Controls.Add(cmd3);
     diag.Caption = "Oops!";
     diag.DetailsExpandedLabel = "Hide error";
     diag.DetailsCollapsedLabel = "Show error";
     diag.Show();
 }
开发者ID:jariz,项目名称:EasyCapture,代码行数:31,代码来源:Core.cs

示例12: Step2

 static TaskDialog Step2(TaskDialog d)
 {
     d.Text = "Do you want to follow a quick tutorial to get started with EasyCapture?";
     d.FooterText = "Question 2/2";
     TaskDialogCommandLink cmd1 = new TaskDialogCommandLink("cmd1", "Yes, I'll follow the - really short - tutorial", "Recommended for people who have never used EasyCapture before");
     TaskDialogCommandLink cmd2 = new TaskDialogCommandLink("cmd2", "No, I already know how the program works");
     cmd1.Click += delegate(object sender, EventArgs argz) { d.Close(); ThreadPool.QueueUserWorkItem(new WaitCallback(DemoThread)); };
     cmd2.Click += delegate(object sender, EventArgs argz) { d.Close(); };
     d.Controls.Add(cmd1);
     d.Controls.Add(cmd2);
     return d;
 }
开发者ID:jariz,项目名称:EasyCapture,代码行数:12,代码来源:Core.cs

示例13: LicenceMessage

        public static void LicenceMessage(IWin32Window owner)
        {
            Licence lic = Options.Current.Licence;

            if (lic.IsValid)
            {
                return;
            }

            string caption = null;
            string message = null;
            bool die = false;

            if (lic.TrialInfo.LevelChanged)
            {
                switch (lic.TrialLevel)
                {
                    case TrialLevel.Remind:
                        caption = "Reminder";
                        message = "Don't forget, this is the trial version of Exception Explorer - but it wont last forever.\n\nConsider purchasing a licence if you would like to continue using Exception Explorer.";
                        break;
                    case TrialLevel.Warn:
                        caption = "Your trial will end soon!";
                        message = "Your time to use Exception Explorer will soon run out, so purchase a licence this week to avoid disappointment!";
                        break;
                    case TrialLevel.Stop:
                        caption = "Final chance...";
                        message = "This is your final chance to try out Exception Explorer.\n\nAfter this session, you will no longer be able to use this software without purchasing a licence.";
                        break;
                }
            }
            else if (lic.TrialLevel == TrialLevel.Stop)
            {
                caption = "Purchase a licence today.";
                message = "Unfortunately, your time to try Exception Explorer has now come to an end.\n\nFor this to happen, you must have been using this software enough to find it useful...\n\nFeel free to purchace a licence if you would like to continue using Exception Explorer.";
                die = true;
            }

            if (message != null)
            {
                TaskDialog td = new TaskDialog()
                {
                    InstructionText = caption.Fix(),
                    Text = message.Fix(),
                    StandardButtons = TaskDialogStandardButtons.Close,
                    Cancelable = true,
                    DetailsExpandedText = string.Format("Installed for {0} days.\nRan {1} times, over {2} distinct days.\n", lic.TrialInfo.DaysInstalled, lic.TrialInfo.RunCount, lic.TrialInfo.DayCount).Fix(),
                };

                TaskDialogCommandLink purchase = new TaskDialogCommandLink("purchase", "Purchase Licence".Fix());
                purchase.Click += (sender, e) =>
                {
                    Web.OpenSite(SiteLink.Buy);
                    td.Close();
                };

                td.Controls.Add(purchase);

                if (!die)
                {
                    TaskDialogCommandLink later = new TaskDialogCommandLink("later", "Maybe later");
                    later.Click += (sender, e) =>
                    {
                        td.Close();
                    };
                }

                td.Show(owner);

                if (die)
                {
                    Application.Exit();
                }
            }
        }
开发者ID:stegru,项目名称:ExceptionExplorer,代码行数:75,代码来源:Activation.cs

示例14: Main

        static void Main(string[] args)
        {
            string gameName;
            if (args.Length > 0)
                gameName = args[0];
            else gameName = "t6zm";

            Process[] games = Process.GetProcessesByName(gameName);
            Process gameProcess = null;
            if (games.Length > 1)
            {
                TaskDialog diag = new TaskDialog();
                diag.Caption = "Woops!";
                diag.InstructionText = "I found more than 2 running games!";
                diag.Icon = TaskDialogStandardIcon.Warning;
                diag.Text = "jZm has found more than just one game.\r\nWhat would you like to do?";
                foreach (Process game in games)
                {
                    TaskDialogCommandLink link = new TaskDialogCommandLink(game.ProcessName, game.ProcessName, "PID " + game.Id);
                    link.Click += delegate(object sender, EventArgs argz)
                    {
                        gameProcess = game;
                        diag.Close();
                    };
                    diag.Controls.Add(link);
                }
                TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart", "Restart jZm");
                linkz.ShowElevationIcon = true;
                linkz.Click += delegate(object sender, EventArgs argz)
                {
                    diag.Close();
                    Application.Restart();
                    //mare sure we're dead
                    Environment.Exit(-1);
                };
                diag.Controls.Add(linkz);
                linkz = new TaskDialogCommandLink("r", "Exit", "Exit jZm");
                linkz.ShowElevationIcon = true;
                linkz.Click += delegate(object sender, EventArgs argz)
                {
                    diag.Close();
                    Environment.Exit(-1);
                };
                diag.Controls.Add(linkz);

                diag.Show();
            }
            else if (games.Length == 0)
            {
                TaskDialog diag = new TaskDialog();
                diag.Caption = "Woops!";
                diag.InstructionText = "I was unable to find any games";
                diag.Icon = TaskDialogStandardIcon.Error;
                diag.Text = "jZm was unable to find any processes matching the name '" + gameName + "'.\r\nWhat would you like to do?";
                TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart jZm", "Restart and look for the game again");
                linkz.ShowElevationIcon = true;
                linkz.Click += delegate(object sender, EventArgs argz)
                {
                    diag.Close();
                    Application.Restart();
                    //mare sure we're dead
                    Environment.Exit(-1);
                };
                diag.Controls.Add(linkz);
                linkz = new TaskDialogCommandLink("r", "Exit jZm");
                linkz.Click += delegate(object sender, EventArgs argz)
                {
                    diag.Close();
                    Environment.Exit(-1);
                };
                diag.Controls.Add(linkz);
                diag.Show();
            }
            else gameProcess = games[0];

            API = new ZombieAPI.ZombieAPI();

            MainForm = new Main();
            MainForm.Show();

            try
            {
                API.Bootstrap(gameProcess);
            }
            catch (Exception z)
            {
                Crash(z);
            }

            Application.Run();
        }
开发者ID:jariz,项目名称:jZm,代码行数:91,代码来源:Program.cs

示例15: HandleUnexpectedException

        /// <summary>
        /// Handles the unexpected exception.
        /// </summary>
        /// <param name="ex">The exception.</param>
        /// <param name="isTerminating">if set to <c>true</c> the exception will terminate the execution.</param>
        public void HandleUnexpectedException(Exception ex, bool isTerminating = false)
        {
            if (ex is ThreadAbortException)
            {
                return;
            }

            var show = Settings.Get<bool>("Show Unhandled Errors");
            var sb   = new StringBuilder();

            parseException:
            sb.AppendLine(ex.GetType() + ": " + ex.Message);
            sb.AppendLine(ex.StackTrace);

            if (ex.InnerException != null)
            {
                ex = ex.InnerException;
                goto parseException;
            }

            if (show)
            {
                var mc  = Regex.Matches(sb.ToString(), @"\\(?<file>[^\\]+\.cs)(?::lig?ne|, sor:) (?<ln>[0-9]+)");
                var loc = "at a location where it was not expected";

                if (mc.Count != 0)
                {
                    loc = "in file {0} at line {1}".FormatWith(mc[0].Groups["file"].Value, mc[0].Groups["ln"].Value);
                }

                var td = new TaskDialog
                    {
                        Icon                  = TaskDialogStandardIcon.Error,
                        Caption               = "An unexpected error occurred",
                        InstructionText       = "An unexpected error occurred",
                        Text                  = "An exception of type {0} was thrown {1}.".FormatWith(ex.GetType().ToString().Replace("System.", string.Empty), loc) + (isTerminating ? "\r\n\r\nUnfortunately this exception occured at a crucial part of the code and the execution of the software will be terminated." : string.Empty),
                        DetailsExpandedText   = sb.ToString(),
                        DetailsExpandedLabel  = "Hide stacktrace",
                        DetailsCollapsedLabel = "Show stacktrace",
                        Cancelable            = true,
                        StandardButtons       = TaskDialogStandardButtons.None
                    };

                if ((bool)Dispatcher.Invoke((Func<bool>)(() => IsVisible)))
                {
                    td.Opened  += (s, r) => Utils.Win7Taskbar(100, TaskbarProgressBarState.Error);
                    td.Closing += (s, r) => Utils.Win7Taskbar(state: TaskbarProgressBarState.NoProgress);
                }

                var fd = new TaskDialogCommandLink { Text = "Submit bug report" };
                fd.Click += (s, r) =>
                    {
                        td.Close();
                        ReportException(sb.ToString());
                    };

                var ig = new TaskDialogCommandLink { Text = "Ignore exception" };
                ig.Click += (s, r) => td.Close();

                td.Controls.Add(fd);
                td.Controls.Add(ig);
                td.Show();
            }
            else
            {
                ReportException(sb.ToString());
            }
        }
开发者ID:cquiroscrc,项目名称:RS-TV-Show-Tracker,代码行数:73,代码来源:MainWindow.xaml.cs


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