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


C# TaskDialog.Show方法代码示例

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


在下文中一共展示了TaskDialog.Show方法的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: Show

        /// <summary>
        /// Shows the dialog.
        /// </summary>
        public static TaskDialogResult Show(IntPtr owner)
        {
            TaskDialog td = new TaskDialog();

            TaskDialogCommandLink cusButton = new TaskDialogCommandLink("cusButton", U.T("AssociationsChoose"), U.T("AssociationsChooseText"));
            TaskDialogCommandLink skipButton = new TaskDialogCommandLink("skipButton", U.T("AssociationsSkip"), U.T("AssociationsSkipText"));
            TaskDialogCommandLink defButton = new TaskDialogCommandLink("defButton", U.T("AssociationsYes"), U.T("AssociationsYesText"));

            defButton.Click += new EventHandler(defButton_Click);
            skipButton.Click += new EventHandler(skipButton_Click);

            td.Controls.Add(defButton);
            td.Controls.Add(cusButton);
            td.Controls.Add(skipButton);

            td.Caption = U.T("AssociationsCaption");
            td.InstructionText = U.T("AssociationsInstruction");
            td.Text = U.T("AssociationsText");
            td.StartupLocation = TaskDialogStartupLocation.CenterOwner;
            td.OwnerWindowHandle = owner;
            return td.Show();
        }
开发者ID:Erls-Corporation,项目名称:YAMA,代码行数:25,代码来源:Welcome.cs

示例3: 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

示例4: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem != null)
            {
                ParentalControlsCredential cred = new ParentalControlsCredential(textBox1.Text, textBox2.Text, false);
                if(!file.Remove((ParentalControlsCredential)comboBox1.SelectedItem))
                {
                    TaskDialog dialog = new TaskDialog();

                    dialog.Caption = this.Text;
                    dialog.InstructionText = "Failed to Change Credential";
                    dialog.Text = "An unknown error occured while changing \""+((ParentalControlsCredential)comboBox1.SelectedItem).Username+"\"";
                    dialog.Opened += (a, b) =>
                    {
                        dialog.Icon = TaskDialogStandardIcon.Error;
                    };

                    dialog.Show();
                }
                else
                {
                    file.Add(cred);
                    RefreshItems(false);
                    comboBox1.SelectedItem = cred;
                }
            }
        }
开发者ID:gamenew09,项目名称:ParentalControls,代码行数:27,代码来源:CredentialEditor.cs

示例5: ExecuteStart

        private void ExecuteStart(object sender, RoutedEventArgs e)
        {
            if (!_viewModel.DoNotShowWarning)
            {
                using (TaskDialog dlg = new TaskDialog())
                {
                    dlg.Caption = "Подтвердите операцию";
                    dlg.Text = "Во время своей работы приложение создаст временные базы данных на указанном вами сервере. Они будут удалены сразу после окончания тестирования.\r\n\r\nНе используйте данное приложение с рабочим SQL Server!";
                    dlg.Cancelable = true;
                    var okLink = new TaskDialogCommandLink("ok", "Согласен. Продолжаем!");
                    okLink.Click += (sender2, e2) => ((TaskDialog)((TaskDialogCommandLink)sender2).HostingDialog).Close(TaskDialogResult.Ok);
                    var cancelLink = new TaskDialogCommandLink("cancel", "Я передумал") {Default = true};
                    cancelLink.Click += (sender2, e2) => ((TaskDialog)((TaskDialogCommandLink)sender2).HostingDialog).Close(TaskDialogResult.Cancel);
                    dlg.Controls.Add(okLink);
                    dlg.Controls.Add(cancelLink);
                    dlg.FooterCheckBoxText = "Больше не спрашивать";

                    var result = dlg.Show();
                    _viewModel.DoNotShowWarning = dlg.FooterCheckBoxChecked.Value;
                    if (result != TaskDialogResult.Ok) return;
                }
            }

            _viewModel.PoolTestRunning = true;
            _viewModel.Server = tbServer.Text.Trim();
            _viewModel.UseSqlAuthentication = cbUseSqlAuth.IsChecked.Value;
            _viewModel.UserName = tbUserName.Text.Trim();
            _viewModel.Password = tbPassword.Password;
            _viewModel.LogLines.Clear();

            Thread t = new Thread(_presenter.RunPoolTest);
            t.Start();
        }
开发者ID:bazile,项目名称:Training,代码行数:33,代码来源:MainWindow.xaml.cs

示例6: continueButton_Click

        /*
         * Continue button click event handler.
         */
        private void continueButton_Click(object sender, EventArgs e) {
            // Save team domain if valid otherwise show team not found information dialog
            if(IsTeamDomainValid()) {
                SlackTeamDomain = teamDomainTextBox.Text.ToLowerInvariant();
                DialogResult = DialogResult.OK;
                Close();
            } else {
                TaskDialog noTeamDialog = new TaskDialog() {
                    Caption = Application.ProductName,
                    HyperlinksEnabled = true,
                    Icon = TaskDialogStandardIcon.Information,
                    InstructionText = "We couldn't find your team.",
                    OwnerWindowHandle = Handle,
                    StandardButtons = TaskDialogStandardButtons.Ok,
                    Text = "If you can't remember your team's address, Slack can <a href=\"#\">send you a reminder</a>."
                };

                noTeamDialog.HyperlinkClick += delegate { Process.Start(FindYourTeamUrl); };

                // Workaround for a bug in the Windows TaskDialog API
                noTeamDialog.Opened += (td, ev) => {
                    TaskDialog taskDialog = td as TaskDialog;
                    taskDialog.Icon = noTeamDialog.Icon;
                    taskDialog.InstructionText = noTeamDialog.InstructionText;
                };

                noTeamDialog.Show();
            }
        }
开发者ID:bewbaloo,项目名称:SlackUI,代码行数:32,代码来源:TeamPickerForm.cs

示例7: Show

        public static void Show(Window owner = null, string text = "", string instructionText = "", string caption = "Information")
        {
            IntPtr windowHandle = IntPtr.Zero;

            if (owner == null)
                windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
            else
                windowHandle = new WindowInteropHelper(owner).Handle;

            try
            {
                using (TaskDialog taskDialog = new TaskDialog())
                {
                    taskDialog.OwnerWindowHandle = windowHandle;
                    taskDialog.StandardButtons = TaskDialogStandardButtons.Ok;
                    taskDialog.StartupLocation = TaskDialogStartupLocation.CenterOwner;
                    taskDialog.Icon = TaskDialogStandardIcon.Information;
                    taskDialog.Text = text;
                    taskDialog.InstructionText = instructionText;
                    taskDialog.Caption = caption;
                    taskDialog.Show();
                }
            }
            catch (Exception)
            {
                if (owner != null)
                    MessageBox.Show(owner, text, caption, MessageBoxButton.OK, MessageBoxImage.Information);
                else
                    MessageBox.Show(text, caption, MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
开发者ID:PkuRainBow,项目名称:leafasis,代码行数:31,代码来源:InformationDialog.cs

示例8: 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

示例9: ButtonTaskDialogIconFix_Click

 private void ButtonTaskDialogIconFix_Click(object sender, RoutedEventArgs e)
 {
     using (var dialog = new TaskDialog
     {
         Caption = "Caption",
         DetailsCollapsedLabel = "DetailsCollapsedLabel",
         DetailsExpanded = true,
         DetailsExpandedLabel = "DetailsExpandedLabel",
         DetailsExpandedText = "DetailsExpandedText",
         ExpansionMode = TaskDialogExpandedDetailsLocation.ExpandContent,
         FooterCheckBoxChecked = true,
         FooterCheckBoxText = "FooterCheckBoxText",
         FooterIcon = TaskDialogStandardIcon.Information,
         FooterText = "FooterText",
         HyperlinksEnabled = true,
         Icon = TaskDialogStandardIcon.Shield,
         InstructionText = "InstructionText",
         ProgressBar = new TaskDialogProgressBar {Value = 100},
         StandardButtons =
             TaskDialogStandardButtons.Ok | TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No |
             TaskDialogStandardButtons.Cancel | TaskDialogStandardButtons.Close | TaskDialogStandardButtons.Retry,
         StartupLocation = TaskDialogStartupLocation.CenterScreen,
         Text = "Text"
     })
     {
         dialog.Show();
     }
 }
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:28,代码来源:MainWindow.xaml.cs

示例10: 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

示例11: HandleException

        public static void HandleException(Window window, FileNotFoundException ex)
        {
            try
            {
                string fileName = Path.GetFileName(ex.FileName);
                string message = string.Format(Properties.Resources.MessageFileNotFoundException, fileName);

                TaskDialog dialog = new TaskDialog();

                dialog.InstructionText = message;
                //dialog.Text
                dialog.Icon = TaskDialogStandardIcon.Error;
                dialog.StandardButtons = TaskDialogStandardButtons.Ok;

                dialog.DetailsExpandedText = ex.Message;

                dialog.Caption = App.Current.ApplicationTitle;
                if (window != null)
                {
                    dialog.OwnerWindowHandle = new WindowInteropHelper(window).Handle;
                }

                dialog.Show();
            }
            catch (PlatformNotSupportedException)
            {
                MessageBox.Show(ex.Message);
            }
        }
开发者ID:wallymathieu,项目名称:Prolog.NET,代码行数:29,代码来源:CommonExceptionHandlers.cs

示例12: cmdShow_Click

        private void cmdShow_Click(object sender, EventArgs e)
        {
            TaskDialog td = new TaskDialog();

            #region Button(s)

            TaskDialogStandardButtons button = TaskDialogStandardButtons.None;

            if (chkOK.Checked) button |= TaskDialogStandardButtons.Ok; 
            if (chkCancel.Checked) button |= TaskDialogStandardButtons.Cancel;

            if (chkYes.Checked) button |= TaskDialogStandardButtons.Yes;
            if (chkNo.Checked) button |= TaskDialogStandardButtons.No;

            if (chkClose.Checked) button |= TaskDialogStandardButtons.Close;
            if (chkRetry.Checked) button |= TaskDialogStandardButtons.Retry;

            #endregion

            #region Icon

            if (rdoError.Checked)
            {
                td.Icon = TaskDialogStandardIcon.Error;
            }
            else if (rdoInformation.Checked)
            {
                td.Icon = TaskDialogStandardIcon.Information;
            }
            else if (rdoShield.Checked)
            {
                td.Icon = TaskDialogStandardIcon.Shield;
            }
            else if (rdoWarning.Checked)
            {
                td.Icon = TaskDialogStandardIcon.Warning;
            }

            #endregion

            #region Prompts

            string title = txtTitle.Text;
            string instruction  = txtInstruction.Text;
            string content = txtContent.Text;

            #endregion

            td.StandardButtons = button;
            td.InstructionText = instruction;
            td.Caption = title;
            td.Text = content;
            td.OwnerWindowHandle = this.Handle;
            
            TaskDialogResult res = td.Show();

            this.resultLbl.Text = "Result = " + res.ToString();
        }
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:58,代码来源:TestHarness.cs

示例13: 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

示例14: GetNewReplayFolder

        /// <summary>
        /// Ask a new replays folder to the user and return it.
        /// </summary>
        /// <param name="oldPath">The old Path to show in the message box</param>
        /// <returns>return a string for the new path with the replay</returns>
        public static bool GetNewReplayFolder( string oldPath, out string newPath )
        {
            // Select a new folder command link
            var anotherReplayFolderCMDLink = new TaskDialogCommandLink("anotherFolder", "Select another replay folder\nThe folder must have .wargamerpl2 files");
            anotherReplayFolderCMDLink.Click += AnotherReplayFolderCMDLink_Click;


            // Exit Application command link
            var exitApplicationCMDLink = new TaskDialogCommandLink("exitApplication", "Exit the application");
            exitApplicationCMDLink.Click += ( s, d ) =>
            {
                _buttonPressed = "exitApplication";
                var s2 = (TaskDialogCommandLink)s;
                var taskDialog = (TaskDialog)(s2.HostingDialog);
                //taskDialog.Close(TaskDialogResult.CustomButtonClicked);
            };

            // Task Dialog settings
            var td = new TaskDialog();
            td.Caption = "Empty Replay Folder";
            td.Controls.Add(anotherReplayFolderCMDLink);
            td.Controls.Add(exitApplicationCMDLink);
            td.Icon = TaskDialogStandardIcon.Error;
            td.InstructionText = String.Format("The Replay folder is empty.");
            td.Text = String.Format("The folder {0} doesn't contains any .wargamerpl2 files.", oldPath);

            td.Closing += Td_Closing;
            TaskDialogResult tdResult = td.Show();

            if ( tdResult == TaskDialogResult.CustomButtonClicked )
            {
                if( _buttonPressed == "anotherFolder" && !String.IsNullOrEmpty(_newPath))
                {
                    newPath = _newPath;
                    return true;
                }
                else
                {
                    newPath = null;
                    return false;
                }
            }
            else
            {
                newPath = null;
                return false;
            }

        }
开发者ID:RemiGC,项目名称:RReplay,代码行数:54,代码来源:ReplayFolderPicker.cs

示例15: 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


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