コード例 #1
0
ファイル: MainForm.cs プロジェクト: xj361685640/opengems
        private void SetupPointOutput()
        {
            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 CreatePoint)
                    {
                        PointOutput po = null;
                        if (targetSingle.CurrentEO is PointOutput)
                        {
                            po = targetSingle.CurrentEO as PointOutput;
                        }
                        else
                        {
                            po = new PointOutput(targetSingle);
                        }

                        FieldOutputForm form = new FieldOutputForm(po);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            targetSingle.CurrentEO = po;
                            targetSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged);
                        }
                    }
                }
            }
        }
コード例 #2
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);
            }