Esempio n. 1
0
        /// <summary>
        /// Closes the open project with a confirmation if unsaved.
        /// </summary>
        /// <returns></returns>
        private bool CloseProjectClick()
        {
            if (OpenedProject == null)
            {
                return(true);
            }

            if (OpenedProject.IsModified)
            {
                var result = MessageBox.Show(string.Format("Project \"{0}\" has been modified.\n\nWould you like to save these changes?", OpenedProject.Filename),
                                             "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);

                if (result == DialogResult.Yes)
                {
                    SaveProject();
                }
                else if (result == DialogResult.No)
                {
                    OpenedProject.Revert();
                }
                else                 // Cancel
                {
                    return(false);
                }
            }

            CloseProject();
            return(true);
        }