Esempio n. 1
0
        /// <summary>
        /// Checks whether the current project needs to be saved or not.
        /// If it hasn't been saved, the user will be asked. If the user
        /// decided not to save, any edits performed since the last save
        /// will be discarded. This should be called when the Editor
        /// application is being closed.
        /// </summary>
        internal void CheckSave()
        {
            // Always save project settings
            if (m_Project != null)
            {
                m_Project.SaveSettings();
            }

            if (IsSaved)
            {
                return;
            }

            Session s = CadastralMapModel.Current.WorkingSession;

            Debug.Assert(s != null);

            if (MessageBox.Show("Do you want to save changes?", "Changes not saved", MessageBoxButtons.YesNo)
                == DialogResult.Yes)
            {
                s.SaveChanges();
            }
            else
            {
                s.DiscardChanges();
            }
        }