Esempio n. 1
0
    protected SaveCheckDialogResult Quit()
    {
        SaveCheckDialogResult result = m_DocumentController.CheckSave();

        if (SaveCheckDialogResult.Cancel != result)
        {
            Application.Quit();
        }

        return(result);
    }
        public SaveCheckDialogResult CheckSave()
        {
            if (!m_model.Dirty)
            {
                return(SaveCheckDialogResult.NoSave);
            }

            SaveCheckDialogResult result = m_FileDialogHelper.ShowSaveCheckDialog();

            if (SaveCheckDialogResult.Save == result)
            {
                Save();
            }

            return(result);
        }
        public SaveCheckDialogResult ShowSaveCheckDialog()
        {
            Gtk.MessageDialog saveCheckDialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, false, "The current document has unsaved changes. Do you wish to save those now?");
            saveCheckDialog.AddButton("Cancel", Gtk.ResponseType.Cancel);

            SaveCheckDialogResult result = SaveCheckDialogResult.Cancel;

            int dialogResult = saveCheckDialog.Run();

            if ((int)Gtk.ResponseType.Yes == dialogResult)
            {
                result = SaveCheckDialogResult.Save;
            }
            else if ((int)Gtk.ResponseType.No == dialogResult)
            {
                result = SaveCheckDialogResult.NoSave;
            }

            saveCheckDialog.Destroy();

            return(result);
        }