//First Method called every time the form is displayed public void InitiateProgram(int SelectedSpeed, int SelectedTorque, TimeSpan SelectedDuration, Enumerators.Direction SelectedDirection) { logger.Info("Initiating Custom Program."); dataSampleLeft = new objDataSample(GlobalVariables.leftSerialPort); dataSampleRight = new objDataSample(GlobalVariables.rightSerialPort); dataSampleLeft.ProgramSelector = Enumerators.ProgramSelect.CustomProgram; dataSampleLeft.SelectedSpeed = SelectedSpeed; dataSampleLeft.SelectedTorque = SelectedTorque; dataSampleLeft.SelectedDuration = SelectedDuration; dataSampleLeft.TimeRemaining = SelectedDuration; dataSampleLeft.SelectedDirection = SelectedDirection; dataSampleLeft.SampleTimerInterval = 100; dataSampleLeft.CapturePowerFlag = true; ThreadCallbackProcessFeedbackErrorLeft = dataSampleLeft.ProcessErrorSession; dataSampleRight.ProgramSelector = Enumerators.ProgramSelect.CustomProgram; dataSampleRight.SelectedSpeed = SelectedSpeed; dataSampleRight.SelectedTorque = SelectedTorque; dataSampleRight.SelectedDuration = SelectedDuration; dataSampleRight.TimeRemaining = SelectedDuration; dataSampleRight.SelectedDirection = SelectedDirection; dataSampleRight.SampleTimerInterval = 100; dataSampleRight.CapturePowerFlag = true; ThreadCallbackProcessFeedbackErrorRight = dataSampleRight.ProcessErrorSession; ResetData(); isNewSession = true; this.StartPosition = FormStartPosition.CenterScreen; this.WindowState = FormWindowState.Normal; this.Focus(); }
//Form Reset Methods - Called everytime the form is shown private void ResetData(int DifficultyLevel, int Speed, int Torque, Enumerators.ProgramSelect ProgramSelect) { ChartPowerLeft.ResetData(); ChartPowerRight.ResetData(); DataSample = new objDataSample(GlobalVariables.leftSerialPort); DataSample.DifficultyLevel = DifficultyLevel; DataSample.SelectedSpeed = Speed; DataSample.SelectedTorque = Torque; DataSample.ProgramSelector = ProgramSelect; DataSample.CapturePowerFlag = false; if (DataSample.ProgramSelector == Enumerators.ProgramSelect.RehabBilateral || DataSample.ProgramSelector == Enumerators.ProgramSelect.RehabLeftLeg || DataSample.ProgramSelector == Enumerators.ProgramSelect.RehabRightLeg) DataSample.CapturePowerFlag = true; else DataSample.CapturePowerFlag = false; ThreadCallbackProcessFeedbackError = DataSample.ProcessErrorSession; torqueTankControl1.panelRightConcRef.Height = Convert.ToInt32(DataSample.SelectedTorque * torqueTankControl1.TankLevelMultiplier); torqueTankControl1.panelLeftConcRef.Height = Convert.ToInt32(DataSample.SelectedTorque * torqueTankControl1.TankLevelMultiplier); torqueTankControl1.panelRightEcceRef.Height = Convert.ToInt32(DataSample.SelectedTorque * torqueTankControl1.TankLevelMultiplier); torqueTankControl1.panelLeftEcceRef.Height = Convert.ToInt32(DataSample.SelectedTorque * torqueTankControl1.TankLevelMultiplier); torqueTankControl1.Invalidate(); btnSkipStage.Visible = true; lblSetPrevious.Text = "-"; lblTimePrevious.Text = "-"; }
//EventArgs - Form Load private void frmPulseCalibration_Load(object sender, EventArgs e) { //Congifure app settings for error logging XmlConfigurator.Configure(); DataSample = new objDataSample(GlobalVariables.leftSerialPort); ThreadCallbackProcessFeedbackError = DataSample.ProcessErrorCalibration; this.ThreadCallbackUpdateLabels = new AddDataDelegate(UpdateLabels); ThreadCallbackStopSequence = new AddDataDelegate(StopSequence); }
//First Method called every time the form is displayed public void InitiateProgram(Enumerators.ProgramSelect ProgramSelect) { this.StartPosition = FormStartPosition.CenterScreen; this.WindowState = FormWindowState.Normal; DataSample = new objDataSample(GlobalVariables.leftSerialPort); DataSample.ProgramSelector = ProgramSelect; DataSample.SelectedSpeed = 65; DataSample.SelectedTorque = 250; ThreadCallbackProcessFeedbackError = DataSample.ProcessErrorSession; ResetData(); CurrentProgram = DataSample.ReadXMLProgram(); this.Focus(); Start(); }
//EventArgs - Form Load private void frmPulseCalibration_Load(object sender, EventArgs e) { //Congifure app settings for error logging XmlConfigurator.Configure(); dataSampleLeft = new objDataSample(GlobalVariables.leftSerialPort); dataSampleRight = new objDataSample(GlobalVariables.rightSerialPort); ThreadCallbackProcessFeedbackErrorLeft = dataSampleLeft.ProcessErrorCalibration; ThreadCallbackProcessFeedbackErrorRight = dataSampleRight.ProcessErrorCalibration; ThreadCallbackUpdateLabelLeft = new AddDataDelegate(UpdateLabelLeft); ThreadCallbackUpdateLabelRight = new AddDataDelegate(UpdateLabelRight); ThreadCallbackStopSequence = new AddDataDelegate(StopSequence); ThreadCallbackDiagnostics = new AddDataDelegate(UpdateDiagnosticsLabel); ThreadCallbackCloseDialog = new CloseDialogDelegate(CloseDialog); }