Esempio n. 1
0
 private void PedestrianRequests_ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.OldItems != null)
     {
         foreach (PedestrianRequestLogic request in e.NewItems.OfType <PedestrianRequestLogic>().ToArray())
         {
             PedestrianLogic author = _pedestrians.Items.SingleOrDefault(p => p.Model.PersonId == request.Model.AuthorId);
             if (author != null)
             {
                 author.ResetCurrentRequest();
             }
         }
     }
     if (e.NewItems != null)
     {
         foreach (PedestrianRequestLogic request in e.NewItems.OfType <PedestrianRequestLogic>().ToArray())
         {
             PedestrianLogic author = _pedestrians.Items.SingleOrDefault(p => p.Model.PersonId == request.Model.AuthorId);
             if (author != null)
             {
                 author.SetCurrentRequest(request);
             }
         }
     }
     _model.ModifyPedestrianRequestsCollection(col => ObservableCollectionHelper.ApplyChangesByObjects <PedestrianRequestLogic, PedestrianRequestModel>(e, col, l => l.Model, l => l.Model));
 }
Esempio n. 2
0
        private void PedestrianRequests_ItemsChanged(object sender, EventArgs e)
        {
            IEnumerable <PedestrianRequestLogic> requests = _pedestrianRequests.Items;

            if (requests != null)
            {
                foreach (PedestrianRequestLogic request in requests)
                {
                    PedestrianLogic author = _pedestrians.Items.SingleOrDefault(p => p.Model.PersonId == request.Model.AuthorId);
                    if (author != null)
                    {
                        author.SetCurrentRequest(request);
                    }
                }
            }
        }