コード例 #1
0
 public NavBarGroupTagObject(string name, Type moduleType, RibbonControlColorScheme ribbonScheme)
 {
     this.name         = name;
     this.moduleType   = moduleType;
     this.ribbonScheme = ribbonScheme;
     module            = null;
 }
コード例 #2
0
 internal void OnModuleShown(BaseModule baseModule)
 {
     rpgPrint.Visible = CurrentPrintableComponent != null;
 }
コード例 #3
0
ファイル: Controls.cs プロジェクト: angelkmike/NewOffice
        public void ChangeSelectedItem(NavBarItemLink link, object moduleData)
        {
            bool allowSetVisiblePage         = true;
            NavBarGroupTagObject groupObject = link.Item.Tag as NavBarGroupTagObject;

            if (groupObject == null)
            {
                return;
            }
            List <RibbonPage> deferredPagesToShow = new List <RibbonPage>();

            foreach (RibbonPage page in ribbon.Pages)
            {
                if (!string.IsNullOrEmpty(string.Format("{0}", page.Tag)))
                {
                    bool isPageVisible = groupObject.Name.Equals(page.Tag);
                    if (isPageVisible != page.Visible && isPageVisible)
                    {
                        deferredPagesToShow.Add(page);
                    }
                    else
                    {
                        page.Visible = isPageVisible;
                    }
                }
                if (page.Visible && allowSetVisiblePage)
                {
                    //page.Text = "Home";
                    ribbon.SelectedPage = page;
                    allowSetVisiblePage = false;
                }
            }
            bool firstShow = groupObject.Module == null;

            if (firstShow)
            {
                if (SplashScreenManager.Default == null)
                {
                    SplashScreenManager.ShowForm(ribbon.FindForm(), typeof(DevExpress.ProductsDemo.Win.Forms.wfMain), false, true);
                }
                ConstructorInfo constructorInfoObj = groupObject.ModuleType.GetConstructor(Type.EmptyTypes);
                if (constructorInfoObj != null)
                {
                    try {
                        groupObject.Module = constructorInfoObj.Invoke(null) as BaseModule;
                        groupObject.Module.InitModule(ribbon, moduleData);
                        _currentModuleName = link.Caption;
                    } catch (Exception e) {
                        var    entryAsm = Assembly.GetEntryAssembly();
                        string msg      = string.Format("Error on Showing Module: {0}\r\nPrevModule: {1}\r\nStartUp: {2}",
                                                        link.Caption, _currentModuleName, (entryAsm != null ? entryAsm.Location : string.Empty));
                        throw new ApplicationException(msg, e);
                    }
                }
                if (SplashScreenManager.Default != null)
                {
                    Form frm = moduleData as Form;
                    if (frm != null)
                    {
                        if (SplashScreenManager.FormInPendingState)
                        {
                            SplashScreenManager.CloseForm();
                        }
                        else
                        {
                            SplashScreenManager.CloseForm(false, 500, frm);
                        }
                    }
                    else
                    {
                        SplashScreenManager.CloseForm();
                    }
                }
            }
            ribbon.ColorScheme = groupObject.RibbonScheme;
            foreach (RibbonPage page in deferredPagesToShow)
            {
                page.Visible = true;
            }
            foreach (RibbonPage page in ribbon.Pages)
            {
                if (page.Visible)
                {
                    ribbon.SelectedPage = page;
                    break;
                }
            }

            if (groupObject.Module != null)
            {
                if (panel.Controls.Count > 0)
                {
                    BaseModule currentModule = panel.Controls[0] as BaseModule;
                    if (currentModule != null)
                    {
                        currentModule.HideModule();
                    }
                }
                panel.Controls.Clear();
                panel.Controls.Add(groupObject.Module);
                groupObject.Module.Dock = DockStyle.Fill;
                groupObject.Module.ShowModule(firstShow);
            }
        }
コード例 #4
0
ファイル: Controls.cs プロジェクト: shine8319/DLS
 public NavBarGroupTagObject(string name, Type moduleType)
 {
     this.name       = name;
     this.moduleType = moduleType;
     module          = null;
 }
コード例 #5
0
ファイル: Controls.cs プロジェクト: shine8319/DLS
        public void ChangeSelectedItem(NavBarItemLink link, object moduleData)
        {
            bool allowSetVisiblePage         = true;
            NavBarGroupTagObject groupObject = link.Item.Tag as NavBarGroupTagObject;

            if (groupObject == null)
            {
                return;
            }
            List <RibbonPage> deferredPagesToShow = new List <RibbonPage>();

            foreach (RibbonPage page in ribbon.Pages)
            {
                if (!string.IsNullOrEmpty(string.Format("{0}", page.Tag)))
                {
                    bool isPageVisible = groupObject.Name.Equals(page.Tag);
                    if (isPageVisible != page.Visible && isPageVisible)
                    {
                        deferredPagesToShow.Add(page);
                    }
                    else
                    {
                        page.Visible = isPageVisible;
                    }
                }
                if (page.Visible && allowSetVisiblePage)
                {
                    //page.Text = "Home";
                    ribbon.SelectedPage = page;
                    allowSetVisiblePage = false;
                }
            }
            bool firstShow = groupObject.Module == null;

            if (firstShow)
            {
                if (SplashScreenManager.Default == null)
                {
                    SplashScreenManager.ShowForm(ribbon.FindForm(), typeof(wfMain), false, true);
                }
                ConstructorInfo constructorInfoObj = groupObject.ModuleType.GetConstructor(Type.EmptyTypes);
                if (constructorInfoObj != null)
                {
                    groupObject.Module = constructorInfoObj.Invoke(null) as BaseModule;
                    groupObject.Module.InitModule(ribbon, moduleData);
                }
                if (SplashScreenManager.Default != null)
                {
                    Form frm = moduleData as Form;
                    if (frm != null)
                    {
                        if (SplashScreenManager.FormInPendingState)
                        {
                            SplashScreenManager.CloseForm();
                        }
                        else
                        {
                            SplashScreenManager.CloseForm(false, 500, frm);
                        }
                    }
                    else
                    {
                        SplashScreenManager.CloseForm();
                    }
                }
            }

            foreach (RibbonPage page in deferredPagesToShow)
            {
                page.Visible = true;
            }
            foreach (RibbonPage page in ribbon.Pages)
            {
                if (page.Visible)
                {
                    ribbon.SelectedPage = page;
                    break;
                }
            }

            if (groupObject.Module != null)
            {
                if (panel.Controls.Count > 0)
                {
                    BaseModule currentModule = panel.Controls[0] as BaseModule;
                    if (currentModule != null)
                    {
                        currentModule.HideModule();
                    }
                }
                panel.Controls.Clear();
                panel.Controls.Add(groupObject.Module);
                groupObject.Module.Dock = DockStyle.Fill;
                groupObject.Module.ShowModule(firstShow);
            }
        }