예제 #1
0
        protected virtual void InitPanels()
        {
            var attrs = DataPanelAttribute.GetDataPanels(this.DataContext.GetDataType());
            SortedList <int, DataPanelAttribute> list = new SortedList <int, DataPanelAttribute>();

            if (attrs != null)
            {
                foreach (var attr in attrs)
                {
                    int priority = PriorityAttribute.GetPriority(attr.DataPanelType);
                    list.Add(priority, attr);
                }
            }

            foreach (var attr in list.Values)
            {
                UserControl panel = (UserControl)attr.DataPanelType.GetConstructor(new Type[0]).Invoke(new object[0]);
                panel.Visible  = false;
                panel.AutoSize = true;
                panel.Dock     = DockStyle.Fill;
                this.AddPanel(attr.Path, panel);
            }

            if (this.panels.Count > 1)
            {
                this.SplitContainer.Panel1Collapsed = false;
            }

            this.calculateSize();

            if (this.panels.Count > 0)
            {
                this.SelectPanel(this.panels[0]);
            }
        }
예제 #2
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);
            }
예제 #3
0
 private static void checkCache()
 {
     if (__cache__ == null)
     {
         __cache__ = new Dictionary <Type, Type>();
         var attrs = AppController.Instance.AssemblyAttributes[typeof(AppServiceAttribute)];
         foreach (AppServiceAttribute attr in attrs)
         {
             if (__cache__.ContainsKey(attr.ServiceInterface))
             {
                 if (PriorityAttribute.GetPriority(attr) < PriorityAttribute.GetPriority(__cache__[attr.ServiceInterface]))
                 {
                     __cache__[attr.ServiceInterface] = attr.ServiceType;
                 }
             }
             else
             {
                 __cache__.Add(attr.ServiceInterface, attr.ServiceType);
             }
         }
     }
 }