コード例 #1
0
        protected override void Setup_()
        {
            base.Setup_();
            _FormControls_StartupFlag = false;
            if (_formHost == null)
            {
                return;
            }

            if (_panelMain == null)
            {
                // If there is only 1 panel -> assume it is the main panel
                var panels = UIDesigner_Tools.Host_Controls_All <Panel>(_formHost);
                if (panels.Count == 0)
                {
                    Setup_PanelMain();
                }
                //if (panels.Count == 1)
                //{
                //    _panelMain = panels[0];  // We cannot assume this to be true.
                //}
                else
                {
                    foreach (Panel panel in panels)
                    {
                        if (panel.Tag.zObject().AsStr() == "MainPanel")
                        {
                            _panelMain = panel;
                            break;
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void Setup_Panels()
        {
            if (IsNotSave())
            {
                return;
            }
            if (_panelMain == null)
            {
                // Lets try to get the main panel
                "No Main Panel assigned.".zOk();
                _formHost = UIDesigner_Service.IDesignerHost_FromComponent(this);
                var panels = UIDesigner_Tools.Host_Controls_All <Panel>(_formHost);
                foreach (Panel panel in panels)
                {
                    if (panel.Tag.ToString() == "MainPanel")
                    {
                        _panelMain = panel;
                    }
                }
                if (panels.Count == 0)
                {
                    Setup_PanelMain();
                }

                if (_panelMain == null)
                {
                    "Cannot change panels if Panel_Main is not assigned!".zOk();
                    return;
                }
            }
            UIDesigner_Generate.Form_PanelSetup(this, Panel_Setup, Panel_Main, out _panel1, out _panel2, out _panel3);
        }
コード例 #3
0
        public void Setup(FormCreator_ designer)
        {
            _SetupFlag = true;
            _designer  = designer;

            // Form Size & Form Panels
            typeof(enForm_Size).zEnum_To_IList(comboBox_FormSize.Items);
            //IamWindows.libUI.WinForms.Controls.ComboBox.SearchItem(comboBox_FormSize, designer.FormSize.ToString());

            typeof(enForm_Panels).zEnum_To_IList(comboBox_FormPanels.Items);
            IamWindows.libUI.WinForms.Controls.ComboBox.SearchItem(comboBox_FormPanels, designer.Panel_Setup.ToString());

            // Panel setup
            input_Panel1.Field_Value = UIDesigner_Component.Component_AsStr(_designer.Panel_Main, true, true);

            listBox_Components.Items.Clear();
            _host = UIDesigner_Service.IDesignerHost_FromComponent(designer);
            if (_host != null)
            {
                // Set event
                UIDesigner_Tools.Host_Controls_SelectionChange(_host, OnselectionChanged);
                this.Closed -= OnFormClosed;
                this.Closed += OnFormClosed;

                // Find all controls on the form
                _components = UIDesigner_Tools.Host_Components_All(_host);
                _controls   = UIDesigner_Tools.Host_Controls_All(_host);
                UIDesigner_Component.ControlNames(_components).zTo_IList(listBox_Components.Items);

                // Populate the list of classes that can be generated
                Assembly      assembly = LamedalCore_.Instance.Types.Assembly.From_Object(designer);
                List <string> typeNameList;
                if (IamWindows.libUI.WinForms.FormGenerate.AssemblyTypes(assembly, out typeNameList, out _typeAttributeDictionary))
                {
                    typeNameList.zTo_IList(listBox_Classes.Items);
                    listBox_Classes.SelectedIndex = 0;
                }

                this.TopMost = true;
                this.Show();
            }

            _SetupFlag = false;
        }
コード例 #4
0
ファイル: Form_.cs プロジェクト: zuozhu315/Lamedal_WinForms
 protected void Setup_MainForm()
 {
     _formHost = UIDesigner_Service.IDesignerHost_FromComponent(this);
     _formName = UIDesigner_Form.Form_Main(this);
     if (_formName == null)
     {
         return;                     // If we do not know what the form name is -> we cannot go past this point.
     }
     try
     {
         if (_formHost != null)
         {
             // Basic setup of the form
             _formControls = UIDesigner_Tools.Host_Controls_All(_formHost);
             Setup_();
         }
     }
     catch (Exception)
     {
         _Form_Startup = false;
         throw;
     }
     _Form_Startup = false;
 }