Inheritance: System.Windows.Forms.Form
Example #1
0
        // Menu item handlers:
        void ShowSettings(object o, EventArgs e)
        {
            TemplatorConfig dlg = new TemplatorConfig(Settings.TemplateName,
                                                      Settings.Parameters,
                                                      Settings.Replacements,
                                                      Settings.SkipIfNoTemplates,
                                                      Settings.RemoveExcessPipes)
            {
                Width  = Settings.dlgWidth,
                Height = Settings.dlgHeight
            };

            dlg.paramName.Width  = dlg.replacementParamName.Width = Settings.dlgCol0;
            dlg.paramRegex.Width = dlg.replacementExpression.Width = Settings.dlgCol1;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Settings.TemplateName      = dlg.TemplateName;
                Settings.SkipIfNoTemplates = dlg.SkipIfNone;
                Settings.RemoveExcessPipes = dlg.RemoveExcessPipes;
                Settings.Parameters        = dlg.Parameters;
                Settings.Replacements      = dlg.Replacements;
                Settings.dlgWidth          = dlg.Width;
                Settings.dlgHeight         = dlg.Height;
                Settings.dlgCol0           = dlg.paramName.Width;
                Settings.dlgCol1           = dlg.paramRegex.Width;
                RegexString = ""; // force the main regex to be evaluated on next use
            }
        }
Example #2
0
        public void Initialise(WikiFunctions.Plugin.IAutoWikiBrowser sender)
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }

            AWB = sender;

            // Menuitem should be checked when CFD plugin is active and unchecked when not, and default to not!

            pluginMenuItem.CheckedChanged += PluginEnabledCheckedChange;
            pluginConfigMenuItem.Click    += ShowSettings;
            aboutMenuItem2.Click          += AboutMenuItemClicked;

#if SHORT_PLUGIN_MENU
            pluginMenuItem.CheckOnClick = true;
            pluginMenuItem.DropDownItems.Add(pluginConfigMenuItem);
#else
            pluginEnabledMenuItem.CheckOnClick    = true;
            pluginConfigMenuItem.Click           += ShowSettings;
            pluginEnabledMenuItem.CheckedChanged += PluginEnabledCheckedChange;
            aboutMenuItem1.Click += AboutMenuItemClicked;

            pluginMenuItem.DropDownItems.Add(pluginEnabledMenuItem);
            pluginMenuItem.DropDownItems.Add(pluginConfigMenuItem);
            pluginMenuItem.DropDownItems.Add("-");
            pluginMenuItem.DropDownItems.Add(aboutMenuItem1);
#endif

            sender.PluginsToolStripMenuItem.DropDownItems.Add(pluginMenuItem);
            sender.HelpToolStripMenuItem.DropDownItems.Add(aboutMenuItem2);

            // get defaults for the dialog from the designer
            TemplatorConfig dlg = new TemplatorConfig(defaultSettings.TemplateName,
                                                      defaultSettings.Parameters,
                                                      defaultSettings.Replacements,
                                                      defaultSettings.SkipIfNoTemplates,
                                                      defaultSettings.RemoveExcessPipes);
            defaultSettings.dlgWidth  = dlg.Width;
            defaultSettings.dlgHeight = dlg.Height;
            defaultSettings.dlgCol0   = dlg.paramName.Width;
            defaultSettings.dlgCol1   = dlg.paramRegex.Width;
        }