Exemple #1
0
        private void SetupVoltageOutput()
        {
            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 CreateLine)
                    {
                        VoltageOutput vo = null;
                        if (targetSingle.CurrentEO is VoltageOutput)
                        {
                            vo = targetSingle.CurrentEO as VoltageOutput;
                        }
                        else
                        {
                            vo = new VoltageOutput(targetSingle);
                        }

                        ExcitationOutputForm form = new ExcitationOutputForm(vo);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            targetSingle.CurrentEO = vo;
                            targetSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged);
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void SetupCurrentOutput()
        {
            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)
                    {
                        CurrentOutput co = null;
                        if (targetSingle.CurrentEO is CurrentOutput)
                        {
                            co = targetSingle.CurrentEO as CurrentOutput;
                        }
                        else
                        {
                            co = new CurrentOutput(targetSingle);
                        }

                        ExcitationOutputForm form = new ExcitationOutputForm(co);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            targetSingle.CurrentEO = co;
                            targetSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged);
                        }
                    }
                }
            }
        }
Exemple #3
0
            public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
            {
                if (context == null || provider == null || context.Instance == null)
                {
                    return(base.EditValue(provider, value));
                }

                //Cannot to edit
                if (value == null)
                {
                    return(value);
                }

                //Get the io object
                SingleEO io = value as SingleEO;

                if (io is PointOutput)  //There's no interface for point output
                {
                    FieldOutputForm form = new FieldOutputForm(io as PointOutput);
                    if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        io.parent.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged);
                    }
                    form.Dispose();
                }
                else
                {
                    ExcitationOutputForm form = new ExcitationOutputForm(io);
                    if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        io.parent.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged);
                    }
                    form.Dispose();
                }

                return(io);
            }