private void FormConfiger_Load(object sender, EventArgs e) { setting.RestoreFormRect(this); InitToolsPanel(); this.configer = InitConfiger(); SetTitle(configer.GetAlias()); ToggleToolsPanel(isShowPanel); chkIsV4.Checked = setting.isUseV4; editor = configer .GetComponent <Controllers.ConfigerComponet.Editor>() .GetEditor(); editor.Click += OnMouseLeaveToolsPanel; BindServerEvents(); this.FormClosing += (s, a) => { if (!configer.IsConfigSaved()) { a.Cancel = !Misc.UI.Confirm(I18N.ConfirmCloseWinWithoutSave); } }; this.FormClosed += (s, a) => { formSearch?.Close(); editor.Click -= OnMouseLeaveToolsPanel; toolsPanelController.Dispose(); ReleaseServerEvents(); configer.Cleanup(); editor?.Dispose(); setting.SaveFormRect(this); setting.LazyGC(); }; configer.UpdateServerMenusLater(); }
private void FormMain_Load(object sender, EventArgs e) { UpdateFormTitle(this, EventArgs.Empty); setting.RestoreFormRect(this); // https://alexpkent.wordpress.com/2011/05/11/25/ // 添加新控件的时候会有bug,不显示新控件 // ToolStripManager.LoadSettings(this); this.FormClosing += (s, a) => { if (updateTitleTimer != null) { updateTitleTimer.Stop(); updateTitleTimer.Tick -= UpdateFormTitle; updateTitleTimer.Dispose(); } }; this.FormClosed += (s, a) => { setting.SaveFormRect(this); // ToolStripManager.SaveSettings(this); formMainCtrl.Cleanup(); setting.LazyGC(); }; formMainCtrl = InitFormMainCtrl(); BindToolStripButtonToMenuItem(); updateTitleTimer = new Timer { Interval = 2000, }; updateTitleTimer.Tick += UpdateFormTitle; updateTitleTimer.Start(); }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { setting.SaveFormRect(this); setting.LazyGC(); }