private void BtnAdd_Click(object sender, EventArgs e) { using (NoteEditForm nef = new NoteEditForm { Model = new Note { Id = GeneralHelper.GetNewId(_model.Data.Values) } }) { if (nef.ShowDialog() != DialogResult.OK) { return; } _model.Data.Add(nef.Model.Id, nef.Model); } UpdateViewFromModel(); }
private void ShowNoteEditForm(string id) { if (!_model.Data.ContainsKey(id)) { return; } using (NoteEditForm nef = new NoteEditForm { Model = _model.Data[id].Copy() }) { if (nef.ShowDialog() != DialogResult.OK) { return; } nef.Model.CopyTo(_model.Data[id]); } Model.ExistingNoteChanged = true; UpdateViewFromModel(); }