コード例 #1
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult dr = MessageBox.Show(Constant.formCloseTips, Constant.formCloseTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Information);//触发事件进行提示

            if (dr == DialogResult.No)
            {
                e.Cancel = true;//就不退了
                return;
            }
            else
            {
                e.Cancel = false;//退了
            }

            UpdateTimer.Enabled   = false;
            FileSaveTimer.Enabled = false;
            if (evokWork != null)
            {
                evokWork.Dispose();
            }
            WriteUserData();
            ConstantMethod.Delay(100);

            Environment.Exit(0);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: w7789475/EVOK
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult dr = MessageBox.Show("关闭软件前,请关闭各个设备,是否继续关闭程序?", "关闭提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);//触发事件进行提示

            if (dr == DialogResult.No)
            {
                e.Cancel = true;//就不退了
                return;
            }
            else
            {
                foreach (EvokXJWork work in evokWorkLst)
                {
                    Thread t1 = new Thread(new ThreadStart(delegate
                    {
                        work.stop();
                    }));
                    t1.Start();
                }

                e.Cancel = false;//退了
            }

            UpdateTimer.Enabled = false;

            //FileSaveTimer.Enabled = false;
            if (evokWork0 != null)
            {
                evokWork0.Dispose();
            }
            if (evokWork1 != null)
            {
                evokWork1.Dispose();
            }
            if (evokWork2 != null)
            {
                evokWork2.Dispose();
            }

            ConstantMethod.Delay(100);

            Environment.Exit(0);
        }