private void BtnSave_Click(object sender, EventArgs e) { if (File.Exists(StoragePath) == false && SaveAs() == DialogResult.Cancel) { return; } Model.HasChanges = false; Model.CaptureCoordinates(); Model.Save(StoragePath); MessageBox.Show("Diagram saved successfully.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); if (this.entityEditor.IsEditable) { entityEditor.Reload(); } }
private async void Timer_ElapsedAsync(object sender, ElapsedEventArgs e) { //Run on background await Task.Run(() => { if (form.Model != null) { try { Model newModel = new Model(null, (modeller)form.Model.Xml.Clone()); newModel.Save(RecoveryFile); newModel = null; Console.WriteLine($"Saved to {RecoveryFile}"); } catch { } } }); saveComplete?.Invoke(); }
DialogResult CheckForChangesAndSaveIfPossible() { if (Model == null || Model.HasChanges == false) { return(DialogResult.No); } string fileName = Path.GetFileName(StoragePath); DialogResult result = MessageBox.Show($@"Do you want to save changes to ""{fileName}"" ?", "Save Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Yes) { Model.HasChanges = false; Model.CaptureCoordinates(); Model.Save(StoragePath); } return(result); }
private void GenerateUpdateScriptToolStripMenuItem_Click(object sender, EventArgs e) { ModuleLoader module = ModuleLoader.GetModule("Compare"); if (module == null) { MessageBox.Show("The comparer is not available.", "Info", System.Windows.Forms.MessageBoxButtons.OK); return; } else { // Save it before generating update script Model.CaptureCoordinates(); Model.Save(StoragePath); module.RunModule(Model.Xml, StoragePath); // Re initalize model after generating update script // this will reload the xml InitializeXmlModeller(); } }