예제 #1
0
        public bool ClosePage(IEditor se)
        {
            if (!se.Modified)
            {
                listEditor.Remove(se);
                se.Close();
                this.Remove(se.Control);
            }
            else
            {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNoCancel, MainClass.Languages.Translate("save_changes_before_close", se.Caption), MainClass.Languages.Translate("changes_will_be_lost"), MessageType.Question);

                //MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("save_changes_before_close", se.Caption),  MainClass.Languages.Translate("changes_will_be_lost"), MessageType.Question);
                int response = md.ShowDialog();

                if (response == (int)Gtk.ResponseType.Cancel)
                {
                    return(false);
                }
                else if (response == (int)Gtk.ResponseType.No)
                {
                    listEditor.Remove(se);
                    se.Close();
                    this.Remove(se.Control);
                }
                else if (response == (int)Gtk.ResponseType.Yes)
                {
                    if (Save(se))
                    {
                        listEditor.Remove(se);
                        se.Close();
                        this.Remove(se.Control);
                    }
                }
            }
            return(true);
        }
예제 #2
0
        public static Task Edit(IEditor editor, ForLine edit)
        {
            Task res = new Task(() =>
            {
                List <string> line = new List <string>();
                int nb             = 0;
                while (editor.HasNext())
                {
                    Write(editor, edit(JObject.Parse(editor.ReadLine()), nb++));
                }
                editor.Close();
            });

            res.Start();
            return(res);
        }
예제 #3
0
 public void Close()
 {
     _editor?.Close();
 }
예제 #4
0
        public bool ClosePage(IEditor se)
        {
            if (!se.Modified) {
                listEditor.Remove(se);
                se.Close();
                this.Remove(se.Control);
            } else {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNoCancel, MainClass.Languages.Translate("save_changes_before_close", se.Caption),  MainClass.Languages.Translate("changes_will_be_lost"), MessageType.Question);

                //MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("save_changes_before_close", se.Caption),  MainClass.Languages.Translate("changes_will_be_lost"), MessageType.Question);
                int response = md.ShowDialog();

                if (response == (int)Gtk.ResponseType.Cancel) {
                    return false;

                } else if (response == (int)Gtk.ResponseType.No) {
                    listEditor.Remove(se);
                    se.Close();
                    this.Remove(se.Control);
                } else if (response == (int)Gtk.ResponseType.Yes) {
                    if (Save(se)){
                        listEditor.Remove(se);
                        se.Close();
                        this.Remove(se.Control);
                    }
                }
            }
            return true;
        }