Пример #1
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg != WM_CLOSE ||
                !VC2WinFmApp.Engine.Modified)
            {
                base.WndProc(ref m);
                return;
            }

            switch (ExUI.ConfirmYesNoCancel("课表被修改,是否保存?"))
            {
            case DialogResult.Yes:
                VC2WinFmApp.Engine.SaveAll(false);
                base.WndProc(ref m);
                break;

            case DialogResult.No:
                foreach (Form cfm in this.MdiChildren)
                {
                    cfm.FormClosing -= ItemFormClosing;
                }
                base.WndProc(ref m);
                break;

            case DialogResult.Cancel:
                break;
            }
        }
Пример #2
0
        private void MMenuCloseAll_Click(object sender, EventArgs e)
        {
            if (VC2WinFmApp.Engine.Modified)
            {
                switch (ExUI.ConfirmYesNoCancel("课表已经更改,是否保存?"))
                {
                case DialogResult.Yes:
                    this.MMenuSaveAll_Click(null, null);      //低效简单的做法,无意义地刷新了界面
                    break;

                case DialogResult.No:
                    this.MMenuCancelAll_Click(null, null);      //低效简单的做法,无意义地刷新了界面
                    break;

                case DialogResult.Cancel:
                    return;
                }
            }

            for (Int32 i = this.MdiChildren.Length - 1; i >= 0; i--)
            {
                this.MdiChildren[i].Close();
            }

            this.SetControlEnable();
        }
Пример #3
0
        private void ItemFormClosing(object sender, FormClosingEventArgs e)
        {
            BaseEntity ety = (sender as IScheduleFm).Entity;

            if (VC2WinFmApp.Engine.IsModified(ety))
            {
                switch (ExUI.ConfirmYesNoCancel("课表: " + ety + " 已经修改,是否保存?"))
                {
                case DialogResult.Yes:
                    VC2WinFmApp.Engine.Save(ety as EnSquad);
                    break;

                case DialogResult.No:
                    VC2WinFmApp.Engine.Cancel(ety as EnSquad);
                    break;

                case DialogResult.Cancel:
                    e.Cancel = true;
                    return;
                }
            }

            RemoveItem(ety);
        }