Example #1
0
        public bool StartClosingDocument()
        {
            bool cancel = false;

            if (currentStage != null)
            {
                if (currentStage.HasSaveableChanges)
                {
                    DialogResult dr = MessageBox.Show("    Save changes to " + currentStage.Text + "?", "Unsaved Changes", MessageBoxButtons.YesNoCancel);
                    if (dr == DialogResult.Yes)
                    {
                        Save();
                    }
                    else if (dr == DialogResult.Cancel)
                    {
                        cancel = true;
                    }
                }

                if (!cancel)
                {
                    stages.Remove(currentStage);
                    currentStage.GotFocus  -= new EventHandler(stageView_GotFocus);
                    currentStage.LostFocus -= new EventHandler(stageView_LostFocus);
                    currentStage.Hide();

                    if (stages.Count > 0)
                    {
                        SetStage(stages[0]);
                    }
                    else
                    {
                        SetStage(null);
                    }
                }
            }
            return(cancel);
        }