Пример #1
0
        /// <summary>
        /// Event handler triggered when the "Preferences" context menu item gets activated.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">Event arguments.</param>
        private static void OnPreferencesClicked(object sender, EventArgs e)
        {
            if (PreferencesDialog.IsOpen)
            {
                Logger.WriteLine(LogLevel.Warning, "preferences dialog already open - ignoring");
                return;
            }

            using (PreferencesDialog preferencesDialog = new PreferencesDialog()) {
                preferencesDialog.ShowDialog();
            }
        }
Пример #2
0
        /// <summary>
        /// HACK: Updates Preferences dialog
        /// </summary>
        private static void UpdatePreferencesDialog()
        {
            if (!PreferencesDialog.IsOpen)
            {
                return;
            }

            PreferencesDialog dialog = (from form in Application.OpenForms.Cast <Form>()
                                        where form.Name == "PreferencesDialog"
                                        select form as PreferencesDialog).First();

            if (dialog == null)
            {
                return;
            }

            dialog.Invoke(new MethodInvoker(() => {
                dialog.InitializeStyles();
                dialog.PopulateActions();
            }));
        }