public static void Show(Exception e, Guid guid) {

			String message = String.Concat("Error ID: ", guid.ToString(), "\n\n", e.Message);

			TaskDialog dialog = new TaskDialog() {
				HyperlinksEnabled = true,
				DetailsExpanded = false,
				Cancelable = false,
				Icon = TaskDialogStandardIcon.Error,
				DetailsExpandedText = e.StackTrace,
				Caption = "Gmail Notifier Plus Error",
				InstructionText = "An unhandled exception occurred:",
				Text = message,
				FooterIcon = TaskDialogStandardIcon.Information,
				//Please <a href=\"#stub\">Click Here</a> to automagically report the issue.\
				FooterText = "Press CTL + C to copy this error to the clipboard."
			};

			dialog.HyperlinkClick += delegate(object sender, TaskDialogHyperlinkClickedEventArgs evt) {
				Send(guid);
			};

			SetWindowPos(dialog.OwnerWindowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

			dialog.Show();
		}
        // Configuration is applied at dialog creation time.
        internal NativeTaskDialog(NativeTaskDialogSettings settings, TaskDialog outerDialog)
        {
            nativeDialogConfig = settings.NativeConfiguration;
            this.settings = settings;

            // Wireup dialog proc message loop for this instance.
            nativeDialogConfig.callback = new TaskDialogNativeMethods.TaskDialogCallback(DialogProc);

            ShowState = DialogShowState.PreShow;

            // Keep a reference to the outer shell, so we can notify.
            this.outerDialog = outerDialog;
        }
        private void _LinkRemove_Click(object sender, EventArgs e)
        {
            TaskDialog dialog = new TaskDialog() {
                Caption = Program.MainForm.Text,
                InstructionText = Locale.Current.Preferences.Panels.Accounts.Account.RemoveConfirmation,
                OwnerWindowHandle = base.Handle
            };

            TaskDialogButton buttonYes = new TaskDialogButton("yesButton", Locale.Current.Preferences.Panels.Accounts.Account.RemoveAccount);
            buttonYes.Default = true;
            buttonYes.Click += delegate(object s, EventArgs ev) {

                AccountListItem target = _ListAccounts.Items.Cast<AccountListItem>().Where(o => o.Account == _currentAccount).FirstOrDefault();

                if(target != null){
                    _ListAccounts.Items.Remove(target);
                }

                Config.Current.Accounts.Remove(_currentAccount);
                Config.Current.Save();

                _currentAccount = null;

                dialog.Close();

                HidePanels();
                _PanelAccounts.Show();
            };

            TaskDialogButton buttonNo = new TaskDialogButton("noButton", Locale.Current.Common.No);
            buttonNo.Click += delegate(object s, EventArgs ev) {
                dialog.Close();
            };

            dialog.Controls.Add(buttonYes);
            dialog.Controls.Add(buttonNo);
            dialog.Show();
        }
        private void _ButtonAccountAction_Click(object sender, EventArgs e)
        {
            Account account = _currentAccount ?? new Account();

            account.Login = _TextAddress.Text;

            if (AccountExists(account, _currentAccount)) {
                TaskDialog dialog = new TaskDialog() {
                    Caption = Program.MainForm.Text,
                    InstructionText = Locale.Current.Preferences.Panels.Accounts.Account.Error,
                    Cancelable = false,
                    OwnerWindowHandle = this.Handle,
                    Icon = TaskDialogStandardIcon.Warning
                };

                dialog.Show();
                return;
            }

            account.Password = _TextPassword.Text.Length > 0 ? _TextPassword.Text : account.Password;
            account.Browser = _ComboBrowser.SelectedValue as Shellscape.Browser;

            if (_CheckDefaultAccount.Checked) {
                Config.Current.Accounts.ForEach(a => a.Default = false);
                account.Default = true;
            }

            Account mailtoAccount = Config.Current.Accounts.Where(o => o.HandlesMailto).FirstOrDefault();

            if (_CheckMailto.Checked) {

                if (mailtoAccount != null) {
                    mailtoAccount.HandlesMailto = false;
                }

                account.HandlesMailto = true;

                ToggleMailto(true);
            }
            else {
                if (mailtoAccount == null) {
                    ToggleMailto(false);
                }
            }

            if (_currentAccount == null) {
                _ListAccounts.Items.Add(new AccountListItem(account));
                Config.Current.Accounts.Add(account);
            }

            Config.Current.Save();

            if (_currentAccount != null) {
                Config.Current.Accounts.TriggerDirty(account);
            }

            _ButtonAccountAction.Enabled = false;

            this.HidePanels();
            _PanelAccounts.Show();
        }
示例#5
0
		private void _Updates_DownloadComplete(object sender, AsyncCompletedEventArgs e) {

			_config.StartupState = StartupState.Second;
			_config.Save();

			Shellscape.UpdateManager.Current.Replace(Config.Current.AppDataPath, Path.GetDirectoryName(Application.ExecutablePath)); // @"C:\Users\Andrew\AppData\Roaming\Gmail Notifier Plus\Updates\test");

			using(TaskDialog dialog = new TaskDialog() {
				Text = Locale.Current.Updates.Text,
				Icon = TaskDialogStandardIcon.Information
			}) {

				TaskDialogCommandLink yes = new TaskDialogCommandLink("yes", Locale.Current.Updates.YesText, Locale.Current.Updates.YesInstruction);
				yes.Click += delegate(object s, EventArgs ea) {

					EventHandler handler = null;

					handler = delegate(object o, EventArgs args) {
						Application.ApplicationExit -= handler;
						System.Diagnostics.Process.Start(Application.ExecutablePath);
					};

					Application.ApplicationExit += handler;
					Invoke((Action)(() => Application.Exit()));

					dialog.Close();
				};

				TaskDialogCommandLink no = new TaskDialogCommandLink("no", Locale.Current.Updates.NoText, Locale.Current.Updates.NoInstruction);
				no.Click += delegate(object s, EventArgs ea) {
					dialog.Close();
				};

				dialog.Caption = dialog.InstructionText = "Gmail Notifier Plus " + Locale.Current.Updates.WindowTitle;
				dialog.Controls.Add(yes);
				dialog.Controls.Add(no);
				dialog.Show();

			}
		}
示例#6
0
        private Boolean Ask(String function, String yes)
        {
            if (!Config.Current.Ask) {
                return true;
            }

            using (TaskDialog dialog = new TaskDialog() { Icon = TaskDialogStandardIcon.Information }) {

                TaskDialogCommandLink yesButton = new TaskDialogCommandLink("yes", "Yes, " + function, yes);
                yesButton.Click += delegate(object s, EventArgs ea) {
                    dialog.Close(TaskDialogResult.Yes);
                };

                TaskDialogCommandLink noButton = new TaskDialogCommandLink("no", "No", "Get me out of here...");
                noButton.Click += delegate(object s, EventArgs ea) {
                    dialog.Close(TaskDialogResult.No);
                };

                dialog.InstructionText = "Are you sure you want to " + function + "?";
                dialog.Caption = "Simple Power Plus - " + function;
                dialog.Controls.Add(yesButton);
                dialog.Controls.Add(noButton);

                var result = dialog.Show();

                return result == TaskDialogResult.Yes;
            }
        }
示例#7
0
        // CORE SHOW METHODS:
        // All static Show() calls forward here - 
        // it is responsible for retrieving
        // or creating our cached TaskDialog instance, getting it configured,
        // and in turn calling the appropriate instance Show.

        private static TaskDialogResult ShowCoreStatic(
            string text,
            string instructionText,
            string caption)
        {
            CoreHelpers.ThrowIfNotVista();

            // If no instance cached yet, create it.
            if (staticDialog == null)
            {
                // New TaskDialog will automatically pick up defaults when 
                // a new config structure is created as part of ShowCore().
                staticDialog = new TaskDialog();
            }

            // Set the few relevant properties, 
            // and go with the defaults for the others.
            staticDialog.text = text;
            staticDialog.instructionText = instructionText;
            staticDialog.caption = caption;

            return staticDialog.Show();
        }
示例#8
0
        /// <summary>
        /// Dispose TaskDialog Resources
        /// </summary>
        /// <param name="disposing">If true, indicates that this is being called via Dispose rather than via the finalizer.</param>
        public void Dispose(bool disposing)
        {
            if (!disposed)
            {
                disposed = true;

                if (disposing)
                {
                    // Clean up managed resources.
                    if (nativeDialog != null && nativeDialog.ShowState == DialogShowState.Showing)
                    {
                        nativeDialog.NativeClose(TaskDialogResult.Cancel);
                    }

                    buttons = null;
                    radioButtons = null;
                    commandLinks = null;
                }

                // Clean up unmanaged resources SECOND, NTD counts on 
                // being closed before being disposed.
                if (nativeDialog != null)
                {
                    nativeDialog.Dispose();
                    nativeDialog = null;
                }

                if (staticDialog != null)
                {
                    staticDialog.Dispose();
                    staticDialog = null;
                }


            }
        }