コード例 #1
0
 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();
         }
     }
 }
コード例 #2
0
        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();
                }
            }
        }