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); }
public void Start(IProgram runnable, IChannel channel, RunningOptions options) { this.channel = channel; runner = new SynchronousRunner(); runner.Start(runnable, options); source = new CancellationTokenSource(); eta = runnable.Duration(options); state = RunState.Ready; runningThread = new Thread(ThreadFn); runningThread.Start(); }
public IEnumerable <Command> Run(IProgram program, RunningOptions options) { TimeSpan duration = program.Duration(options); foreach (var step in Steps(program)) { duration -= step.Duration(options); foreach (var cmd in step.Commands(options)) { var cmd2 = cmd; cmd2.Remaining += duration; yield return(cmd2); } } }