Example #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (IsDesignMode)
            {
                return;
            }
            if (!Program.IsDebug)
            {
                MainTabControl.TabPages.Remove(ResourcesTabPage);
            }
            MainStripStatusLabel.Text = string.Empty;
            //MainTreeView.Nodes[1].Remove();
            ConfigureMenuItems();
            //switch (WindowState)
            //{
            //	case FormWindowState.Maximized: WindowState = FormWindowState.Maximized; break;
            //	case FormWindowState.Minimized: MinimizeToTray(); Show(); break;
            //	case FormWindowState.Normal: WindowState = FormWindowState.Normal; break;
            //}
            var info = new AssemblyInfo();

            Text = info.FullTitle;
            // Select generator.
            GeneratorPanel.CallsTextBox.Focus();
            ScriptPanel.OpenToolStripButton.Visible     = false;
            ScriptPanel.AutoLoadToolStripButton.Checked = false;
            ScriptPanel.AutoLoadToolStripButton.Visible = false;
            ScriptPanel.AutoRunToolStripButton.Checked  = false;
            ScriptPanel.AutoRunToolStripButton.Visible  = false;
            ScriptPanel.AutoStripSeparator.Visible      = false;
            ScriptPanel.SupressRunDefaultFunction       = true;
            ScriptPanel.RunToolStripButton.Click       += new EventHandler(ControlAutoRunButton_Click);
            OptionsPanel.Initialize();
            GeneratorPanel.Initialize();
            AboutPanel.Initialize();
            SetAlwaysOnTop(Settings.Default.AlwaysOnTop);
            SetStartWithWindows(Settings.Default.StartWithWindows);
            SetStartWithWindowsState(Settings.Default.StartWithWindowsState);
            UpdateWindowsStartRegistry(Settings.Default.StartWithWindows, Settings.Default.StartWithWindowsState);
            // Add this event at the end to prevent freezing.
            this.Resize += new System.EventHandler(this.MainForm_Resize);
            // Begin generation of password by selecting preset.
            string[] names = GeneratorPanel.Presets.Select(x => x.PresetName).ToArray();
            PassGenHelper.LoadPresets(GeneratorPanel.PresetNameComboBox, names, Settings.Default.PresetNameComboBox);
        }