Esempio n. 1
0
        public void Start(IProgram runnable, IChannel channel, RunningOptions options)
        {
            this.options  = options;
            this.runnable = runnable;
            this.channel  = channel;

            var timeRemaining = runnable.Duration(options);

            etaLabel.Text = timeRemaining.ToString();

            programLabel.Text   = runnable.Name;
            generatorLabel.Text = channel.ToString();
            amplitudeLabel.Text = $"10 V";
            waveformLabel.Text  = "Sine";
            statusLabel.Text    = "Running";
            pauseButton.Text    = "Pause";
            pauseButton.Enabled = true;
            stopButton.Enabled  = true;

            runner           = new BackgroundRunner();
            runner.Progress += new ProgressChanged((a, b, c, d, e) => this.BeginInvoke(new ProgressChanged(ProgressUpdated), a, b, c, d, e));


            runner.Start(runnable, channel, options);
        }
Esempio n. 2
0
        private void advancedButton_Click(object sender, EventArgs e)
        {
            var options = new RunSettingsForm();

            options.Options = Options;
            if (options.ShowDialog() == DialogResult.OK)
            {
                Options = options.Options;
            }
        }
Esempio n. 3
0
        public RunSettingsForm()
        {
            InitializeComponent();
            foreach (var form in WaveformExtensions.SelectableWaveforms)
            {
                waveformBox.Items.Add(form);
            }

            Options = new RunningOptions();
        }
Esempio n. 4
0
        void SimpleProgram()
        {
            var p = ProgramParser.Tokenize("123");

            Assert.Equal(1, p.Count());

            var steps = ProgramParser.Parse("123, 456, M1, B1, B3").ToArray();

            Assert.Equal(5, steps.Length);
            var options = new RunningOptions();

            var durations = steps.Select(s => ((IStep)s).Duration(options)).ToArray();
            var freqs     = steps.Select(s => s.Frequency1.ToHertz(options)).ToArray();
        }
Esempio n. 5
0
        public void Start(IChannel channel, IHeartRateMonitor hrm, BiofeedbackSettings settings, Action <Biofeedback.Sample[]> finished)
        {
            if (channel is null)
            {
                throw new ArgumentException(nameof(channel));
            }
            if (hrm is null)
            {
                throw new ArgumentException(nameof(hrm));
            }

            finishedAction = finished;
            bf             = new Biofeedback();

            if (channel is null)
            {
                throw new ArgumentException("Couldn't open a channel");
            }

            source = new HrmSource(hrm);

            bf.Enqueue(settings.MinFrequency, settings.MaxFrequency, settings.StepSize);
            int frequencySteps = bf.TotalSteps;

            heatmapControl.NumberOfPoints = frequencySteps;
            heatmapControl.MinX           = settings.MinFrequency;
            heatmapControl.MaxX           = settings.MaxFrequency;
            statusLabel.Text = "Running";
            pauseButton.Text = "Pause";

            biofeedback = new Biofeedback();
            biofeedback.Enqueue(settings.MinFrequency, settings.MaxFrequency, settings.StepSize);
            runner                  = new BackgroundRunner();
            biofeedback.Source      = source;
            biofeedback.OnProgress += new Biofeedback.Progress((f, r, s, t) => BeginInvoke(new Biofeedback.Progress(OnProgress), f, r, s, t));
            biofeedback.OnFinished += new Biofeedback.Finished(r => BeginInvoke(new Biofeedback.Finished(OnFinished), new object[] { r }));
            runner.Progress        += new ProgressChanged((s, t, w, a, e) => BeginInvoke(new ProgressChanged(OnGeneratorProgress), s, t, w, a, e));
            var options = new RunningOptions();

            runner.Start(biofeedback, channel, options);
        }
Esempio n. 6
0
 public LookupOptions(RunningOptions runningOptions)
 {
     RunningOptions = runningOptions;
 }
Esempio n. 7
0
 public TimeSpan Duration(RunningOptions options) => Programs.Aggregate(default(TimeSpan), (a, b) => a + b.Duration(options));
Esempio n. 8
0
 public RunOptionsPage()
 {
     InitializeComponent();
     Options = new RunningOptions();
 }
Esempio n. 9
0
 private void resetButton_Click(object sender, EventArgs e)
 {
     Options = new RunningOptions();
 }