private void btnOK_Click(object sender, EventArgs e) { switch (io.GetType().Name) { case "VoltageExcitation": //Get the value of controls VoltageExcitation ve = (VoltageExcitation)io; ve.ExcitationVoltage.Value = this.txtExcitationValue.Value; ve.ExcitationVoltage.Unit = (Voltage.VoltageUnit) this.cboExcitationUnit.SelectedItem; ve.PhaseFrequency.Value = this.txtFreq.Value; ve.PhaseFrequency.Unit = (Frequency.FrequencyUnit) this.cboFreqUnit.SelectedItem; ve.PhaseDelay = this.txtPhase.Value; ve.TimeDelay.Value = this.txtTimeDelay.Value; ve.TimeDelay.Unit = (Time.TimeUnit) this.cboTimeDelayUnit.SelectedItem; ve.Positive = this.cboSignValue.SelectedIndex; break; case "VoltageOutput": //Get the value of controls VoltageOutput vo = (VoltageOutput)io; vo.Positive = this.cboSignValue.SelectedIndex; break; case "CurrentExcitation": //Get the value of controls CurrentExcitation ce = (CurrentExcitation)io; ce.ExcitationCurrent.Value = this.txtExcitationValue.Value; ce.ExcitationCurrent.Unit = (Current.CurrentUnit) this.cboExcitationUnit.SelectedItem; ce.PhaseFrequency.Value = this.txtFreq.Value; ce.PhaseFrequency.Unit = (Frequency.FrequencyUnit) this.cboFreqUnit.SelectedItem; ce.PhaseDelay = this.txtPhase.Value; ce.TimeDelay.Value = this.txtTimeDelay.Value; ce.TimeDelay.Unit = (Time.TimeUnit) this.cboTimeDelayUnit.SelectedItem; ce.Positive = this.cboSignValue.SelectedIndex; break; case "CurrentOutput": //Get the value of controls CurrentOutput co = (CurrentOutput)io; co.Positive = this.cboSignValue.SelectedIndex; break; default: this.Close(); break; } this.Close(); }
private void SetupCurrentExcitation() { if (m_project != null) { if (m_project.CurrentSelectedObject is GEMSSingle || m_project.CurrentSelectedObject is GeometryOperation) { GEMSSingle targetSingle = null; if (m_project.CurrentSelectedObject is GEMSSingle) { targetSingle = (GEMSSingle)m_project.CurrentSelectedObject; } else { targetSingle = ((GeometryOperation)m_project.CurrentSelectedObject).Parent; } if (targetSingle.CreateOperation is CreateRectangle || targetSingle.CreateOperation is CreateRound) { CurrentExcitation ce = null; if (targetSingle.CurrentEO is CurrentExcitation) { ce = targetSingle.CurrentEO as CurrentExcitation; } else { ce = new CurrentExcitation(targetSingle); } ExcitationOutputForm form = new ExcitationOutputForm(ce); if (form.ShowDialog() == DialogResult.OK) { targetSingle.CurrentEO = ce; targetSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged); } } } } }
private void ExcitationOutputForm_Load(object sender, EventArgs e) { if (io == null) { this.Close(); } switch (io.GetType().Name) { case "VoltageExcitation": //Initialize the status of the controls this.txtE0.Text = "Excitation"; this.txtIOType.Text = "Voltage"; this.lbExcitationType.Text = "Voltage"; this.cboExcitationUnit.DataSource = Enum.GetValues(typeof(Voltage.VoltageUnit)); this.cboFreqUnit.DataSource = Enum.GetValues(typeof(Frequency.FrequencyUnit)); this.cboTimeDelayUnit.DataSource = Enum.GetValues(typeof(Time.TimeUnit)); UpdateConstrolsVisibleStatus(true); //Bind controls VoltageExcitation ve = (VoltageExcitation)io; this.txtExcitationValue.Value = ve.ExcitationVoltage.Value; this.cboExcitationUnit.SelectedItem = ve.ExcitationVoltage.Unit; this.txtFreq.Value = ve.PhaseFrequency.Value; this.cboFreqUnit.SelectedItem = ve.PhaseFrequency.Unit; this.txtPhase.Value = ve.PhaseDelay; this.txtTimeDelay.Value = ve.TimeDelay.Value; this.cboTimeDelayUnit.SelectedItem = ve.TimeDelay.Unit; this.cboSignValue.SelectedIndex = ve.Positive; this.cboFreqUnit.SelectedIndexChanged += new System.EventHandler(this.cboFreqUnit_SelectedIndexChanged); this.cboTimeDelayUnit.SelectedIndexChanged += new System.EventHandler(this.cboTimeDelayUnit_SelectedIndexChanged); this.txtTimeDelay.TextChanged += new System.EventHandler(this.txtTimeDelay_TextChanged); break; case "VoltageOutput": //Initialize the status of the controls this.txtE0.Text = "Output"; this.txtIOType.Text = "Voltage"; UpdateConstrolsVisibleStatus(false); //Bind controls VoltageOutput vo = (VoltageOutput)io; this.cboSignValue.SelectedIndex = vo.Positive; break; case "CurrentExcitation": //Initialize the status of the controls this.txtE0.Text = "Excitation"; this.txtIOType.Text = "Current"; this.cboExcitationUnit.DataSource = Enum.GetValues(typeof(Current.CurrentUnit)); this.cboFreqUnit.DataSource = Enum.GetValues(typeof(Frequency.FrequencyUnit)); this.cboTimeDelayUnit.DataSource = Enum.GetValues(typeof(Time.TimeUnit)); this.lbExcitationType.Text = "Current"; UpdateConstrolsVisibleStatus(true); //Bind controls CurrentExcitation ce = (CurrentExcitation)io; this.txtExcitationValue.Value = ce.ExcitationCurrent.Value; this.cboExcitationUnit.SelectedItem = ce.ExcitationCurrent.Unit; this.txtFreq.Value = ce.PhaseFrequency.Value; this.cboFreqUnit.SelectedItem = ce.PhaseFrequency.Unit; this.txtPhase.Value = ce.PhaseDelay; this.txtTimeDelay.Value = ce.TimeDelay.Value; this.cboTimeDelayUnit.SelectedItem = ce.TimeDelay.Unit; this.cboSignValue.SelectedIndex = ce.Positive; this.cboFreqUnit.SelectedIndexChanged += new System.EventHandler(this.cboFreqUnit_SelectedIndexChanged); this.cboTimeDelayUnit.SelectedIndexChanged += new System.EventHandler(this.cboTimeDelayUnit_SelectedIndexChanged); this.txtTimeDelay.TextChanged += new System.EventHandler(this.txtTimeDelay_TextChanged); break; case "CurrentOutput": //Initialize the status of the controls this.txtE0.Text = "Output"; this.txtIOType.Text = "Current"; UpdateConstrolsVisibleStatus(false); //Bind controls CurrentOutput co = (CurrentOutput)io; this.cboSignValue.SelectedIndex = co.Positive; break; default: this.Close(); break; } }