Example #1
0
        private void DoNavigation(int userControlCode, Dictionary <string, int> additionalParameters = null)
        {
            this.mainPanel.Controls.Clear();
            UserControl currentUserControl = UserControlFactory.CreateUserControl(userControlCode, additionalParameters, this.DoNavigation);

            this.mainPanel.Controls.Add(currentUserControl);
        }
Example #2
0
        public void LoadPage()
        {
            RetrieveMenu MenuObj    = new RetrieveMenu();
            PageManager  ReloadPage = new PageManager();

            UserControl NewPage = new UserControlFactory().InstantiatePage(MenuObj.Getmenu(SelectedMenu).HandlerDLL);

            ReloadPage.FillContent(NewPage, MainPage);
        }
Example #3
0
        private void IninConfig()
        {
            SplashScreenManager.ShowForm(typeof(SplashScreen1));
            string maxTime = new CfheadManager().GetMaxTime();

            SplashScreenManager.Default.SendCommand(null, string.Format("最新更新时间为{0},1", maxTime));

            string maxDate = maxTime.Split(' ')[0].Replace("-", "").Trim();

            new ImportData().AutoImport();


            SplashScreenManager.Default.SendCommand(null, "内容面板预加载,开始,10");
            UserControlFactory.CreateInstance("");
            SplashScreenManager.Default.SendCommand(null, "内容面板预加载,结束,50");

            SplashScreenManager.Default.SendCommand(null, "数据更新完成,100");
            SplashScreenManager.CloseForm();
        }
        void cmbSubFields_SelectedValueChanged(object sender, EventArgs e)
        {
            // Remove Current
            var oldControl = panelFieldOptions.FindControl <IUserControl>();

            if (oldControl != null)
            {
                var baseUserControl = oldControl as BaseUserControl;

                if (baseUserControl != null)
                {
                    baseUserControl.OptionsChanged -= UpdateUserControlExampleText;
                }

                ((UserControl)oldControl).Dispose();
            }

            var cmb           = (ComboBox)sender;
            var selectedValue = (SubField)cmb.SelectedItem;
            var subFieldType  = selectedValue.SubFieldType;
            var fieldOptions  = FieldOptionsFactory.GetFieldOptions(subFieldType);
            var userControl   = UserControlFactory.GetUserControl(fieldOptions);

            if (userControl != null)
            {
                var control         = (Control)userControl;
                var baseUserControl = (BaseUserControl)userControl;

                baseUserControl.OptionsChanged += UpdateUserControlExampleText;
                UpdateUserControlExampleText(userControl, EventArgs.Empty);

                control.Dock     = DockStyle.Top;
                control.Location = new System.Drawing.Point(0, 0);
                control.Name     = "userControl_" + baseUserControl.GetType().Name;
                control.TabIndex = 2;

                panelFieldOptions.Controls.Add(control);
            }
        }
Example #5
0
        public void InitMenu()
        {
            //XmlDocument doc = new XmlDocument();
            //doc.Load("config/MenuConfig.xml");
            //XmlNode root = doc.SelectSingleNode("menus");
            //foreach (XmlNode node in root.ChildNodes)
            //{
            //   string title =  node.Attributes["name"].Value;
            //    BarSubItem bi = new BarSubItem();
            //    bi.Caption = title;
            //    if (!node.HasChildNodes)
            //    {
            //        bi.ItemClick += (s, e) =>
            //        {
            //            DialogFactory.CreateConfigControl();
            //        };
            //    }
            //    foreach (XmlNode child in node.ChildNodes)
            //    {
            //        string title02 = child.InnerText;
            //        BarButtonItem bii = new BarButtonItem();
            //        bii.Caption = title02;
            //        bii.ItemClick += (s, e) =>
            //        {
            //            Control cc = UserControlFactory.CreateInstance(title02);
            //            cc.Text = title02;
            //            documentManager1.View.AddOrActivateDocument(item => item.Caption==cc.Text, ()=>cc);
            //        };
            //        bi.AddItem(bii);
            //    }
            //    this.barManager1.MainMenu.AddItem(bi);


            //}

            DataTable dt    = SqlHelper.ExecuteTable("select * from menu");
            User      u     = AppDomain.CurrentDomain.GetData("user") as User;
            string    power = u.isadmin == 1 ?"admin =1":"common=1";

            foreach (DataRow item in dt.Select("upid is null and " + power))
            {
                BarSubItem bi = new BarSubItem();
                bi.Caption = item.Field <string>("title");
                if (dt.Select("upid =" + item.Field <int>("id")).Length == 0)
                {
                    bi.ItemClick += (s, e) =>
                    {
                        DialogFactory.CreateConfigControl();
                    };
                }
                foreach (DataRow item02 in dt.Select("upid =" + item.Field <int>("id") + " and " + power))
                {
                    BarButtonItem bii = new BarButtonItem();
                    bii.Caption    = item02.Field <string>("title");
                    bii.ItemClick += (s, e) =>
                    {
                        Control cc = UserControlFactory.CreateInstance(bii.Caption);
                        cc.Text = bii.Caption;
                        documentManager1.View.AddOrActivateDocument(ite => ite.Caption == cc.Text, () => cc);
                    };
                    bi.AddItem(bii);
                }
                barManager1.MainMenu.AddItem(bi);
                //System.Diagnostics.Debug.WriteLine(item.Field<string>("title"));
            }
        }