Esempio n. 1
0
        public void SelectTimer(Timer timer)
        {
            if (!Selected || timer == null)
            {
                return;
            }

            SelectedTimer             = timer;
            timer.RadioButton.Checked = true;

            TimerInfo  timerInfo;
            TimerError error = SelectedTimer.GetTimerInfo(out timerInfo);

            List <Control> controls = new List <Control>()
            {
                FlowTimer.MainForm.ButtonStart, FlowTimer.MainForm.ButtonStop,
            };

            if (error == TimerError.NoError)
            {
                FlowTimer.UpdatePCM(Array.ConvertAll(timerInfo.Offsets, x => (double)x), timerInfo.Interval, timerInfo.NumBeeps);
                if (!FlowTimer.IsTimerRunning)
                {
                    FlowTimer.MainForm.LabelTimer.Text = (timerInfo.MaxOffset / 1000.0).ToFormattedString();
                }
                controls.ForEach(control => control.Enabled = true);
            }
            else
            {
                FlowTimer.MainForm.LabelTimer.Text          = "Error";
                controls.ForEach(control => control.Enabled = false);
            }
        }
        public void Submit()
        {
            GetVariableInfo(out Info);
            double now    = Win32.GetTime();
            double offset = (Info.Frame / Info.FPS * 1000.0f) - (now - FlowTimer.TimerStart) + Info.Offset + Adjusted;

            FlowTimer.UpdatePCM(new double[] { offset }, Info.Interval, Info.NumBeeps, false);
            FlowTimer.AudioContext.QueueAudio(FlowTimer.PCM);
            ButtonSubmit.Enabled = false;
            CurrentOffset        = Info.Frame / Info.FPS + (Info.Offset + Adjusted) / 1000.0f;
            Submitted            = true;
            EnableControls(false);
            FlowTimer.MainForm.TextBoxFrame.Enabled = false;
        }