Ejemplo n.º 1
0
        private void RefreshData()
        {
            frmBaseQueryForm form = this.ActiveMdiChild as frmBaseQueryForm;

            if (form != null && form.CanRefreshData)
            {
                form.RefreshData();
            }
        }
Ejemplo n.º 2
0
 private void SetQueryFormRefreshState(frmBaseQueryForm form)
 {
     if (form != null && form.CanRefreshData)
     {
         this.btnRefresh.Enabled = true;
     }
     else
     {
         this.btnRefresh.Enabled = false;
     }
 }
Ejemplo n.º 3
0
        private RibbonPage CreateRibbonPage(frmBaseQueryForm form)
        {
            if (form.ModelOperateRegistry.Count == 0)
            {
                return(null);
            }

            RibbonPage page = new RibbonPage(form.ModelOperatePageName);

            page.Tag = form.FormID;


            this.ribbonControl1.Pages.Insert(0, page);


            Dictionary <string, RibbonPageGroup> dict = new Dictionary <string, RibbonPageGroup>();

            foreach (ModelOperate mo in form.ModelOperateRegistry)
            {
                RibbonPageGroup group = null;
                if (!dict.ContainsKey(mo.GroupText))
                {
                    group = new RibbonPageGroup(mo.GroupText);
                    page.Groups.Add(group);
                    dict.Add(mo.GroupText, group);
                }
                else
                {
                    group = dict[mo.GroupText];
                }


                if (mo.UIType == UITypes.LargerButton)
                {
                    BarButtonItem button = new BarButtonItem();
                    button.RibbonStyle = RibbonItemStyles.Large;


                    button.Caption    = mo.Text;
                    button.GroupIndex = mo.Order;
                    button.ItemClick += new ItemClickEventHandler(RibbonButtonClick);
                    button.Tag        = mo;
                    group.ItemLinks.Add(button);

                    button.ImageIndex = mo.ImageIndex;
                }
            }

            return(page);
        }
Ejemplo n.º 4
0
        private void SetQueryOperateRibbonUI(frmBaseQueryForm form)
        {
            string currentFormID = form == null ? "" : form.FormID;

            SetOperatonGroupNotVisibleAndClearNotExistFormPage(currentFormID);

            if (form != null)
            {
                RibbonPage page = GetPageByID(form.FormID);
                if (page == null)
                {
                    page = CreateRibbonPage(form);
                }
                else
                {
                    page.Visible = true;
                }
                if (page != null)
                {
                    this.ribbonControl1.SelectedPage = page;
                }
            }
        }
Ejemplo n.º 5
0
 private void FormActivited(frmBaseQueryForm form)
 {
     SetQueryFormRefreshState(form);
     SetQueryOperateRibbonUI(form);
 }
Ejemplo n.º 6
0
        private void frmMain_MdiChildActivate(object sender, EventArgs e)
        {
            frmBaseQueryForm form = this.ActiveMdiChild as frmBaseQueryForm;

            FormActivited(form);
        }
Ejemplo n.º 7
0
        private void RibbonButtonClick(object sender, ItemClickEventArgs e)
        {
            frmBaseQueryForm form = this.ActiveMdiChild as frmBaseQueryForm;

            form.OperateHandled(e.Item.Tag as ModelOperate);
        }