private void tsmiAdd_Click(object sender, EventArgs e) { using (var addForm = new frmAddFriend()) { addForm.ShowDialog(); if (addForm.Result != null) { _friends.Add(addForm.Result); _friends = _friends .OrderBy(f => f.Date) .ToList(); Persist(); } } }
private void tsmiEdit_Click(object sender, EventArgs e) { var editedFriend = _friends.FirstOrDefault(f => f.Id == (Guid)lvFriends.FocusedItem.Tag); using (var addForm = new frmAddFriend(editedFriend)) { addForm.ShowDialog(); if (editedFriend != null) { _friends = _friends .OrderBy(f => f.Date) .ToList(); Persist(); } } }