public override Task <SingleDeviceResponse> RunTimedProgram(SingleDeviceRequest request, ServerCallContext context)
        {
            ISingleDevice program = null;

            //If multple devices are set, only accelerometer will run
            if (request.RunAccelerometer)
            {
                _logger.LogInformation($"Running AccelerometerOnly program for {request.MinutesToRun} minutes.");
                program = new AccelerometerOnly(request.UseCustomeADC);
            }
            else if (request.RunGyroscope)
            {
                _logger.LogInformation($"Running GyroscopeOnly program for {request.MinutesToRun} minutes.");
                program = new GyroscopeOnly();
            }

            program.Run(request.MinutesToRun, context.CancellationToken);

            var response = new SingleDeviceResponse();

            response.DataSets    = program.GetDataSetCount();
            response.SegmentSize = program.GetSegmentLength();

            return(Task.FromResult(response));
        }
Exemplo n.º 2
0
        private void AddType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (AddType.SelectedItem is DataRowView selectType)
            {
                var gadgetName = selectType.Row["GadgetName"].ToString();
                switch (gadgetName)
                {
                case "Printer":
                    SpecificDevice = new AddPrinterWPF();
                    break;

                case "Monitor":
                    SpecificDevice = new AddMonitorWPF();
                    break;

                default:
                    SpecificDevice = null;
                    break;
                }
                if (SpecificDevice != null)
                {
                    var typeID = selectType.Row["ID"];
                    ((DataView)AddModel.ItemsSource).RowFilter = $"TypeID={typeID}";
                    this.Height = this.MinHeight;
                    AddOtherDevice.Children.Clear();
                    AddOtherDevice.Children.Add(SpecificDevice.GetUIElement());
                    this.Height += SpecificDevice.GetHeight();
                }
                else
                {
                    ((DataView)AddModel.ItemsSource).RowFilter = "";
                    this.Height = this.MinHeight;
                    AddOtherDevice.Children.Clear();
                    MessageBox.Show($"Не знаю почему но нету таблицы [{gadgetName}]");
                }
            }
        }