Exemplo n.º 1
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (!iscancel)
                {
                    //DialogResult dialogResult = MessageBox.Show("确定退出吗?", "隐心提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                    ComfirmDialog cd = new ComfirmDialog();
                    cd.SetMessage("确定退出吗?", "隐心提示");
                    cd.ShowDialog(this);
                    if (ComfirmDialog.isOk)
                    {
                        iscancel = true;
                        if (firstExit)
                        {
                            e.Cancel = true;
                            Process.GetInstance().StartCloseThread();
                        }
                        else
                        {
                            Thread.Sleep(1000);
                        }
                    }
                    else
                    {
                        e.Cancel = true;//就不退了
                    }
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }
            catch { }
        }
Exemplo n.º 2
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (!iscancel)
                {
                    //DialogResult dialogResult = MessageBox.Show("确定退出吗?", "隐心提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                    ComfirmDialog cd = new ComfirmDialog();
                    cd.SetMessage("确定退出吗?", "隐心提示");
                    cd.ShowDialog(this);
                    if (ComfirmDialog.isOk)
                    {
                        iscancel = true;
                        if (firstExit)
                        {
                            e.Cancel = true;
                            Process.GetInstance().StartCloseThread();
                        }
                        else
                        {
                            Thread.Sleep(1000);
                        }
                    }
                    else
                    {
                        e.Cancel = true;//就不退了
                    }
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }
            catch { }
        }