Exemplo n.º 1
0
 public AlertSOSViewModel(IDataService dataService, Interfaces.IDialogService dialogService, IDispatchOnUIThread dispatcherService)
 {
     _dataService       = dataService;
     _dialogService     = dialogService;
     _dispatcherService = dispatcherService;
     LsRecipients       = new List <AlertRecipientDTO>();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create the DI container and register all classes against their interfaces
        /// </summary>
        private void Bootstrap()
        {
            IUnityContainer container = new UnityContainer();

            container.RegisterInstance <IUnityContainer>(container, new ContainerControlledLifetimeManager());
            container.RegisterType <IDependencyResolver, UnityDI>(new ContainerControlledLifetimeManager());

            // Initialise logging
            container.RegisterInstance <ILogger>(MainApplication.log, new ContainerControlledLifetimeManager());

            // Framework
            container.RegisterType <IDispatchOnUIThread, DispatchAdapter>(new ContainerControlledLifetimeManager());
            container.RegisterType <INavigationService, FormsNavigationService>(new ContainerControlledLifetimeManager());

            // Services
            container.RegisterType <IBTService, BTService>(new ContainerControlledLifetimeManager());

            // View models
            container.RegisterType <IPermissionsViewModel, PermissionsViewModel>();
            container.RegisterType <IMainViewModel, MainViewModel>();

            // Views
            container.RegisterType <IDialogService, DialogService>(new ContainerControlledLifetimeManager());

            var injectionFacade = container.Resolve <IDependencyResolver>();

            DependencyHelper.Container = injectionFacade;

            // ensure the singleton dispatcher is created.
            IDispatchOnUIThread dispatcher = injectionFacade.Resolve <IDispatchOnUIThread>();

            DispatchHelper.Initialise(dispatcher);
        }
Exemplo n.º 3
0
 public ParameterViewModel(IDataService dataService, Interfaces.IDialogService dialogService, IDispatchOnUIThread dispatcherService)
 {
     _dataService       = dataService;
     _dialogService     = dialogService;
     _dispatcherService = dispatcherService;
     _navigationService = ServiceLocator.Current.GetInstance <INavigationService>();
 }
 public AddSeekiosViewModel(INavigationService navigationService, IDataService dataService, Interfaces.IDialogService dialogService, IDispatchOnUIThread dispatcherService)
 {
     _navigationService = navigationService;
     _dataService       = dataService;
     _dialogService     = dialogService;
     _dispatcherService = dispatcherService;
 }
Exemplo n.º 5
0
 public ModeTrackingViewModel(IDispatchOnUIThread dispatcherService
                              , IDataService dataService
                              , Interfaces.IDialogService dialogService
                              , ILocalNotificationService localNotificationService)
     : base(dispatcherService, dataService, dialogService, localNotificationService)
 {
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainPage" /> class.
        /// </summary>
        public MainPage()
        {
            this.InitializeComponent();

            this.dispatcher = new UIDispatcher();
            this.dispatcher.Initialize();

            var viewModel = new MainViewModel();

            viewModel.PropertyChanged += this.OnViewModelPropertyChanged;

            viewModel.Init();
            Task.Run(async() =>
            {
                await viewModel.InitAsync();
            });

            // This would normally be injected but for brevity
            this.DataContext = viewModel;

            this.Loaded += (s, e) =>
            {
                this.VM.OnViewShown();
            };
        }
Exemplo n.º 7
0
 public MapViewModel(IDispatchOnUIThread dispatcher
                     , IDataService dataService
                     , Interfaces.IDialogService dialogService
                     , ILocalNotificationService localNotificationService)
     : base(dispatcher, dataService, dialogService, localNotificationService)
 {
     _navigationService = ServiceLocator.Current.GetInstance <INavigationService>();
 }
Exemplo n.º 8
0
 public DefaultViewModel(IUser user)
 {
     _user = user;
     _dispatcher = TinyIoC.TinyIoCContainer.Current.Resolve<Pharos.MPS.Mobile.Client.MVVM.IDispatchOnUIThread> ();
     Timer t = new Timer (3000);
     t.Elapsed += TimerElapsed;
     t.Start();
 }
Exemplo n.º 9
0
 public BillCalculator(IGPSTracker gpsTracker, IDispatchOnUIThread dispatcher)
 {
     _gpsTracker = gpsTracker;
     _gpsTracker.StatusChanged += OnGeoLocatorStatusChanged;
     _gpsTracker.PositionChanged += OnPositionChangedForeground;
     _dispatcher = dispatcher;
     CostsPerKm = 0;
     //Register messages from App.xaml.cs telling if app is running in foreground or in background
     IMvxMessenger messenger = Mvx.Resolve<IMvxMessenger>();
     messenger.Subscribe<BackgroundRunningStatusMessage>(OnBackgroundRunningMessageReceived);
 }
 public ModeSelectionViewModel(IDispatchOnUIThread dispatcherService
                               , IDataService dataService
                               , Interfaces.IDialogService dialogService
                               , ISaveDataService saveDataService)
 {
     _dispatcherService = dispatcherService;
     _dataService       = dataService;
     _dialogService     = dialogService;
     _saveDataService   = saveDataService;
     _navigationService = ServiceLocator.Current.GetInstance <INavigationService>();
     LsTrackingSetting  = new List <TrackingSetting>();
 }
Exemplo n.º 11
0
 public ModeDontMoveViewModel(IDispatchOnUIThread dispatcher
                              , IDataService dataService
                              , Interfaces.IDialogService dialogService
                              , ILocalNotificationService localNotificationService)
     : base(dispatcher, dataService, dialogService, localNotificationService)
 {
     _navigationService           = ServiceLocator.Current.GetInstance <INavigationService>();
     _dialogService               = dialogService;
     _dataService                 = dataService;
     _localNotificationService    = localNotificationService;
     LsSeekiosInTrackingAfterMove = new HashSet <int>();
     LsAlertsModeDontMove         = new List <AlertWithRecipientDTO>();
 }
Exemplo n.º 12
0
 public ListSeekiosViewModel(IDataService dataService
                             , Interfaces.IDialogService dialogService
                             , ISaveDataService saveDataService
                             , IDispatchOnUIThread dispatcherService
                             , ILocalNotificationService localNotificationService)
 {
     _dataService               = dataService;
     _dialogService             = dialogService;
     _saveDataService           = saveDataService;
     _dispatcherService         = dispatcherService;
     _localNotificationService  = localNotificationService;
     _navigationService         = ServiceLocator.Current.GetInstance <INavigationService>();
     ActivityNeedsUIToBeUpdated = false;
 }
 public DetailSeekiosViewModel(IDataService dataService
                               , Interfaces.IDialogService dialogService
                               , ISaveDataService saveDataService
                               , INavigationService navigationService
                               , IDispatchOnUIThread dispatcherService)
 {
     _dataService               = dataService;
     _dialogService             = dialogService;
     _navigationService         = navigationService;
     _saveDataService           = saveDataService;
     _dispatcherService         = dispatcherService;
     ActivityNeedsUIToBeUpdated = false;
     IsSeekiosDeleted           = false;
 }
 public MapViewModelBase(IDispatchOnUIThread dispatcherService
                         , IDataService dataService
                         , Interfaces.IDialogService dialogService
                         , ILocalNotificationService localNotificationService)
 {
     _dispatcherService        = dispatcherService;
     _dataService              = dataService;
     _dialogService            = dialogService;
     _localNotificationService = localNotificationService;
     _saveDataService          = GalaSoft.MvvmLight.Ioc.SimpleIoc.Default.GetInstance <ISaveDataService>();
     LsSeekiosAlertState       = new HashSet <int>();
     LsSeekiosOnDemand         = new List <SeekiosOnDemand>();
     LsSeekiosOnTracking       = new List <SeekiosOnTracking>();
     IsInNormalMode            = true;
 }
 public ModeZoneViewModel(IDataService dataService
                          , Interfaces.IDialogService dialogService
                          , IDispatchOnUIThread dispatcherService
                          , ILocalNotificationService localNotificationService)
     : base(dispatcherService, dataService, dialogService, localNotificationService)
 {
     _dataService              = dataService;
     _dialogService            = dialogService;
     _localNotificationService = localNotificationService;
     _navigationService        = ServiceLocator.Current.GetInstance <INavigationService>();
     _lsAreaCoords             = new List <LatitudeLongitude>();
     IsGoingBack = false;
     LsSeekiosInTrackingAfterOOZ = new HashSet <int>();
     LsAlertsModeZone            = new List <AlertWithRecipientDTO>();
 }
Exemplo n.º 16
0
        public FlightsViewModel(IGetFlights flightsService, 
                                IStoreObjects objectStore, 
                                ITinyMessengerHub messenger, 
                                IDispatchOnUIThread dispatcher)
        {
            Arrivals = new ObservableCollection<Flight>();
            Departures = new ObservableCollection<Flight>();

            _objectStore = objectStore;
            _flightsService = flightsService;
            _messenger = messenger;
            _dispatcher = dispatcher;

            _messenger.Subscribe<AirportSelectedMessage>(OnAirportSelected);

            LoadSelectedAirport();
        }
Exemplo n.º 17
0
        public FlightsViewModel(IGetFlights flightsService,
                                IStoreObjects objectStore,
                                ITinyMessengerHub messenger,
                                IDispatchOnUIThread dispatcher)
        {
            Arrivals   = new ObservableCollection <Flight>();
            Departures = new ObservableCollection <Flight>();

            _objectStore    = objectStore;
            _flightsService = flightsService;
            _messenger      = messenger;
            _dispatcher     = dispatcher;

            _messenger.Subscribe <AirportSelectedMessage>(OnAirportSelected);

            LoadSelectedAirport();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainPage" /> class.
        /// </summary>
        public MainPage()
        {
            this.InitializeComponent();

            this.dispatcher = DependencyHelper.Resolve <IDispatchOnUIThread>();
            this.dispatcher.Initialize();
            DispatchHelper.Initialise(this.dispatcher);

            this.DataContext = DependencyHelper.Resolve <IMainViewModel>();

            this.drawarea.SizeChanged += (s, e) =>
            {
                this.VM.SizeChanged(e.NewSize.Width, e.NewSize.Height);
            };
            this.Loaded += (s, e) =>
            {
                this.VM.OnViewLoaded();
            };
        }
Exemplo n.º 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainPage" /> class.
        /// </summary>
        public MainPage()
        {
            this.InitializeComponent();

            this.dispatcher = new UIDispatcher();
            this.dispatcher.Initialize();

            // This would normally be injected but for brevity
            this.DataContext         = new MainViewModel(new DialogService());
            this.VM.PropertyChanged += this.OnViewModelPropertyChanged;
            var textReduction = 16 + 16 + 24 + 8 + 8; // Reduce by padding * 2, symbol, margin,

#if __DROID__
            textReduction += 16;
#endif
            this.VM.SetFlyoutTextReduction(textReduction);

            this.SizeChanged += (s, e) =>
            {
                this.VM.PageSizeChanged(e.NewSize.Width, e.NewSize.Height);
            };
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DialogService" /> class.
 /// </summary>
 /// <param name="dispatcher">The dispatcher that marshals actions back onto the UI thread</param>
 public DialogService(IDispatchOnUIThread dispatcher)
 {
     this.dispatcher = dispatcher;
 }
 /// <summary>
 /// Initialise the helper with the interface to the helper facade
 /// </summary>
 /// <param name="dispatcher">The dispatcher facade</param>
 public static void Initialise(IDispatchOnUIThread dispatcher)
 {
     dispatcher.CheckDispatcher();
     DispatchHelper.Dispatcher = dispatcher;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseViewModel" /> class.
 /// </summary>
 public BaseViewModel()
 {
     this.dispatcher = DispatchHelper.Dispatcher;
 }
 public PresetLocationService(double latitude, double longitude, IDispatchOnUIThread dispatcher)
 {
     _dispatcher = dispatcher;
     _currentLocation = new Location(latitude, longitude);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DelegateCommandAsync"/> class
 /// </summary>
 /// <param name="executeAction">The execute method</param>
 public DelegateCommandAsync(Func <object, Task> executeAction)
 {
     this.executeAction = executeAction;
     this.dispatcher    = DispatchHelper.Dispatcher;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseViewModel" /> class.
 /// </summary>
 /// <param name="dispatcher">Dispatcher that marshals calls onto the UI thread</param>
 public BaseViewModel(IDispatchOnUIThread dispatcher)
 {
     this.dispatcher = dispatcher;
 }
 public PresetLocationService(double latitude, double longitude, IDispatchOnUIThread dispatcher)
 {
     _dispatcher      = dispatcher;
     _currentLocation = new Location(latitude, longitude);
 }
Exemplo n.º 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainViewModel" /> class.
 /// </summary>
 /// <param name="dispatcher">Dispatcher that marshals calls onto the UI thread</param>
 /// <param name="downloadAndInstallService">A service that downloads and installs apk files</param>
 public MainViewModel(IDispatchOnUIThread dispatcher, IDownloadAndInstallService downloadAndInstallService) : base(dispatcher)
 {
     this.downloadAndInstallService = downloadAndInstallService;
     this.UpdateState = InstallAbility.NoUpdateAvailable;
 }