Beispiel #1
0
        void propigateUItoVars()
        {
            //CLM this assumes that no controls have been added since init!

            int  ctrlCount = startingControlCount;
            Type type      = mOwnerNode.GetType();// Get object type

            System.Reflection.PropertyInfo[] pi = type.GetProperties();
            for (int i = 0; i < pi.Length; i++)
            {
                System.Reflection.PropertyInfo prop = pi[i];

                object[] custAttrib = prop.GetCustomAttributes(false);
                if (custAttrib == null)
                {
                    continue;
                }

                Type ptt = prop.PropertyType;

                for (int k = 0; k < custAttrib.Length; k++)
                {
                    if (custAttrib[k] is ConnectionType)
                    {
                        ConnectionType ct = custAttrib[k] as ConnectionType;
                        if (ct.ConnType == "Param")
                        {
                            setControlValueToProperty(this.Controls[ctrlCount * 2], ptt, prop);

                            ctrlCount++;
                        }

                        break;
                    }
                }
            }
        }
Beispiel #2
0
        public void initalize(MaskDAGGraphNode gn)
        {
            this.SuspendLayout();

            startingControlCount = this.Controls.Count;

            int textLeft = 10;

            int objLeft   = 100;
            int objHeight = 20;

            this.Width = 500;


            mOwnerNode = gn;
            this.Text  = mOwnerNode.GetType().ToString() + " Properties";

            Type type = mOwnerNode.GetType();// Get object type

            System.Reflection.PropertyInfo[] pi = type.GetProperties();
            for (int i = 0; i < pi.Length; i++)
            {
                System.Reflection.PropertyInfo prop = pi[i];

                object[] custAttrib = prop.GetCustomAttributes(false);
                if (custAttrib == null)
                {
                    continue;
                }

                Type ptt = prop.PropertyType;

                for (int k = 0; k < custAttrib.Length; k++)
                {
                    if (custAttrib[k] is ConnectionType)
                    {
                        ConnectionType ct = custAttrib[k] as ConnectionType;
                        if (ct.ConnType == "Param")
                        {
                            Label ll = new Label();
                            ll.Text = ct.Description;
                            ll.Left = textLeft;
                            ll.Top  = (this.Controls.Count) * objHeight + 5;


                            Control ctrl = giveControlForType(ptt, prop);

                            ctrl.Left  = objLeft;
                            ctrl.Top   = (this.Controls.Count) * objHeight + 5;
                            ctrl.Width = 300;

                            this.Controls.Add(ctrl);
                            this.Controls.Add(ll);
                        }

                        break;
                    }
                }
            }


            button1.Top = (this.Controls.Count) * objHeight;
            this.Controls.Add(this.button1);

            this.Height = (this.Controls.Count + 3) * objHeight;

            this.ResumeLayout();
        }