Esempio n. 1
0
 public UsersViewModel(IConnectionService connectionService, IDialogService dialogService, IUserService userService, IProgressDialogService progressDialogService)
 {
     _connectionService     = connectionService;
     _dialogService         = dialogService;
     _userService           = userService;
     _progressDialogService = progressDialogService;
 }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IMessageDlgService messageDlgService, 
            IProgressDialogService progressDialogService, IAppSettingsService stgsService, ITimePusher timePusherService)
        {
            this.progressDialogService = progressDialogService;
            this.messageDlgService = messageDlgService;
            this.stgsService = stgsService;
            this.timePusherService = timePusherService;
            this.Settings = this.stgsService.ReadSettings();

            this.PostTimeEntries = new RelayCommand(async () =>
            {
                await this.DoOp(() => this.timePusherService.PushTime(this.Settings, DateTime.Now.AddDays(-7).Date, DateTime.Now.AddDays(1).Date), "posting logged time for today", "Time entries for today have been successfully posted.");
            });

            this.ClosingCommand = new RelayCommand(() =>
            {
                this.stgsService.SaveSettings(this.Settings);
            });


            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}
        }
Esempio n. 3
0
        public ShellViewModel(IDialogService dialogService, IProgressDialogService progressDialogService
                              , IUserDataAddDialogService userDataAddDialogService)
        {
            _dialogService            = dialogService;
            _progressDialogService    = progressDialogService;
            _userDataAddDialogService = userDataAddDialogService;

            UserDataItems = new ObservableCollection <UserDataViewModel>();

            ShutdownCommand = new DelegateCommand(async() =>
            {
                bool result = await _dialogService.Question("終了します。よろしいですか?");
                if (result)
                {
                    App.Current.MainWindow.Close();
                }
            });

            GetAllUserDataCommand = new DelegateCommand(ExecuteGetAllUserDataCommand);

            UserDataAddCommand = new DelegateCommand(async() =>
            {
                var userData = await _userDataAddDialogService.Show();
                if (userData != null)
                {
                    UserDataItems.Add(userData);
                }
            });
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IMessageDlgService messageDlgService,
                             IProgressDialogService progressDialogService, IAppSettingsService stgsService, ITimePusher timePusherService)
        {
            this.progressDialogService = progressDialogService;
            this.messageDlgService     = messageDlgService;
            this.stgsService           = stgsService;
            this.timePusherService     = timePusherService;
            this.Settings = this.stgsService.ReadSettings();

            this.PostTimeEntries = new RelayCommand(async() =>
            {
                await this.DoOp(() => this.timePusherService.PushTime(this.Settings, DateTime.Now.AddDays(-7).Date, DateTime.Now.AddDays(1).Date), "posting logged time for today", "Time entries for today have been successfully posted.");
            });

            this.ClosingCommand = new RelayCommand(() =>
            {
                this.stgsService.SaveSettings(this.Settings);
            });


            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}
        }
 public BaseViewModel(IApiService apiService, ICacheService cacheService, IMessageboxService messageboxService, IProgressDialogService progressDialogService, IPlatformService platformService)
 {
     this.mApiService            = apiService;
     this.mCacheService          = cacheService;
     this.mMessageboxService     = messageboxService;
     this.mProgressDialogService = progressDialogService;
     this.mPlatformService       = platformService;
 }
Esempio n. 6
0
 public DashboardViewModel(IConnectionService connectionService, IDialogService dialogService, IPhotoService photoService, IProgressDialogService progressDialogService, IRestApiService restApiService)
 {
     _connectionService     = connectionService;
     _dialogService         = dialogService;
     _photoService          = photoService;
     _progressDialogService = progressDialogService;
     _restApiService        = restApiService;
 }
        public ImportFilesAndPlayCommand(
            ITrackLibrary library, 
            IProgressDialogService progressDialog,
            PlayPauseTrackCommand playCommand) : base(library, progressDialog)
        {
            if (playCommand == null)
            {
                throw new ArgumentNullException("playCommand");
            }

            this.playCommand = playCommand;
        }
Esempio n. 8
0
        public StartPageVM(IProgressDialogService progressDialogService, ServiceDialogVMFactory dialogVMFactory)
            : base(null)
        {
            Init(Guid.NewGuid());
            Icon = @"pack://application:,,,/ScenarioEditor.View;component/Resources/StartPageIcon.png";

            mDialogVMFactory = dialogVMFactory;
            InitStartPage();
            EditPanel = new EditPanelVM(typeof(StartPageVM), Id);
            EditPanel.AddTypes(new List <ICommand> {
                new VisibileContentCmd("MenuBar", typeof(ListBox), "MenuBarItemTitle", typeof(TextBlock))
            });
            Subscribe();
            ProgressDialogService = progressDialogService;
            Task.Factory.StartNew(DataHolder.Instance.PrepareTmpDirectory);
        }
 public MyLongRunningCommand(IProgressDialogService dialogService)
 {
     this.dialogService = dialogService;
 }
 public MyLongRunningCommand(IProgressDialogService dialogService)
 {
     this.dialogService = dialogService;
 }
Esempio n. 11
0
        public LandingPageViewModel()
        {
            _progressDialogService = Locator.Current.GetService <IProgressDialogService>();
            _btDiscovery           = Locator.Current.GetService <IBtDiscovery>();
            _btClient = Locator.Current.GetService <IBtClient>();

            _btClient.ReceivedData += _btClient_ReceivedData;

            Operations = new ObservableCollection <string>();

            // Subscribe to the update of paired devices property
            this.WhenAnyValue(vm => vm._btDiscovery.PairedDevices)
            .Subscribe((pairedDevices) =>
            {
                PairedDevices = pairedDevices;
            });

            // Display a progress dialog when the bluetooth discovery takes place
            this.WhenAnyValue(vm => vm._btDiscovery.IsBusy)
            .DistinctUntilChanged()
            .Subscribe((isBusy) =>
            {
                if (isBusy)
                {
                    _progressDialogService.Show("Please wait...");
                }
                else
                {
                    _progressDialogService.Hide();
                }
            });

            // The refresh command
            Refresh = ReactiveCommand.Create(() =>
            {
                _btDiscovery.Refresh();
            });

            // Handle the selection of a device from the list
            this.WhenAnyValue(vm => vm.SelectedDevice)
            .Subscribe((device) =>
            {
                if (device == null)
                {
                    return;
                }

                if (!device.HasRequiredServiceID)
                {
                    Message = "Device not supported or service not running";
                    return;
                }

                if (_btClient.Connect(device.Address))
                {
                    // Fetch supported operations from the server
                    _btClient.SendData("getop");
                }
                else
                {
                    Message = "Unable to connect to device";
                    return;
                }
            });

            // Execute an operation
            this.Execute = ReactiveCommand.Create <string>((operation) =>
            {
                _btClient.SendData(operation);
            });

            Refresh.Execute().Subscribe();
        }
Esempio n. 12
0
        public StartPageVM(IProgressDialogService progressDialogService, ServiceDialogVMFactory dialogVMFactory)
            : base(null)
        {
            Init(Guid.NewGuid());
            Icon = @"pack://application:,,,/ScenarioEditor.View;component/Resources/StartPageIcon.png";

            mDialogVMFactory = dialogVMFactory;
            InitStartPage();
            EditPanel = new EditPanelVM(typeof(StartPageVM), Id);
            EditPanel.AddTypes(new List<ICommand> { new VisibileContentCmd("MenuBar", typeof(ListBox), "MenuBarItemTitle", typeof(TextBlock)) });
            Subscribe();
            ProgressDialogService = progressDialogService;
            Task.Factory.StartNew(DataHolder.Instance.PrepareTmpDirectory);
        }
Esempio n. 13
0
        public LandingPageViewModel(INavigation navigation, String userJson)
        {
            Message         = "";
            this.Navigation = navigation;
            userJsonString  = userJson;
            //logged = JsonConvert.DeserializeObject<User>(userJson);
            _progressDialogService = Locator.Current.GetService <IProgressDialogService>();
            _btDiscovery           = Locator.Current.GetService <IBtDiscovery>();
            _btClient = Locator.Current.GetService <IBtClient>();

            _btClient.ReceivedData += _btClient_ReceivedData;
            isLocationReady         = true;

            Command audio = new Command(async() => await AudioCheck());

            audio.Execute(null);

            // Command gps = new Command(async () => await UpdateVelocity());
            // gps.Execute(null);


            // Operations = new ObservableCollection<string>(); //commented from original code

            //GET SPEED ON A TIMER. MOVE THIS CODE FURTHER DOWN LATER ON.

            /*
             * Device.StartTimer(TimeSpan.FromSeconds(1), () =>
             * {
             *  //get location speed
             *  Command gps = new Command(async () => await UpdateVelocity());
             *  gps.Execute(null);
             *  return true; //repeat cycle
             * });*/

            Position position = new Position(36.9628066, -122.0194722);
            MapSpan  mapSpan  = new MapSpan(position, 0.01, 0.01);

            Map = new Xamarin.Forms.Maps.Map(mapSpan);

            //Set webview

            /*
             * webvw = new Android.Webkit.WebView(Context);
             * webvw.SetWebViewClient(new GeoWebViewClient());
             * webvw.SetWebChromeClient(new GeoWebChromeClient());
             * webvw.Settings.JavaScriptCanOpenWindowsAutomatically = true;
             * webvw.Settings.DisplayZoomControls = true;
             * webvw.Settings.JavaScriptEnabled = true;
             * webvw.Settings.SetGeolocationEnabled(true);
             * webvw.LoadUrl("https://www.google.com/maps");*/

            // Subscribe to the update of paired devices property
            this.WhenAnyValue(vm => vm._btDiscovery.PairedDevices)
            .Subscribe((pairedDevices) =>
            {
                PairedDevices = pairedDevices;

                /*
                 * //traverse list of paired devices looking for the one with the Raspberry Pi UUID
                 * foreach (BtDeviceInfo dev in PairedDevices)
                 * {
                 *  String devName = dev.Name;
                 *  bool hasId = dev.HasRequiredServiceID;
                 *  //if (dev != null && dev.HasRequiredServiceID)
                 *  if (dev != null && hasId)
                 *  {
                 *
                 *      if (_btClient.Connect(dev.Address))
                 *      {
                 *          // Fetch supported operations from the server
                 *          // _btClient.SendData("getop"); //commented this from original code
                 *          // Ping the device to ensure good communcation
                 *          _btClient.SendData("ping");
                 *          return;
                 *      }
                 *      else
                 *      {
                 *          Message = "Unable to connect to device";
                 *          return;
                 *      }
                 *  }
                 * }*/
            });



            // Display a progress dialog when the bluetooth discovery takes place
            this.WhenAnyValue(vm => vm._btDiscovery.IsBusy)
            .DistinctUntilChanged()
            .Subscribe((isBusy) =>
            {
                if (isBusy)
                {
                    _progressDialogService.Show("Please wait...");
                }
                else
                {
                    //traverse list of paired devices looking for the one with the Raspberry Pi UUID
                    foreach (BtDeviceInfo dev in PairedDevices)
                    {
                        String devName = dev.Name;
                        bool hasId     = dev.HasRequiredServiceID;
                        //if (dev != null && dev.HasRequiredServiceID)
                        if (dev != null && hasId)
                        {
                            if (_btClient.Connect(dev.Address))
                            {
                                // Fetch supported operations from the server
                                // _btClient.SendData("getop"); //commented this from original code
                                // Ping the device to ensure good communcation
                                _btClient.SendData("ping");
                                _progressDialogService.Hide();
                                if (Message.Equals("Java.IO.IOException"))
                                {
                                    Message = "Connection Failed! Please check Raspberry Pi is turned on and try again.";
                                }
                                return;
                            }
                            else
                            {
                                Message = "Unable to connect to device";
                                _progressDialogService.Hide();
                                return;
                            }
                        }
                    }
                    _progressDialogService.Hide();
                }
            });

            // The refresh command
            Refresh = ReactiveCommand.Create(() =>
            {
                _btDiscovery.Refresh();
            });

            //commented from original code

            /*
             * // Handle the selection of a device from the list
             * this.WhenAnyValue(vm => vm.SelectedDevice)
             *  .Subscribe((device) =>
             *  {
             *      if (device == null)
             *      {
             *          return;
             *      }
             *
             *      if(!device.HasRequiredServiceID)
             *      {
             *          Message = "Device not supported or service not running";
             *          return;
             *      }
             *
             *      if(_btClient.Connect(device.Address))
             *      {
             *          // Fetch supported operations from the server
             *          // _btClient.SendData("getop"); //commented this from original code
             *          // Ping the device to ensure good communcation
             *          _btClient.SendData("ping");
             *      }
             *      else
             *      {
             *          Message = "Unable to connect to device";
             *          return;
             *      }
             *  });*/

            //commented from original code

            /*
             * // Execute an operation
             * this.Execute = ReactiveCommand.Create<string>((operation) =>
             * {
             *  _btClient.SendData(operation);
             * });*/


            // Execute GoAlert Operation
            this.GoRearAlert = ReactiveCommand.Create(() =>
            {
                Command navigate = new Command(async() => await GotoAlertPage(true, userJsonString));
                navigate.Execute(null);
            });

            this.GoFrontAlert = ReactiveCommand.Create(() =>
            {
                Command navigate = new Command(async() => await GotoAlertPage(false, userJsonString));
                navigate.Execute(null);
            });

            // Execute Shutdown Operation
            this.Shutdown = ReactiveCommand.Create(() =>
            {
                _btClient.SendData("shutdown");
            });

            //Execute GoContactListPage Operation
            this.SeeContacts = ReactiveCommand.Create(() =>
            {
                Command navigate = new Command(async() => await GotoContactListPage(userJsonString));
                navigate.Execute(null);
            });


            // Execute SendSpeed Operation
            this.SendSpeed = ReactiveCommand.Create <string>((_speed) =>
            {
                _btClient.SendData("speed:" + _speed); //Use speed heading so that the Raspberry knows it is sending speed
            });

            Refresh.Execute().Subscribe();
        }
 public DescriptionProjectViewModel(IApiService apiService, ICacheService cacheService, IMessageboxService messageboxService, IProgressDialogService progressDialogService, IPlatformService platformService)
     : base(apiService, cacheService, messageboxService, progressDialogService, platformService)
 {
 }
Esempio n. 15
0
 public CreateCompanyProfileViewModel(IApiService apiService, ICacheService cacheService, IMessageboxService messageboxService, IProgressDialogService progressDialogService, IPlatformService platformService)
     : base(apiService, cacheService, messageboxService, progressDialogService, platformService)
 {
 }
Esempio n. 16
0
 public AlertDetailViewModel(IApiService apiService, ICacheService cacheService, IMessageboxService messageboxService, IProgressDialogService progressDialogService, IPlatformService platformService)
     : base(apiService, cacheService, messageboxService, progressDialogService, platformService)
 {
 }
Esempio n. 17
0
 public ProfileViewModel(IApiService apiService, ICacheService cacheService, IMessageboxService messageboxService, IProgressDialogService progressDialogService, IPlatformService platformService)
     : base(apiService, cacheService, messageboxService, progressDialogService, platformService)
 {
     RegisterMessengers();
 }