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); }
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); }
public void Close() { _editor?.Close(); }
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; }