private static void AfterDetailDeleted(ObservableCollection <NavigationItemViewModel> items, AfterDetailDeletedEventArgs args)
        {
            NavigationItemViewModel item = items.SingleOrDefault(f => f.Id == args.Id);

            if (item != null)
            {
                items.Remove(item);
            }
        }
Exemple #2
0
        private void AfterDetailDeleted(AfterDetailDeletedEventArgs args)
        {
            switch (args.ViewModelName)
            {
            case nameof(FriendDetailViewModel):
                NavigationItemViewModel friend = Friends.SingleOrDefault(
                    l => l.Id == args.Id);

                if (friend != null)
                {
                    Friends.Remove(friend);
                }
                break;
            }
        }
        private void AfterDetailSaved(ObservableCollection <NavigationItemViewModel> items, AfterDetailSavedEventArgs args)
        {
            NavigationItemViewModel lookupItem = items.SingleOrDefault(l => l.Id == args.Id);

            if (lookupItem == null)
            {
                items.Add(new NavigationItemViewModel(args.Id, args.DisplayMember,
                                                      args.ViewModelName,
                                                      _eventAggregator));
            }
            else
            {
                lookupItem.DisplayMember = args.DisplayMember;
            }
        }
Exemple #4
0
 private void AfterDetailSaved(AfterDetailSavedEventArgs obj)
 {
     switch (obj.ViewModelName)
     {
     case nameof(FriendDetailViewModel):
         NavigationItemViewModel lookupItem = Friends.SingleOrDefault(l => l.Id == obj.Id);
         if (lookupItem == null)
         {
             Friends.Add(new NavigationItemViewModel(
                             obj.Id,
                             obj.DisplayMember,
                             nameof(FriendDetailViewModel),
                             _eventAggregator));
         }
         else
         {
             lookupItem.DisplayMember = obj.DisplayMember;
         }
         break;
     }
 }
Exemple #5
0
        private void OnFriendSaved(Friend friend)
        {
            NavigationItemViewModel navigationItem = Friends.Single(x => x.Id == friend.Id);

            navigationItem.Update(friend);
        }