public MainForm(IPersistence persistence) { try { this.persistence = persistence; settings.StartDelayedUpdate(); // Set default font type by Windows theme to use for all controls on form this.Font = SystemFonts.IconTitleFont; InitializeComponent(); // main designer procedure this.formSettings = new FormSettings(this); this.terminalsControler = new TerminalTabsSelectionControler(this.tcTerminals, this.persistence); this.connectionsUiFactory = new ConnectionsUiFactory(this, this.terminalsControler, this.persistence); this.terminalsControler.AssingUiFactory(this.connectionsUiFactory); // Initialize FavsList outside of InitializeComponent // Inside InitializeComponent it sometimes caused the design view in VS to return errors this.InitializeFavsListControl(); // Set notifyicon icon from embedded png image this.MainWindowNotifyIcon.Icon = Icon.FromHandle(Properties.Resources.terminalsicon.GetHicon()); this.menuLoader = new FavoritesMenuLoader(this, this.persistence); this.favoriteToolBar.Visible = this.toolStripMenuItemShowHideFavoriteToolbar.Checked; this.fullScreenSwitch = new MainFormFullScreenSwitch(this); this.tabControlRemover = new TabControlRemover(this.settings, this, this.tcTerminals); this.favsList1.Persistence = this.persistence; this.AssignToolStripsToContainer(); this.ApplyControlsEnableAndVisibleState(); this.menuLoader.LoadGroups(); this.UpdateControls(); this.LoadWindowState(); this.CheckForMultiMonitorUse(); this.tcTerminals.TabControlItemDetach += new TabControlItemChangedHandler(this.TcTerminals_TabDetach); this.tcTerminals.MouseClick += new MouseEventHandler(this.TcTerminals_MouseClick); this.QuickContextMenu.ItemClicked += new ToolStripItemClickedEventHandler(QuickContextMenu_ItemClicked); this.LoadSpecialCommands(); ProtocolHandler.Register(); this.persistence.AssignSynchronizationObject(this); } catch (Exception exc) { Logging.Error("Error loading the Main Form", exc); throw; } }
public MainForm() { try { Log.InsideMethod(); this.fullScreenSwitch = new MainFormFullScreenSwitch(this); this.PersistWindowState(); mainForm = this; this.specialCommandsMethodInvoker = this.LoadSpecialCommands; this.ShowWizardAndReloadSpecialCommands(); Settings.StartDelayedUpdate(); // Set default font type by Windows theme to use for all controls on form this.Font = SystemFonts.IconTitleFont; // main designer procedure this.InitializeComponent(); // Set notifyicon icon from embedded png image this.MainWindowNotifyIcon.Icon = Resources.terminalsicon; this.terminalsControler = new TerminalTabsSelectionControler(this, this.tcTerminals); this.menuLoader = new FavoritesMenuLoader(this.favoritesToolStripMenuItem, this.tscConnectTo, this.serverToolStripMenuItem_Click, this.favoriteToolBar, this.QuickContextMenu, this.QuickContextMenu_ItemClicked); this.favoriteToolBar.Visible = this.toolStripMenuItemShowHideFavoriteToolbar.Checked; this.AssignToolStripsToContainer(); this.tcTerminals.MouseDown += this.tcTerminals_MouseDown; this.tcTerminals.MouseUp += this.tcTerminals_MouseUp; this.tcTerminals.MouseClick += this.tcTerminals_MouseClick; this.QuickContextMenu.ItemClicked += this.QuickContextMenu_ItemClicked; DataDispatcher.AssignSynchronizationObject(this); } catch (Exception exc) { Log.Error("Error loading the main form", exc); } }