示例#1
0
 public static void GetChildrenXMLLayout(ABCView ownView, DockPanel panel, XmlElement panelElement)
 {
     foreach (Control ctrl in panel.Controls)
     {
         if (ctrl is DockPanel)
         {
             XmlElement childEle = ownView.ComponentSerialization(panelElement.OwnerDocument, ctrl);
             panelElement.AppendChild(childEle);
         }
         else if (ctrl is ControlContainer)
         {
             #region Child
             ComponentDesigner designer = (ComponentDesigner)ownView.Surface.DesignerHost.GetDesigner(ctrl);
             if (designer != null && designer.AssociatedComponents != null)
             {
                 List <XmlElement> lstTemp = new List <XmlElement>();
                 foreach (object associatedComponent in designer.AssociatedComponents)
                 {
                     XmlElement eleChild = ownView.ComponentSerialization(panelElement.OwnerDocument, (IComponent)associatedComponent);
                     if (eleChild != null)
                     {
                         panelElement.AppendChild(eleChild);
                     }
                 }
             }
             #endregion
         }
     }
 }
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context.Instance != (HostSurfaceManager.CurrentManager.ActiveDesignSurface as HostSurface).DesignerHost.RootComponent)
            {
                ABCHelper.ABCMessageBox.Show("Can not modify the Binding Configurations of child View ! ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            IWindowsFormsEditorService svc = null;

            if (provider != null)
            {
                svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            }

            if (svc != null)
            {
                ABCView view = (ABCView)context.Instance;
                using (ABCBusinessConfigEditorForm form = new ABCBusinessConfigEditorForm(view))
                {
                    form.DataConfig = view.DataConfig;
                    if (form.DataConfig == null)
                    {
                        form.DataConfig = new ABCScreen.ABCScreenConfig(view);
                    }
                    if (svc.ShowDialog(form) == DialogResult.OK)
                    {
                        value = form.NewDataConfig;
                    }
                }
            }

            return(value);
        }
示例#3
0
        public void ShowPreview( )
        {
            if (HostSurface == null || DesignerHost == null || DesignerHost.RootComponent == null || DesignerHost.RootComponent is ABCView == false)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            ABCView currentView = (ABCView)DesignerHost.RootComponent;

            currentView.SaveToXML("temp.xml");

            ABCControls.ABCView view = new ABCView();
            view.Load("temp.xml", ViewMode.Test);

            tabPreview.SuspendLayout();

            foreach (Control ctrl in tabPreview.Controls)
            {
                ctrl.Dispose();
            }

            tabPreview.Controls.Clear();
            view.Parent = tabPreview;
            //   view.Dock=DockStyle.Fill;
            view.AutoScroll = true;

            tabPreview.ResumeLayout(false);

            Cursor.Current = Cursors.Default;
        }
示例#4
0
 public void Initialize(ABCView view, ABCBindingInfo bindingInfo)
 {
     this.DataSource = bindingInfo.BusName;
     this.DataMember = bindingInfo.FieldName;
     this.TableName  = bindingInfo.TableName;
     this.Text       = ABCPresentHelper.GetLabelCaption(view, this.DataSource, this.DataMember);
 }
示例#5
0
        public static void InitDockManager(ABCView view, XmlDocument doc)
        {
            XmlNodeList nodeList = doc.GetElementsByTagName("DCK");

            if (nodeList.Count <= 0)
            {
                return;
            }

            if (view.CurrentDockManager == null)
            {
                view.CurrentDockManager = new ABCDockManager(view);
            }


            foreach (XmlNode node in nodeList[0].SelectNodes("PL"))
            {
                foreach (DockPanel panel in view.CurrentDockManager.Panels)
                {
                    if (panel.Name == node.InnerText)
                    {
                        view.CurrentDockManager.RootPanels.AddRange(new DockPanel[] { panel });
                        panel.DockTo(panel.Dock);
                    }
                }
            }
        }
示例#6
0
        public static ABCDockManager GetDockManager(ABCView view)
        {
            if (view.Mode == ViewMode.Design)
            {
                foreach (Component comp in view.Surface.DesignerHost.Container.Components)
                {
                    if (comp is ABCDockManager)
                    {
                        view.CurrentDockManager = (ABCDockManager)comp;
                        return((ABCDockManager)comp);
                    }
                }

                ABCDockManager manager = (ABCDockManager)view.Surface.DesignerHost.CreateComponent(typeof(ABCDockManager));
                manager.Form            = view;
                view.CurrentDockManager = manager;
                return(manager);
            }
            else
            {
                if (view.CurrentDockManager != null)
                {
                    return(view.CurrentDockManager);
                }

                view.CurrentDockManager = new ABCDockManager(view);
                return(view.CurrentDockManager);
            }
        }
示例#7
0
        public void InitView(ABCView view)
        {
            this.Controls.Clear();
            if (OwnerView != null)
            {
                OwnerView.Dispose();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }

            this.ClientSize = view.Size;
            if (view.ShowToolbar)
            {
                this.ClientSize = new System.Drawing.Size(this.ClientSize.Width, this.ClientSize.Height + 30);
            }
            OwnerView            = view;
            OwnerView.Parent     = this;
            OwnerView.Dock       = DockStyle.Fill;
            OwnerView.AutoScroll = true;

            if (OwnerView.DataField != null)
            {
                this.Text = OwnerView.DataField.STViewName;
            }
            this.StartPosition   = OwnerView.StartPosition;
            this.Text            = OwnerView.Caption;
            this.WindowState     = OwnerView.WindowState;
            this.FormBorderStyle = OwnerView.FormBorderStyle;
            this.ControlBox      = OwnerView.ControlBox;
            this.MinimizeBox     = OwnerView.MinimizelBox;
            this.MaximizeBox     = OwnerView.MaximizeBox;
            this.ShowInTaskbar   = false;
            this.Shown          += new EventHandler(ABCViewDlg_Shown);
            this.FormClosed     += new System.Windows.Forms.FormClosedEventHandler(ABCViewDlg_FormClosed);
        }
示例#8
0
 public void GetChildrenXMLLayout(ABCView ownView, XmlElement AutoSearchPanelEle)
 {
     foreach (Control ctrl in this.DropZone.Controls)
     {
         XmlElement childEle = ownView.ComponentSerialization(AutoSearchPanelEle.OwnerDocument, ctrl);
         AutoSearchPanelEle.AppendChild(childEle);
     }
 }
示例#9
0
 public void Initialize(ABCView view, ABCSearchInfo searchInfo)
 {
     OwnerView       = view;
     this.DataSource = searchInfo.DataSource;
     this.DataMember = searchInfo.DataMember;
     this.TableName  = searchInfo.TableName;
     InvalidateControl();
 }
示例#10
0
        public void PopulateControls(ABCView view, String BusName, String strTableName)
        {
            ViewOwner  = view;
            DataSource = BusName;
            TableName  = strTableName;
            int iCount = 0;

            foreach (DataConfigProvider.FieldConfig fieldConfig in DataConfigProvider.TableConfigList[strTableName].FieldConfigList.Values)
            {
                //if ( fieldConfig.IsDefault )
                //{
                String strDiplay = DataConfigProvider.GetFieldCaption(strTableName, fieldConfig.FieldName);
                if (strDiplay == fieldConfig.FieldName)
                {
                    continue;
                }

                ABCBindingBaseEdit ctrl;

                if (view.Mode == ViewMode.Design)
                {
                    ctrl = (ABCBindingBaseEdit)view.Surface.DesignerHost.CreateComponent(typeof(ABCBindingBaseEdit));
                }
                else
                {
                    ctrl = (ABCBindingBaseEdit)ABCDynamicInvoker.CreateInstanceObject(typeof(ABCBindingBaseEdit));
                }

                ABCBindingInfo bindInfo = new ABCBindingInfo();
                bindInfo.BusName   = BusName;
                bindInfo.TableName = TableName;
                bindInfo.FieldName = fieldConfig.FieldName;
                List <Type> lstType = ABCControls.ABCPresentHelper.GetControlTypes(TableName, fieldConfig.FieldName);
                if (lstType.Count <= 0)
                {
                    continue;
                }
                foreach (Type type in lstType)
                {
                    if (type != typeof(ABCSearchControl))
                    {
                        bindInfo.ControlType = lstType[0];
                        break;
                    }
                }
                ctrl.Initialize(view, bindInfo);
                ctrl.Parent = this;
                iCount++;
                //}
            }
            if (iCount % 2 != 0)
            {
                iCount++;
            }
            iCount    = iCount / 2;
            this.Size = new Size(229 * 2 + 4 * 3, 20 * iCount + (iCount + 1) * 5);
        }
示例#11
0
        public void PerformDock(ABCView view)
        {
            //if ( this.Tabbed )
            //    this.ActiveChild=(ABCDockPanel)this.Controls[0];
            ABCDockManager manager = ABCDockManager.GetDockManager(view);

            this.Register(manager);
            this.DockTo(this.Dock);
        }
示例#12
0
        public void PopulateControls(ABCView view, String BusName, String strTableName)
        {
            ViewOwner  = view;
            DataSource = BusName;
            TableName  = strTableName;
            int iCount            = 0;
            ABCSearchControl ctrl = null;

            foreach (DataConfigProvider.FieldConfig fieldConfig in DataConfigProvider.TableConfigList[strTableName].FieldConfigList.Values)
            {
                if (fieldConfig.InUse == false)
                {
                    continue;
                }

                if (DataStructureProvider.IsPrimaryKey(strTableName, fieldConfig.FieldName) ||
                    DataStructureProvider.IsForeignKey(strTableName, fieldConfig.FieldName))
                {
                    continue;
                }

                if (fieldConfig.IsDefault)
                {
                    if (view != null && view.Mode == ViewMode.Design)
                    {
                        ctrl = (ABCSearchControl)view.Surface.DesignerHost.CreateComponent(typeof(ABCSearchControl));
                    }
                    else
                    {
                        ctrl = (ABCSearchControl)ABCDynamicInvoker.CreateInstanceObject(typeof(ABCSearchControl));
                    }

                    ABCSearchInfo searchInfo = new ABCSearchInfo();
                    searchInfo.DataSource = BusName;
                    searchInfo.TableName  = TableName;
                    searchInfo.DataMember = fieldConfig.FieldName;

                    ctrl.Initialize(view, searchInfo);
                    ctrl.Parent = this.DropZone;
                    iCount++;
                }
            }

            if (iCount % 2 != 0)
            {
                iCount++;
            }
            iCount = iCount / 2;
            if (ctrl != null)
            {
                this.Size = new Size(ctrl.Width * 2 + 4 * 3, 20 * iCount + (iCount + 1) * 5 + 25);
            }
        }
示例#13
0
        public ABCBusinessConfigEditorForm(ABCView view)
        {
            OwnerView = view;

            InitializeComponent();

            InitTreelist();

            this.Load += new EventHandler(Form_Load);
            this.PropertyGrid.CellValueChanged           += new DevExpress.XtraVerticalGrid.Events.CellValueChangedEventHandler(PropertyGrid_CellValueChanged);
            this.repositoryItemButtonEdit1.ButtonPressed += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(repositoryItemButtonEdit1_ButtonPressed);
        }
示例#14
0
        public static ABCDockPanel AddNewDockPanel(ABCView view)
        {
            ABCDockPanel panel = new ABCDockPanel();

            panel.Dock = DevExpress.XtraBars.Docking.DockingStyle.Left;

            DevExpress.XtraBars.Docking.ControlContainer ctrl = new ControlContainer();
            ctrl.Dock   = DockStyle.Fill;
            ctrl.Parent = panel;

            return(panel);
        }
示例#15
0
        public void InitLayout(ABCView view, XmlNode node)
        {
            this.TabPages.Clear();

            foreach (XmlNode nodePage in node.SelectNodes("C"))
            {
                Component comp = ABCPresentHelper.LoadComponent(view, nodePage);
                if (comp != null && comp is DevExpress.XtraTab.XtraTabPage)
                {
                    this.TabPages.Add((DevExpress.XtraTab.XtraTabPage)comp);
                }
            }
        }
示例#16
0
        public static String GetLabelCaption(ABCView OwnerView, String strDataSource, String strDataMember)
        {
            if (OwnerView == null || String.IsNullOrWhiteSpace(strDataMember) || String.IsNullOrWhiteSpace(strDataSource))
            {
                return(String.Empty);
            }

            if (OwnerView.DataConfig.BindingList.ContainsKey(strDataSource) == false)
            {
                return(String.Empty);
            }

            String strBusTableName = OwnerView.DataConfig.BindingList[strDataSource].TableName;

            return(GetLabelCaption(strBusTableName, strDataMember));
        }
示例#17
0
        public void Initialize(ABCView view)
        {
            OwnerView = view;

            InitControl();

            String strFieldName = this.DataMember.Split(':')[0];

            if (DataStructureProvider.IsForeignKey(this.TableName, strFieldName))
            {
                this.LookupTableName = DataStructureProvider.GetTableNameOfForeignKey(this.TableName, strFieldName);

                this.ValueMember = DataStructureProvider.GetPrimaryKeyColumn(this.LookupTableName);

                this.DisplayMember = DataStructureProvider.GetDisplayColumn(this.LookupTableName);
            }

            this.DummyText = "...";
        }
示例#18
0
        public void InitLayout(ABCView view, XmlNode node)
        {
            ViewOwner = view;

            this.DropZone.Controls.Clear();

            foreach (XmlNode nodeCtrl in node.SelectNodes("C"))
            {
                Component comp = ABCPresentHelper.LoadComponent(view, nodeCtrl);
                if (comp != null)
                {
                    this.DropZone.Controls.Add((Control)comp);
                }
            }

            if (ViewOwner != null && ViewOwner.Mode != ViewMode.Design)
            {
                SetSearchButton(this);
            }
        }
        public void InitLayout(ABCView view, XmlNode node)
        {
            foreach (XmlNode nodePanel in node.SelectNodes("C"))
            {
                DevExpress.XtraEditors.SplitGroupPanel panel = null;
                String strPanelName = nodePanel.Attributes["name"].Value.ToString();
                if (strPanelName.EndsWith("Panel1"))
                {
                    panel = this.Panel1;
                }
                else if (strPanelName.EndsWith("Panel2"))
                {
                    panel = this.Panel2;
                }
                else
                {
                    continue;
                }


                foreach (XmlNode nodeChild in nodePanel.ChildNodes)
                {
                    if (nodeChild.Name == "P")
                    {
                        if (nodeChild.Attributes["name"].Value.ToString() == "Size")
                        {
                            panel.Size  = (Size)TypeDescriptor.GetConverter(typeof(Size)).ConvertFromString(nodeChild.InnerText);
                            panel.Width = panel.Size.Width;
                        }
                    }
                    else if (nodeChild.Name == "C")
                    {
                        Component comp = ABCPresentHelper.LoadComponent(view, nodeChild);
                        if (comp is Control)
                        {
                            ((Control)comp).Parent = panel;
                        }
                    }
                }
            }
        }
示例#20
0
        public static void LoadChildrenComponent(ABCView ViewOwner, XmlNode nodeParent, Component parent)
        {
            if (parent is ABCView)
            {
                ((Control)parent).Controls.Clear();
            }

            foreach (XmlNode nodeChild in nodeParent.ChildNodes)
            {
                if (nodeChild.Name != "C")
                {
                    continue;
                }

                Component compChild = LoadComponent(ViewOwner, nodeChild);
                if (compChild is Control && parent is Control)
                {
                    ((Control)compChild).Parent = (Control)parent;
                }
            }
        }
示例#21
0
        public static Component CreateComponent(ABCView ViewOwner, Type type)
        {
            Component comp = null;

            try
            {
                if (ViewOwner.Mode == ViewMode.Design)
                {
                    comp = (Component)ViewOwner.Surface.DesignerHost.CreateComponent(type);
                }
                else
                {
                    comp = (Component)ABCDynamicInvoker.CreateInstanceObject(type);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(comp);
        }
示例#22
0
 public void Initialize(ABCView view, ABCBindingInfo bindingInfo)
 {
     try
     {
         OwnerView       = view;
         this.DataSource = bindingInfo.BusName;
         this.DataMember = bindingInfo.FieldName;
         this.TableName  = bindingInfo.TableName;
         if (bindingInfo.ControlType == null || String.IsNullOrWhiteSpace(bindingInfo.ControlType.FullName))
         {
             this.UIControlType = typeof(ABCTextEdit).FullName;
         }
         else
         {
             this.UIControlType = bindingInfo.ControlType.FullName;
         }
     }
     catch (Exception ex)
     {
         ABCHelper.ABCMessageBox.Show("Binding cancel");
     }
 }
示例#23
0
        public void InitLayout(ABCView view, XmlNode panelNode)
        {
            InitializeFromXmlNode(panelNode);

            foreach (XmlNode node in panelNode.SelectNodes("C"))
            {
                Component comp = ABCPresentHelper.LoadComponent(view, node);
                if (comp != null)
                {
                    if (comp is DockPanel)
                    {
                        this.Controls.Add((Control)comp);
                    }
                    else
                    {
                        this.ControlContainer.Controls.Add((Control)comp);
                    }
                }
            }


            PerformDock(view);
        }
示例#24
0
 public void Initialize(ABCView view, ABCBindingInfo bindingInfo)
 {
     this.DataSource = bindingInfo.BusName;
     this.DataMember = bindingInfo.FieldName;
     //      this.Caption=ABCPresentUtils.GetLabelCaption( view , this.DataSource , this.DataMember );
 }
示例#25
0
 public ABCViewDlg(ABCView view)
 {
     InitView(view);
 }
示例#26
0
 public void InitLayout(ABCView view, XmlNode node)
 {
     OwnerView = view;
     InvalidateControl();
 }
示例#27
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService svc = null;

            if (provider != null)
            {
                svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            }

            String strContextFieldName = String.Empty;

            if (context is DevExpress.XtraVerticalGrid.Data.DescriptorContext)
            {
                strContextFieldName = (context as DevExpress.XtraVerticalGrid.Data.DescriptorContext).FieldName;
            }
            //else if ( context is System.Windows.Forms.PropertyGridInternal.GridEntry)
            //      strContextFieldName=( context as System.Windows.Forms.PropertyGrid.ControlAccessibleObject.).;

            if (svc != null)
            {
                String strTableName = String.Empty;
                if (context.Instance is ABCScreen.ABCBindingConfig)
                {
                    if (strContextFieldName == "ChildField")
                    {
                        strTableName = ((ABCScreen.ABCBindingConfig)context.Instance).TableName;
                    }
                    else if (strContextFieldName == "ParentField")
                    {
                        String strDataSource = ((ABCScreen.ABCBindingConfig)context.Instance).ParentName;
                        if (String.IsNullOrWhiteSpace(strDataSource))
                        {
                            return(value);
                        }

                        ABCView view = (ABCView)((HostSurface)HostSurfaceManager.CurrentManager.ActiveDesignSurface).DesignerHost.RootComponent;
                        if (view.DataConfig.BindingList.ContainsKey(strDataSource))
                        {
                            strTableName = view.DataConfig.BindingList[strDataSource].TableName;
                        }
                    }
                }
                else if (context.Instance is IABCControl)
                {
                    if (String.IsNullOrWhiteSpace(strContextFieldName) == false && strContextFieldName.EndsWith("DataMember"))
                    {
                        String  strDataSource = ((IABCControl)context.Instance).GetType().GetProperty("DataSource").GetValue(context.Instance, null).ToString();
                        ABCView view          = (ABCView)((HostSurface)HostSurfaceManager.CurrentManager.ActiveDesignSurface).DesignerHost.RootComponent;
                        if (view.DataConfig.BindingList.ContainsKey(strDataSource))
                        {
                            strTableName = view.DataConfig.BindingList[strDataSource].TableName;
                        }
                    }
                }

                if (context.Instance is ABCLookUpEdit || context.Instance is ABCGridLookUpEdit)
                {
                    if (strContextFieldName.EndsWith("Member"))
                    {
                        if (context.Instance is ABCLookUpEdit)
                        {
                            strTableName = (context.Instance as ABCLookUpEdit).TableName;
                        }
                        if (context.Instance is ABCGridLookUpEdit)
                        {
                            strTableName = (context.Instance as ABCGridLookUpEdit).TableName;
                        }
                    }
                }

                if ((context.Instance is ABCSearchPanel))
                {
                    strTableName = (context.Instance as ABCSearchPanel).TableName;
                    using (ColumnChooserForm form = new ColumnChooserForm(strTableName))
                    {
                        List <String> oldArr = null;
                        if (value != null)
                        {
                            oldArr = (List <String>)value;
                        }
                        List <String> arrResult = form.ShowChoose(oldArr.ToArray());
                        if (form.DialogResult == DialogResult.OK)
                        {
                            value = arrResult;
                        }
                    }
                }
                if (context.Instance is ABCControls.TreeConfigData)
                {
                    if (strContextFieldName == "ChildField")
                    {
                        strTableName = ((ABCControls.TreeConfigData)context.Instance).TableName;
                    }
                    else if (strContextFieldName == "ParentField")
                    {
                        strTableName = ((ABCControls.TreeConfigData)context.Instance).ParentTableName;
                    }
                }

                if (string.IsNullOrWhiteSpace(strTableName))
                {
                    return(value);
                }

                using (ColumnChooserForm form = new ColumnChooserForm(strTableName))
                {
                    String strOld = String.Empty;
                    if (value != null)
                    {
                        strOld = value.ToString();
                    }
                    String strResult = form.ShowChooseOne(strOld);
                    if (form.DialogResult == DialogResult.OK)
                    {
                        value = strResult;
                    }
                }
            }

            if (context.Instance is ABCGridControl)
            {
                ((ABCGridControl)context.Instance).DefaultView.InitColumns();
            }
            return(value);
        }
示例#28
0
        public static Component LoadComponent(ABCView ViewOwner, XmlNode node)
        {
            String strName = node.Attributes["name"].Value.ToString();
            String strType = node.Attributes["type"].Value.ToString();
            Type   type    = TypeResolutionService.CurrentService.GetType(strType);

            if (type == null)
            {
                return(null);
            }

            #region Node
            Component comp = null;

            #region ABCView
            if (type == typeof(ABCView))
            {
                if (node.Attributes["isRoot"] != null && node.Attributes["isRoot"].Value.ToString() == "true")
                {
                    #region root
                    DeSerialization(ViewOwner, node);

                    ViewOwner.IsRoot = true;
                    ViewOwner.Name   = node.Attributes["name"].Value.ToString();
                    if (String.IsNullOrWhiteSpace(ViewOwner.Caption))
                    {
                        ViewOwner.Caption = ViewOwner.Name;
                    }

                    comp = ViewOwner;

                    LoadChildrenComponent(ViewOwner, node, comp);

                    #endregion
                }
                else
                {
                    #region Included ABCView
                    if (ViewOwner.Mode == ViewMode.Design)
                    {
                        comp = (Component)ViewOwner.Surface.DesignerHost.CreateComponent(type);
                    }
                    else
                    {
                        comp = (Component)ABCDynamicInvoker.CreateInstanceObject(type);
                    }

                    DeSerialization(comp, node);

                    ((ABCView)comp).IsRoot = false;

                    Guid        iID      = ABCHelper.DataConverter.ConvertToGuid(node.Attributes["ID"].Value);
                    STViewsInfo viewInfo = (STViewsInfo) new STViewsController().GetObjectByID(iID);
                    if (viewInfo != null)
                    {
                        ((ABCView)comp).DataField = viewInfo;
                        ViewOwner.ChildrenView.Add((ABCView)comp);
                    }

                    #endregion
                }

                ((IABCControl)comp).OwnerView = ViewOwner;
                ((IABCControl)comp).InitControl();

                return(comp);
            }
            #endregion

            #region ABCDockPanel
            if (type == typeof(DevExpress.XtraBars.Docking.DockPanel) || type == typeof(ABCControls.ABCDockPanel))
            {
                comp = (Component)ABCDockPanel.AddNewDockPanel(ViewOwner);
                DeSerialization(comp, node);
                ((ABCDockPanel)comp).InitLayout(ViewOwner, node);
                return(comp);
            }
            #endregion

            comp = CreateComponent(ViewOwner, type);
            if (comp is Control)
            {
                (comp as Control).SuspendLayout();
            }

            if (comp is IABCControl)
            {
                ((IABCControl)comp).OwnerView = ViewOwner;
                ((IABCControl)comp).InitControl();
            }

            DeSerialization(comp, node);

            if (comp is IABCCustomControl)
            {
                ((IABCCustomControl)comp).InitLayout(ViewOwner, node);
            }
            else
            {
                LoadChildrenComponent(ViewOwner, node, comp);
            }

            #endregion

            if (comp is Control)
            {
                (comp as Control).ResumeLayout(false);
            }

            if (comp is ABCSimpleButton)
            {
                ViewOwner.ButtonList.Add(comp as ABCSimpleButton);
            }
            if (comp is ABCComment)
            {
                ViewOwner.CommentList.Add(comp as ABCComment);
            }

            return(comp);
        }
示例#29
0
        public void InitLayout(ABCView view, XmlNode node)
        {
            OwnerView = view;

            XmlNode child = node.SelectNodes("C")[0];

            if (child == null)
            {
                return;
            }

            String strType = child.Attributes["type"].Value.ToString();

            String strChildType = child.Attributes["type"].Value.ToString();
            Type   type         = TypeResolutionService.CurrentService.GetType(strChildType);

            if (type == null)
            {
                return;
            }

            Component comp = (Component)ABCDynamicInvoker.CreateInstanceObject(type);

            ABCPresentHelper.DeSerialization(comp, child);
            ((IABCControl)comp).OwnerView = view;
            ((IABCControl)comp).InitControl();
            (comp as Control).Parent = this;
            this.EditControl         = (IABCBindableControl)comp;

            if (view.Mode != ViewMode.Design && comp is ABCGridLookUpEdit)
            {
                if (((ABCGridLookUpEdit)comp).Properties.View.Columns.Count <= 2)
                {
                    Component comp2 = (Component)ABCDynamicInvoker.CreateInstanceObject(typeof(ABCLookUpEdit));
                    ((IABCBindableControl)comp2).DataSource = this.DataSource;
                    ((IABCBindableControl)comp2).DataMember = this.DataMember;
                    ((IABCBindableControl)comp2).TableName  = this.TableName;

                    ((IABCControl)comp2).OwnerView = view;
                    ((IABCControl)comp2).InitControl();
                    (comp2 as Control).Parent = this;
                    this.EditControl          = (IABCBindableControl)comp2;
                }
            }

            InvalidateControl();

            if (this.OwnerView == null || (this.OwnerView != null && this.OwnerView.Mode != ViewMode.Design))
            {
                bool   isUse      = true;
                String strRealCol = this.DataMember.Split(':')[0];
                if (!DataStructureProvider.IsTableColumn(this.TableName, strRealCol))
                {
                    isUse = false;
                }

                else if (!DataConfigProvider.TableConfigList.ContainsKey(this.TableName) || !DataConfigProvider.TableConfigList[this.TableName].FieldConfigList.ContainsKey(strRealCol))
                {
                    isUse = false;
                }

                else if (!DataConfigProvider.TableConfigList[this.TableName].FieldConfigList[strRealCol].InUse)
                {
                    isUse = false;
                }

                if (!isUse)
                {
                    this.Visible = false;
                }
            }
        }