Esempio n. 1
0
 public CityLogic(CityModel model, AdaptersExtender adaptersExtender, InteractionLogic interaction)
 {
     _model            = model;
     _adaptersExtender = adaptersExtender;
     _interaction      = interaction;
     _persons          = new UpdatableCollectionLoadDecorator <PersonLogic, IPersonInfo>(RetriveAllPersons, ComparePersonsInfo, p => p.IsOnline, CreatePersonsLogic);
     _driverResponses  = new SimpleCollectionLoadDecorator <IDriverResponse>(RetriveDriverResponses);
     _driverResponses.RequestFailed += DriverResponses_RequestFailed;
     model.AuthenticateDelegate      = Authenticate;
     model.EnumeratePersonsDelegate  = EnumeratePersons;
 }
Esempio n. 2
0
 public PedestrianProfileLogic(PedestrianProfileModel model, AdaptersExtender adaptersExtender, CityLogic city)
     : base(model, adaptersExtender, city)
 {
     _model = model;
     model.InitRequestDelegate                = InitRequest;
     model.EnumerateDriversDelegate           = EnumerateDrivers;
     model.EnumerateRequestsDelegate          = EnumerateRequests;
     model.EnumerateAcceptedResponsesDelegate = EnumerateAcceptedResponses;
     model.CallToDriverDelegate               = CallToDriver;
     _drivers           = new UpdatableCollectionLoadDecorator <DriverLogic, IDriverInfo>(RetriveDrivers, CompareDriversInfo, p => p.IsOnline, CreateDriverLogic);
     _requests          = new UpdatableCollectionLoadDecorator <PedestrianProfileRequestLogic, IPedestrianRequest>(RetriveRequests, CompareRequestsInfo, ValidateRequest, CreateRequestLogic);
     _acceptedResponses = new SimpleCollectionLoadDecorator <DriverResponseLogic>(RetriveAcceptedResponse);
     _adaptersExtender.ServicesFactory.GetCurrentDataService().DriverInfoChanged += DataService_DriverInfoChanged;
     _drivers.ItemsCollectionChanged           += Drivers_ItemsCollectionChanged;
     _acceptedResponses.ItemsCollectionChanged += AcceptedResponses_ItemsCollectionChanged;
 }
Esempio n. 3
0
 public InteractionLogic(InteractionModel model, AdaptersExtender adaptersExtender)
 {
     _model                        = model;
     _adaptersExtender             = adaptersExtender;
     model.CurrentCityChanged     += Model_CurrentCityChanged;
     model.EnumerateCitiesDelegate = EnumerateCities;
     _settings                     = new SettingsLogic(new SettingsModel(_adaptersExtender.ServicesFactory.GetCurrentSettingsService()), _adaptersExtender, this);
     _settings.Model.LoadSettings();
     _map = new MapLogic(new MapModel(_adaptersExtender.ServicesFactory.GetCurrentMapService()), _adaptersExtender, this);
     _adaptersExtender.ServicesFactory.GetCurrentDataService().ConnectionStateChanged += InteractionLogic_ConnectionStateChanged;
     _cities = new UpdatableCollectionLoadDecorator <CityLogic, ICityInfo>(RetriveCities, CompareCityInfo, c => true, CreateCityLogic);
     _cities.RequestFailed += Cities_RequestFailed;
     UpdateConnectionStateInfo();
     //System.Threading.Tasks.Task.Factory.StartNew(() =>
     //{
     adaptersExtender.ServicesFactory.GetCurrentHardwareService().LocationChanged += CityLogic_LocationChanged;
     //adaptersExtender.ServicesFactory.GetCurrentHardwareService().RequestLocation();
     //});
 }
Esempio n. 4
0
 internal DriverProfileLogic(DriverProfileModel model, AdaptersExtender adaptersExtender, CityLogic city)
     : base(model, adaptersExtender, city)
 {
     _model = model;
     model.InitResponseDelegate = InitResponse;
     model.EnumeratePedestrianRequestsDelegate = EnumeratePedestrianRequests;
     model.EnumeratePedestriansDelegate        = EnumeratePedestrians;
     model.EnumerateCurrentResponsesDelegate   = EnumerateCurrentResponses;
     _pedestrians        = new UpdatableCollectionLoadDecorator <PedestrianLogic, IPedestrianInfo>(RetrivePedestrians, ComparePedestriansInfo, p => p.IsOnline, CreatePedestrianLogic);
     _pedestrianRequests = new UpdatableCollectionLoadDecorator <PedestrianRequestLogic, IPedestrianRequest>(RetrivePedestrianRequests, ComparePedestrianRequests, ValidatePedestrianRequest, CreatePedestrianRequestLogic);
     _currentResponses   = new UpdatableCollectionLoadDecorator <DriverProfileResponseLogic, IDriverResponse>(RetriveDriverResponses, CompareDriverResponses, ValidateDriverResponse, CreateDriverResponseLogic);
     _adaptersExtender.ServicesFactory.GetCurrentHardwareService().IncomingCallArrived  += HardwareService_IncomingCallArrived;
     _adaptersExtender.ServicesFactory.GetCurrentDataService().PedestrianRequestChanged += DataService_PedestrianRequestChanged;
     _adaptersExtender.ServicesFactory.GetCurrentDataService().PedestrianInfoChanged    += DataService_PedestrianInfoChanged;
     _pedestrians.ItemsCollectionChanged        += Pedestrians_ItemsCollectionChanged;
     _pedestrians.RequestFailed                 += Pedestrians_RequestFailed;
     _pedestrianRequests.ItemsChanged           += PedestrianRequests_ItemsChanged;
     _pedestrianRequests.ItemsCollectionChanged += PedestrianRequests_ItemsCollectionChanged;
     _pedestrianRequests.RequestFailed          += PedestrianRequests_RequestFailed;
 }