// Called when all sensors is activated
 public DateAndIntervalViewModel(ObservableCollection <Sensor> sensorList, SelectSensorsViewModel parentViewModel)
 {
     dateAndInterval            = new DateAndInterval(1, minimumDate, minimumDate);
     activateAllSensors         = true;
     this.sensorList            = sensorList;
     this.parentViewModel       = parentViewModel;
     SaveDateAndIntervalCommand = new Command(SaveDateAndInterval);
     CancelCommand = new Command(CancelButtonClicked);
 }
 // Called when sensor is activated
 public DateAndIntervalViewModel(Sensor sensor, SelectSensorsViewModel parentViewModel)
 {
     updateSensor = false;
     this.sensor  = sensor;
     SaveDateAndIntervalCommand = new Command(SaveDateAndInterval);
     CancelCommand        = new Command(CancelButtonClicked);
     dateAndInterval      = new DateAndInterval(1, minimumDate, minimumDate);
     this.parentViewModel = parentViewModel;
 }
 // Called when sensor is updated
 public DateAndIntervalViewModel(Sensor sensor, bool updateSensor, SelectSensorsViewModel parentViewModel)
 {
     this.updateSensor          = updateSensor;
     this.sensor                = sensor;
     SaveDateAndIntervalCommand = new Command(SaveDateAndInterval);
     CancelCommand              = new Command(CancelButtonClicked);
     dateAndInterval            = sensor.DateAndInterval;
     this.parentViewModel       = parentViewModel;
 }
Example #4
0
        // When button clicked, a new page is displayed with the available sensors that can be selected
        async void ShowSelectSensorsPage()
        {
            List <Sensor> sensorsInDb = (List <Sensor>) await App.DatabaseContext.GetSensorsAsync();

            if (selectSensorsViewModel == null)
            {
                selectSensorsViewModel = new SelectSensorsViewModel();
            }

            selectSensorsViewModel.CheckActiveSensors(sensorsInDb);

            await Navigation.PushAsync(new SelectSensorsPage()
            {
                BindingContext = selectSensorsViewModel
            });
        }