private bool CheckSave() { ParseProject(); if (_last_save == Sjson.Encode(JsonSerializer.Save(_project))) { return(true); } NSAlert alert = new NSAlert(); alert.AddButton(@"Save"); alert.AddButton(@"Don't Save"); alert.AddButton(@"Cancel"); alert.MessageText = @"Do you want to save changes to this document before closing?"; alert.InformativeText = @"If you don't save, your changes will be lost."; alert.AlertStyle = NSAlertStyle.Informational; int result = alert.RunModal(); if (result == (int)NSAlertButtonReturn.First) { saveProject(null); return(_file != null); } else if (result == (int)NSAlertButtonReturn.Second) { return(true); } else { return(false); } }
void Save(string path) { _file = path; Properties.Settings.Default.LastProject = _file; Properties.Settings.Default.Save(); ParseProject(); Sjson.Save(JsonSerializer.Save(_project), _file); MarkSave(); }
private void Open(string path) { _file = path; Properties.Settings.Default.LastProject = _file; _project = new Data.Project(); JsonSerializer.Load(_project, Sjson.Load(_file)); MarkSave(); DisplayProject(); }
private bool CheckSave() { ParseProject(); if (_last_save == Sjson.Encode(JsonSerializer.Save(_project))) { return(true); } saveProjectToolStripMenuItem_Click(null, null); return(true); }
private void MarkSave() { if (_file != null) { mainWindowController.Window.Title = "Header Hero - " + _file; } else { mainWindowController.Window.Title = "Header Hero"; } _last_save = Sjson.Encode(JsonSerializer.Save(_project)); }
private void MarkSave() { if (_file != null) { Text = "Header Hero - " + _file; } else { Text = "Header Hero"; } _last_save = Sjson.Encode(JsonSerializer.Save(_project)); }
private void saveProjectToolStripMenuItem_Click(object sender, EventArgs e) { if (_file == null) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = _filter; if (sfd.ShowDialog() == DialogResult.OK) { _file = sfd.FileName; } } if (_file == null) { return; } Properties.Settings.Default.LastProject = _file; ParseProject(); Sjson.Save(JsonSerializer.Save(_project), _file); MarkSave(); }