public override string ToString() { string info = System.Enum.GetName(typeof(JointDriverType), GetDriveType()).Replace('_', ' ').ToLowerInvariant(); info += "\nPorts: " + type.GetPortType() + "(" + portA + (type.HasTwoPorts() ? "," + portB : "") + ")"; info += "\nMeta: "; foreach (KeyValuePair <System.Type, JointDriverMeta> meta in MetaInfo) { info += "\n\t" + meta.Value.ToString(); } return(info); }
public override string ToString() { string info = ""; // Joint type string jointType = System.Enum.GetName(typeof(JointDriverType), GetDriveType()).Replace('_', ' ').ToLowerInvariant(); info += jointType.Substring(0, 1).ToUpper() + jointType.Substring(1); // Capitalize first letter // Port information info += ", Ports: " + type.GetPortType(isCan) + " " + port1 + (type.HasTwoPorts() ? " and " + port2 : ""); return(info); }
/// <summary> /// Changes the position of window elements based on the type of driver. /// </summary> private void PrepLayout() { chkBoxDriveWheel.Hide(); rbCAN.Hide(); rbPWM.Hide(); if (cmbJointDriver.SelectedIndex <= 0) //If the joint is not driven { grpDriveOptions.Visible = false; tabsMeta.TabPages.Clear(); } else { JointDriverType cType = typeOptions[cmbJointDriver.SelectedIndex - 1]; lblPort.Text = cType.GetPortType(rbCAN.Checked) + " Port" + (cType.HasTwoPorts() ? "s" : ""); txtPort2.Visible = cType.HasTwoPorts(); txtPort1.Maximum = txtPort2.Maximum = cType.GetPortMax(rbCAN.Checked); grpDriveOptions.Visible = true; if (cType.IsMotor()) { tabsMeta.Visible = true; tabsMeta.TabPages.Clear(); tabsMeta.TabPages.Add(metaWheel); tabsMeta.TabPages.Add(metaGearing); tabsMeta.TabPages.Add(metaBrake); tabsMeta.TabPages.Add(metaMotorType); chkBoxDriveWheel.Show(); rbCAN.Show(); rbPWM.Show(); } else if (cType.IsPneumatic()) { tabsMeta.Visible = true; tabsMeta.TabPages.Clear(); tabsMeta.TabPages.Add(metaPneumatic); tabsMeta.TabPages.Add(metaBrake); } else if (cType.IsElevator()) { tabsMeta.Visible = true; tabsMeta.TabPages.Clear(); tabsMeta.TabPages.Add(metaBrake); chkBoxHasBrake.Show(); rbCAN.Show(); rbPWM.Show(); } else if (cType.IsWormScrew()) { rbCAN.Show(); rbPWM.Show(); } else { tabsMeta.TabPages.Clear(); tabsMeta.Visible = false; } } // Set window size tabsMeta.Visible = tabsMeta.TabPages.Count > 0; }
/// <summary> /// Changes the position of window elements based on the type of driver. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void DriveChooser_Layout(object sender, LayoutEventArgs e) { chkBoxDriveWheel.Hide(); chkBoxHasBrake.Hide(); rbCAN.Hide(); rbPWM.Hide(); if (cmbJointDriver.SelectedIndex <= 0) //If the joint is not driven { grpDriveOptions.Visible = false; tabsMeta.TabPages.Clear(); } else { JointDriverType cType = typeOptions[cmbJointDriver.SelectedIndex - 1]; lblPort.Text = cType.GetPortType() + " Port" + (cType.HasTwoPorts() ? "s" : ""); txtPortB.Visible = cType.HasTwoPorts(); txtPortA.Maximum = txtPortB.Maximum = cType.GetPortMax(); grpDriveOptions.Visible = true; if (cType.IsMotor()) { tabsMeta.Visible = true; tabsMeta.TabPages.Clear(); tabsMeta.TabPages.Add(metaWheel); tabsMeta.TabPages.Add(metaGearing); chkBoxDriveWheel.Show(); rbCAN.Show(); rbPWM.Show(); rbPWM.Checked = true; } else if (cType.IsPneumatic()) { tabsMeta.Visible = true; tabsMeta.TabPages.Clear(); tabsMeta.TabPages.Add(metaPneumatic); } else if (cType.IsElevator()) { tabsMeta.Visible = true; lblBrakePort.Enabled = false; brakePortA.Enabled = false; brakePortB.Enabled = false; tabsMeta.TabPages.Clear(); chkBoxHasBrake.Show(); tabsMeta.TabPages.Add(metaElevatorBrake); tabsMeta.TabPages.Add(metaElevatorStages); tabsMeta.TabPages.Add(metaGearing); if (cmbStages.SelectedIndex == -1) { cmbStages.SelectedIndex = 0; } } else { tabsMeta.TabPages.Clear(); tabsMeta.Visible = false; } } // Set window size tabsMeta.Visible = tabsMeta.TabPages.Count > 0; btnSave.Top = tabsMeta.TabPages.Count > 0 ? tabsMeta.Bottom + 3 : (grpDriveOptions.Visible ? grpDriveOptions.Bottom + 3 : grpChooseDriver.Bottom + 3); base.Height = btnSave.Bottom + 3 + (base.Height - base.ClientSize.Height); }