Example #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));
 }
 public PedestrianRequestLogic(PedestrianRequestModel model, AdaptersExtender adaptersExtender, PedestrianLogic requestAuthor, DriverProfileLogic requestTarget)
 {
     _model                     = model;
     _adaptersExtender          = adaptersExtender;
     _requestAuthor             = requestAuthor;
     _requestTarget             = requestTarget;
     model.InitResponseDelegate = InitResponse;
 }
Example #3
0
        private void HardwareService_IncomingCallArrived(object sender, ValueEventArgs <string> e)
        {
            PedestrianLogic callingPedestrian = _pedestrians.Items.FirstOrDefault(p => e.Value.Contains(p.Model.PhoneNumber));

            if (callingPedestrian == null)
            {
                return;
            }
            callingPedestrian.Model.InvokeMadeCall();
        }
Example #4
0
        private PedestrianRequestLogic CreatePedestrianRequestLogic(IPedestrianRequest requestSLO)
        {
            PedestrianLogic requestAuthor = _pedestrians.Items.FirstOrDefault(p => p.Model.PersonId == requestSLO.PedestrianId);

            return(requestAuthor == null ? null : new PedestrianRequestLogic(new PedestrianRequestModel(requestAuthor.Model)
            {
                RequestId = requestSLO.Id,
                PaymentAmount = requestSLO.PaymentAmount,
                Currency = requestSLO.Currency,
                Comment = requestSLO.Comment,
                IsCancelled = requestSLO.IsCanceled,
            }, _adaptersExtender, requestAuthor, this));
        }
Example #5
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);
                    }
                }
            }
        }
Example #6
0
 private bool ComparePedestriansInfo(PedestrianLogic logic, IPedestrianInfo slo)
 {
     return(logic.Model.PersonId == slo.PersonId);
 }