private void openMenuItem_Click(object sender, EventArgs e) { DialogResult result = this.showSaveChangesDialog(SAVE_PROMPT_OPEN); if (result != DialogResult.Cancel) { this.ofdDatabase.FileName = string.Empty; result = this.ofdDatabase.ShowDialog(); if (result == DialogResult.OK) { Stream stream = this.ofdDatabase.OpenFile(); this.repository = Serializer.Deserialize(stream, this.repository); stream.Close(); this.lastFilename = this.ofdDatabase.FileName; this.model = repository.Model; repository.Update(this.model); this.lastRepository = Serializer.Clone(this.repository); this.lastRepository.Update(this.model); InternalClipboard.Clear(); this.listIndices.Clear(); this.lastSelectedClass = null; this.RefreshData(); } } }
private void newMenuItem_Click(object sender, EventArgs e) { DialogResult result = this.showSaveChangesDialog(SAVE_PROMPT_NEW); if (result != DialogResult.Cancel) { this.repository = new Repository(this.model); this.lastRepository = new Repository(this.model); InternalClipboard.Clear(); this.lastFilename = string.Empty; this.listIndices.Clear(); this.lastSelectedClass = null; this.RefreshData(); } }
private void updateModelMenuItem_Click(object sender, EventArgs e) { DialogResult result = this.showSaveChangesDialog(SAVE_PROMPT_OPEN); if (result != DialogResult.Cancel) { this.ofdModel.FileName = string.Empty; result = this.ofdModel.ShowDialog(); if (result == DialogResult.OK) { Stream stream = this.ofdModel.OpenFile(); Model newModel = Serializer.Deserialize(stream, this.model); stream.Close(); if (!this.repository.Model.Equals(newModel)) { Repository newRepository = Serializer.Clone(this.repository); result = this.updateTypes(newRepository, newModel); if (result == DialogResult.OK) { this.repository = newRepository; } } if (result == DialogResult.OK) { this.model = newModel; this.repository.Update(this.model); this.lastRepository = Serializer.Clone(this.repository); this.lastRepository.Update(this.model); InternalClipboard.Clear(); this.listIndices.Clear(); this.lastSelectedClass = null; this.RefreshData(); } } } }