/// <summary> /// /// </summary> /// <param name="mainForm"></param> /// <param name="fileDirectory"></param> /// <param name="belt"></param> public TempSpatForm(MainForm mainForm, string fileDirectory, HapticBelt belt) { InitializeComponent(); wirelessBelt = belt; this._fileDirectory = fileDirectory; patternPlayback = new List<PatternElement>(2); // start with 2 element and grow try { error_t response = wirelessBelt.Query_All(); if (response != error_t.ESUCCESS) MessageBox.Show(wirelessBelt.getErrorMsg(response)); else { // brackets reqd for casting int array to string array String[] motor = { wirelessBelt.getMotors(QueryType.PREVIOUS).ToString() }; String[] rhythm = wirelessBelt.getRhythm(false, QueryType.PREVIOUS); String[] magnitude = wirelessBelt.getMagnitude(false, QueryType.PREVIOUS); // Reset Combo Boxes mainForm.ResetAllComboBoxes(); // Add to TempSpatForm mainForm.AddToComboBox(MainForm.dataTypes.MTR, motor, comboBoxMotor); mainForm.AddToComboBox(MainForm.dataTypes.RHY, rhythm, comboBoxRhy); mainForm.AddToComboBox(MainForm.dataTypes.MAG, magnitude, comboBoxMag); comboBoxCycles.Items.Add("1"); comboBoxCycles.Items.Add("2"); comboBoxCycles.Items.Add("3"); comboBoxCycles.Items.Add("4"); comboBoxCycles.Items.Add("5"); comboBoxCycles.Items.Add("6"); comboBoxCycles.Items.Add("Run"); comboBoxTempo.Items.Add("5"); // Fastest Tempo (div by 1.5) comboBoxTempo.Items.Add("4"); // Faster Tempo (div by 1.25) comboBoxTempo.Items.Add("3"); // Default as entered by user comboBoxTempo.Items.Add("2"); // Slower Tempo (multiply by 1.25) comboBoxTempo.Items.Add("1"); // Slowest Tempo (multiply by 1.5) comboBoxRhy.SelectedIndex = 0; comboBoxMag.SelectedIndex = 0; comboBoxCycles.SelectedIndex = 0; comboBoxTempo.SelectedIndex = 2; //midline for default tempo } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
/// <summary> /// /// </summary> /// <param name="belt"></param> public PatternProgForm(HapticBelt belt) { InitializeComponent(); wirelessBelt = belt; txtLogProg.Enabled = true; // Display current belt information try { error_t response = wirelessBelt.Query_All(); if (wirelessBelt.getDataRecvType() == (byte)HapticDriver.MessageType.INCOMING) { string line = wirelessBelt.getDataRecvBuffer(); UpdateTxtLog(line); } } catch (Exception ex) { MessageBox.Show(ex.Message); } //comboBoxMagSel.Items.Add(" "); comboBoxMagSel.SelectedIndex = 0; comboBoxRhySel.SelectedIndex = 0; }