private void OnFriendDeleted(int friendId)
        {
            NavigationItemViewModel navigationItem =
                NavigationItems.SingleOrDefault(item => item.FriendId == friendId);

            if (navigationItem != null)
            {
                NavigationItems.Remove(navigationItem);
            }
        }
        private void OnSavedFriend(Friend savedFriend)
        {
            NavigationItemViewModel navigationItemViewModel = Friends.SingleOrDefault(model => model.Id == savedFriend.Id);

            if (navigationItemViewModel == null)
            {
                Friends.Add(new NavigationItemViewModel(savedFriend.Id, GetDisplayMember(savedFriend),
                                                        eventAggregator));
            }
            else
            {
                navigationItemViewModel.DisplayMember = GetDisplayMember(savedFriend);
            }
        }
        private void OnFriendSaved(Friend savedFriend)
        {
            NavigationItemViewModel navigationItem =
                NavigationItems.SingleOrDefault(item => item.FriendId == savedFriend.Id);

            if (navigationItem != null)
            {
                navigationItem.DisplayValue = $"{savedFriend.FirstName} {savedFriend.LastName}";
            }
            else
            {
                Load();
            }
        }
示例#4
0
        private void OnFriendSaved(Friend friend)
        {
            var displayMember  = $"{friend.FirstName} {friend.LastName}";
            var navigationItem = Friends.SingleOrDefault(n => n.Id == friend.Id);

            if (navigationItem != null)
            {
                navigationItem.DisplayMember = displayMember;
            }
            else
            {
                navigationItem = new NavigationItemViewModel(friend.Id, displayMember, _eventAggregator);
                Friends.Add(navigationItem);
            }
        }
示例#5
0
        private void OnFriendSaved(Friend friend)
        {
            var navigationItem = this.Friends.SingleOrDefault(f => f.Id == friend.Id);

            if (navigationItem != null)
            {
                navigationItem.DisplayMember = string.Format("{0} {1}", friend.FirstName, friend.LastName);
            }
            else
            {
                navigationItem = new NavigationItemViewModel(friend.Id, string.Format("{0} {1}", friend.FirstName, friend.LastName),
                                                             this.eventAggregator);
                this.Friends.Add(navigationItem);
            }
        }