private void FrmSetting_FormClosing(object sender, FormClosingEventArgs e) { RegUtil.SetFormPos(this); e.Cancel = true; InfoShower.ShowOnce(new InfoShower() { ExistTime = 10000, Title = "无效的操作", Info = "如果需要关闭程序,点击此处", TitleColor = Color.PaleVioletRed, CallBack = () => { this.Hide(); Program.frmMain.Close(); } }); }
public FrmMain() { //RegUtil.SetIEBrowserTempPath(); InitializeComponent(); //HttpClient.UsedFidder = true; //RegUtil.SetIEBrowserTempPathEnd(); WebShow.ScriptErrorsSuppressed = true; WebShow.DocumentCompleted += WebShow_DocumentCompleted; WebShow.NewWindow += WebShow_NewWindow; BtnShowBuyList.Click += (x, xx) => { SendLoadBillMessageToServer(); TryLoadBill(true); }; this.FormClosing += (x, xx) => { frmClosing = true; RegUtil.SetFormPos(this); }; ipWebShowUrl.KeyPress += IpWebShowUrl_KeyPress; ThreadMonitor = new Thread(() => { int heartBeatCount = 0; while (!frmClosing) { Thread.Sleep(1000); heartBeatCount++; if (heartBeatCount > 10) { Program.Tcp?.Send(new MsgHeartBeatMessage()); heartBeatCount = 0; } } }) { IsBackground = true }; this.Show(); int[] tmpBounds = RegUtil.GetFormPos(this); this.Left = tmpBounds[0]; this.Top = tmpBounds[1]; this.Width = tmpBounds[2]; this.Height = tmpBounds[3]; InitTcp(); ThreadMonitor.Start(); }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) { RegUtil.SetFormPos(this); InfoShow.Dispose(); }