protected override void OnClosed(EventArgs e) { App.Loaded = EProgramState.Unloading; base.OnClosed(e); UacDragDrop.AdminProcess.Enable(false); CodeInfo.Stop(); App.Model.Save.AllNowIfNeed(); }
protected override void OnVisibleChanged(EventArgs e) { //AOutput.Write("OnVisibleChanged", Visible, ((AWnd)this).IsVisible); //true, false bool visible = Visible; //note: we don't use OnLoad. It's unreliable, sometimes not called, eg when made visible from outside. if (visible && Program.Loaded == EProgramState.LoadedWorkspace) { //APerf.Next(); _StartProfileOptimization(); //fast APerf.Next('v'); Panels.PanelManager.ZGetPanel(Panels.Output).Visible = true; //else AOutput.Write would not auto set visible until the user makes it visible, because handle not created if invisible var hm = Api.GetSystemMenu(_Hwnd, false); Api.AppendMenu(hm, 0, c_menuid_Exit, "&Exit"); Application.AddMessageFilter(new _AppMessageFilter()); Panels.Files.ZOpenDocuments(); Program.Loaded = EProgramState.LoadedUI; Load?.Invoke(this, EventArgs.Empty); APerf.Next('o'); CodeInfo.UiLoaded(); #if TRACE ATimer.After(1, _ => { var s = CommandLine.TestArg; if (s != null) { AOutput.Write(ATime.PerfMicroseconds - Convert.ToInt64(s)); } //APerf.NW('V'); //EdDebug.PrintTabOrder(this); }); #endif } if (!visible) { CodeInfo.Stop(); } UacDragDrop.AdminProcess.Enable(visible); base.OnVisibleChanged(e); }
protected override void OnFormClosed(FormClosedEventArgs e) { if (Program.Loaded >= EProgramState.LoadedUI) { Program.Settings.wndPos = _Hwnd.SavePositionSizeState(); UacDragDrop.AdminProcess.Enable(false); } Program.Loaded = EProgramState.Unloading; ZCloseReason = e.CloseReason; base.OnFormClosed(e); CodeInfo.Stop(); Panels.Files.ZUnloadOnFormClosed(); EdTrayIcon.Dispose(); Program.Loaded = EProgramState.Unloaded; Application.Exit(); }