Beispiel #1
0
            public ActionInfo(Type type)
            {
                this.action      = type.GetConstructor(new Type[0]).Invoke(new object[0]);
                this.priority    = PriorityAttribute.GetPriority(this.action, 1000);
                this.text        = CaptionAttribute.GetCaption(this.action, type.Name);
                this.description = BAL.Types.AttributesExtensions.GetDescription(null, this.action);
                var pinfo = type.GetProperty("Target", BindingFlags.Instance | BindingFlags.Public);

                if (pinfo != null)
                {
                    this.target = (ActionTarget)pinfo.GetValue(this.action, null);
                }
                else
                {
                    this.target = ActionTarget.None;
                }

                pinfo = type.GetProperty("MarginLeft", BindingFlags.Instance | BindingFlags.Public);
                if (pinfo != null)
                {
                    this.MarginLeft = (int)pinfo.GetValue(this.action, null);
                }

                pinfo = type.GetProperty("MarginRight", BindingFlags.Instance | BindingFlags.Public);
                if (pinfo != null)
                {
                    this.MarginRight = (int)pinfo.GetValue(this.action, null);
                }

                pinfo = type.GetProperty("MarginTop", BindingFlags.Instance | BindingFlags.Public);
                if (pinfo != null)
                {
                    this.MarginTop = (int)pinfo.GetValue(this.action, null);
                }

                pinfo = type.GetProperty("MarginBottom", BindingFlags.Instance | BindingFlags.Public);
                if (pinfo != null)
                {
                    this.MarginBottom = (int)pinfo.GetValue(this.action, null);
                }


                this.propertySelectedRows         = type.GetProperty("SelectedRows");
                this.propertyCurrentRow           = type.GetProperty("CurrentRow");
                this.propertyFireReload           = type.GetProperty("FireReload");
                this.propertyFireRefresh          = type.GetProperty("FireRefresh");
                this.propertyFireSelectionChanged = type.GetProperty("FireSelectionChanged");

                this.methodOnAction           = type.GetMethod("OnAction", BindingFlags.Instance | BindingFlags.Public);
                this.methodOnSelectionChanged = type.GetMethod("OnSelectionChanged", BindingFlags.Instance | BindingFlags.Public);
            }
Beispiel #2
0
        public ActionButton(object action)
        {
            this.action = action;
            this.Text   = CaptionAttribute.GetCaption(this.action, this.action.GetType().Name);
            var pinfo = this.action.GetType().GetProperty("Control");

            if (pinfo != null)
            {
                pinfo.SetValue(this.action, this, null);
            }
            method = action.GetType().GetMethod("OnAction");
            pinfo  = this.action.GetType().GetProperty("WaitCursorEnable");
            if (pinfo != null)
            {
                this.waitCursor = (bool)pinfo.GetValue(this.action, null);
            }
        }
Beispiel #3
0
        protected virtual void InitColumns()
        {
            var type = this.GetDataType();

            this.columns = new ColumnCollection();
            this.columns.BeginInit();
            foreach (var pinfo in type.GetProperties())
            {
                if (pinfo.GetCustomAttributes(typeof(HiddenAttribute), true).Length > 0)
                {
                    continue;
                }
                Column column = new Column();
                column.HeaderText   = CaptionAttribute.GetCaption(pinfo, pinfo.Name);
                column.TextAlign    = TextAlign.Left;
                column.Width        = 100;
                column.Visible      = true;
                column.PropertyPath = new PropertyPath(pinfo);
                this.columns.Add(column);
            }
            this.columns.EndInit();
        }