async void OnVisitorPicturesChanged(ICollection <VisitorPicture> visitorPictures) { //await App.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { int visitorId = visitorPictures.First().VisitorId; IEnumerable <VMVisit> visitsWithChangedVisitor; foreach (VisitsGroup visitGroup in VisitsList) { visitsWithChangedVisitor = visitGroup.Items.Where(v => v.VisitorId == visitorId); foreach (VMVisit visit in visitsWithChangedVisitor) { visit.ChangePhotos(visitorPictures); } } //base.RaisePropertyChanged(() => VisitsList); visitsWithChangedVisitor = OtherVisits.Where(v => v.VisitorId == visitorId); if (visitsWithChangedVisitor.Any()) { foreach (VMVisit visit in visitsWithChangedVisitor) { visit.ChangePhotos(visitorPictures); } //base.RaisePropertyChanged(() => OtherVisits); } visitsWithChangedVisitor = TodayVisits.Where(v => v.VisitorId == visitorId); if (visitsWithChangedVisitor.Any()) { foreach (VMVisit visit in visitsWithChangedVisitor) { visit.ChangePhotos(visitorPictures); } //base.RaisePropertyChanged(() => TodayVisits); } if (NextVisit.VisitorId == visitorId) { NextVisit.ChangePhotos(visitorPictures); //base.RaisePropertyChanged(() => NextVisit); } foreach (var vmVisitor in visitors.Where(x => x.Visitor.VisitorId == visitorId)) { vmVisitor.ChangePhotos(visitorPictures); } } //); }
async void OnVisitorPicturesChanged(ICollection <VisitorPicture> visitorPictures) { { int visitorId = visitorPictures.First().VisitorId; IEnumerable <VMVisit> visitsWithChangedVisitor; foreach (VisitsGroup visitGroup in VisitsList) { visitsWithChangedVisitor = visitGroup.Items.Where(v => v.VisitorId == visitorId); foreach (VMVisit visit in visitsWithChangedVisitor) { visit.ChangePhotos(visitorPictures); } } visitsWithChangedVisitor = OtherVisits.Where(v => v.VisitorId == visitorId); if (visitsWithChangedVisitor.Any()) { foreach (VMVisit visit in visitsWithChangedVisitor) { visit.ChangePhotos(visitorPictures); } } visitsWithChangedVisitor = TodayVisits.Where(v => v.VisitorId == visitorId); if (visitsWithChangedVisitor.Any()) { foreach (VMVisit visit in visitsWithChangedVisitor) { visit.ChangePhotos(visitorPictures); } } if (NextVisit.VisitorId == visitorId) { NextVisit.ChangePhotos(visitorPictures); } foreach (var vmVisitor in visitors.Where(x => x.Visitor.VisitorId == visitorId)) { vmVisitor.ChangePhotos(visitorPictures); } } }
async void OnVisitArrived(Visit visit) { bool hasArrived = visit.Status == VisitStatus.Arrived; int visitorId = visit.VisitorId; IEnumerable <VMVisit> visitsWithChangedVisitor; foreach (VisitsGroup visitGroup in VisitsList) { visitsWithChangedVisitor = visitGroup.Items.Where(v => v.VisitorId == visitorId); foreach (VMVisit v in visitsWithChangedVisitor) { v.HasArrived = hasArrived; } } //base.RaisePropertyChanged(() => VisitsList); visitsWithChangedVisitor = OtherVisits.Where(v => v.VisitorId == visitorId); if (visitsWithChangedVisitor.Any()) { foreach (VMVisit v in visitsWithChangedVisitor) { v.HasArrived = hasArrived; } //base.RaisePropertyChanged(() => OtherVisits); } visitsWithChangedVisitor = TodayVisits.Where(v => v.VisitorId == visitorId); if (visitsWithChangedVisitor.Any()) { foreach (VMVisit v in visitsWithChangedVisitor) { v.HasArrived = hasArrived; } //base.RaisePropertyChanged(() => TodayVisits); } if (NextVisit.VisitorId == visitorId) { NextVisit.HasArrived = hasArrived; // .ChangePhotos(visitorPictures); //base.RaisePropertyChanged(() => NextVisit); } }
async void OnVisitArrived(Visit visit) { bool hasArrived = visit.Status == VisitStatus.Arrived; int visitorId = visit.VisitorId; IEnumerable <VMVisit> visitsWithChangedVisitor; foreach (VisitsGroup visitGroup in VisitsList) { visitsWithChangedVisitor = visitGroup.Items.Where(v => v.VisitorId == visitorId); foreach (VMVisit v in visitsWithChangedVisitor) { v.HasArrived = hasArrived; } } visitsWithChangedVisitor = OtherVisits.Where(v => v.VisitorId == visitorId); if (visitsWithChangedVisitor.Any()) { foreach (VMVisit v in visitsWithChangedVisitor) { v.HasArrived = hasArrived; } } visitsWithChangedVisitor = TodayVisits.Where(v => v.VisitorId == visitorId); if (visitsWithChangedVisitor.Any()) { foreach (VMVisit v in visitsWithChangedVisitor) { v.HasArrived = hasArrived; } } if (NextVisit.VisitorId == visitorId) { NextVisit.HasArrived = hasArrived; } }