Exemplo n.º 1
0
        private async void LedSwitch_Toggled(object sender, RoutedEventArgs e)
        {
            var obj = sender as ToggleSwitch;

            obj.IsEnabled = false;

            if (obj.Header.ToString().StartsWith("Vis"))
            {
                LedState ^= 0x1;
            }
            else if (obj.Header.ToString().StartsWith("IR"))
            {
                LedState ^= 0x2;
            }
            else if (obj.Header.ToString().StartsWith("Sensor"))
            {
                LedState ^= 0x4;
            }
            else
            {
                LedState ^= 0x8;
            }

            await PiCup.ConnectDevice();

            await Settings.PiCup.SetLedState(LedState);

            obj.IsEnabled = true;
        }
Exemplo n.º 2
0
        private async void SensorButton_Click(object sender, RoutedEventArgs e)
        {
            sensorButton.IsEnabled = false;

            await PiCup.ConnectDevice();

            var lst = await Settings.PiCup.ReadSensors(Settings.IntegrationTime);

            SensorSeries.Add(new LineSeries
            {
                Values = new ChartValues <float>(lst),
                Fill   = new SolidColorBrush(Colors.Transparent)
            });

            Bindings.Update();

            sensorButton.IsEnabled = true;
        }
Exemplo n.º 3
0
        private async void NewMeasurementButton_Click(object sender, RoutedEventArgs e)
        {
            await PiCup.ConnectDevice();

            var measDialog = new NewMeasurementDialog();
            await measDialog.ShowAsync();

            if (measDialog.IsMeasurementsSuccessful)
            {
                var mes = measDialog.Measurement;

                if (measDialog.SaveMeasurementFlag)
                {
                    MeasurementList.Add(mes);
                }

                if (!mes.IsTrain)
                {
                    await new MeasurementDetails(mes).ShowAsync();
                }
            }
        }
Exemplo n.º 4
0
 private async void DevicePage_Loaded(object sender, RoutedEventArgs e)
 {
     await PiCup.ConnectDevice();
 }