Пример #1
0
        public MainPage()
        {
            this.InitializeComponent();

            iotClient = new IoTServiceClient();
            sensor    = new FezHatSensorReader();

            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += Timer_Tick;

            InitThings();
        }
Пример #2
0
        public DeviceSensorDetailPage(SensorInformation dataSensor)
        {
            switch (dataSensor)
            {
            case SensorInformation.Acelerometer:
                activeReader = new DeviceSensorDetailViewModel <VectorReading>(CrossDeviceSensors.Current.Accelerometer, (data) =>
                {
                    Reading.Text = $" X -> {data.X} - Y -> {data.Y} - Z ->  {data.Z}";
                });
                break;

            case SensorInformation.Magnetometer:
                activeReader = new DeviceSensorDetailViewModel <VectorReading>(CrossDeviceSensors.Current.Magnetometer, (data) =>
                {
                    Reading.Text = $" X -> {data.X} - Y -> {data.Y} - Z ->  {data.Z}";
                });
                break;

            case SensorInformation.Gyroscope:
                activeReader = new DeviceSensorDetailViewModel <VectorReading>(CrossDeviceSensors.Current.Gyroscope, (data) =>
                {
                    Reading.Text = $" X -> {data.X} - Y -> {data.Y} - Z ->  {data.Z}";
                });
                break;

            case SensorInformation.Barometer:
                activeReader = new DeviceSensorDetailViewModel <double>(CrossDeviceSensors.Current.Barometer, (data) =>
                {
                    Reading.Text = $"{data}";
                });
                break;

            case SensorInformation.Pedometer:
                activeReader = new DeviceSensorDetailViewModel <int>(CrossDeviceSensors.Current.Pedometer, (data) =>
                {
                    Reading.Text = $"{data}";
                });
                break;
            }
            InitializeComponent();
            BindingContext = activeReader;
        }
 public PlantReadingsManager(ISensorReader sensorReader, IExceptionHandler exceptionHandler, IPlantReadingsVerifier plantReadingsVerifier)
 {
     _sensorReader = sensorReader;
     _exceptionHandler = exceptionHandler;
     _plantReadingsVerifier = plantReadingsVerifier;
 }