예제 #1
0
        private void createMenuItems(BarSubItem barSubItem, string strMenu)
        {
            BarManager barManager1 = ((IMainForm)this.mainForm).GetBarManager();

            if (ds.Tables[0].Select("Parents='" + strMenu + "'").Length > 0)
            {
                BarSubItem subItem = new BarSubItem();
                subItem.Caption = getName(strMenu);
                subItem.Enabled = getEnable(strMenu);
                barSubItem.LinksPersistInfo.Add(new LinkPersistInfo(subItem, getSep(strMenu)));
                barManager1.Items.Add(subItem);
                foreach (DataRow drTemp1 in ds.Tables[0].Select("Parents='" + strMenu + "'"))
                {
                    createMenuItems(subItem, drTemp1[0].ToString());
                }
            }
            else
            {
                BarButtonItem staticItem = new BarButtonItem();
                staticItem.Name = strMenu;
                staticItem.Caption = getName(strMenu);
                staticItem.Enabled = getEnable(strMenu);
                staticItem.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                try{
                    Image image = ResourceMan.getImage16(getImageName(strMenu));
                    staticItem.Glyph = image;
                }
                catch{ }

                staticItem.ItemClick += new ItemClickEventHandler(itemClick);
                barSubItem.LinksPersistInfo.Add(new LinkPersistInfo(staticItem, base.getSep(strMenu)));
                barManager1.Items.Add(staticItem);
            }
        }
예제 #2
0
        void CreatePrintAndExportToMenu()
        {
            BarItem miExportToPdf = new ButtonBarItem(this.barManager1, "Export to PDF", new ItemClickEventHandler(miExportToPdf_Click));
            BarItem miExportToHtml = new ButtonBarItem(this.barManager1, "Export to HTML", new ItemClickEventHandler(miExportToHtml_Click));
            BarItem miExportToMht = new ButtonBarItem(this.barManager1, "Export to MHT", new ItemClickEventHandler(miExportToMht_Click));
            BarItem miExportToXls = new ButtonBarItem(this.barManager1, "Export to XLS", new ItemClickEventHandler(miExportToXls_Click));
            BarItem miPrintPreview = new ButtonBarItem(this.barManager1, "Print Preview", new ItemClickEventHandler(miPrintPreview_Click));

            BarSubItem miExportToImage = new BarSubItem(this.barManager1, "Export to Image");
            AddImageFormat(miExportToImage, ImageFormat.Bmp);
            AddImageFormat(miExportToImage, ImageFormat.Emf);
            AddImageFormat(miExportToImage, ImageFormat.Exif);
            AddImageFormat(miExportToImage, ImageFormat.Gif);
            AddImageFormat(miExportToImage, ImageFormat.Icon);
            AddImageFormat(miExportToImage, ImageFormat.Jpeg);
            AddImageFormat(miExportToImage, ImageFormat.Png);
            AddImageFormat(miExportToImage, ImageFormat.Tiff);
            AddImageFormat(miExportToImage, ImageFormat.Wmf);

            miPrintAndExport = new BarSubItem(this.barManager1, "&Print and Export");
            miPrintAndExport.ItemLinks.AddRange(new BarItem[] {
																  miExportToPdf,
																  miExportToHtml,
																  miExportToMht,
																  miExportToXls,
																  miExportToImage
															  });
            miPrintAndExport.ItemLinks.Add(miPrintPreview).BeginGroup = true;
        }
        /// <summary>
        /// 构建插件单元
        /// </summary>
        /// <param name="caller">调用者</param>
        /// <param name="context">上下文,用于存放在构建时需要的组件</param>
        /// <param name="element">插件单元</param>
        /// <param name="subItems">被构建的子对象列表</param>
        /// <returns>构建好的插件单元</returns>
        public object BuildItem(object caller, WorkItem context, AddInElement element, ArrayList subItems)
        {
            IContentMenuService cmbService = context.Services.Get<IContentMenuService>();
            if (cmbService == null)
                throw new UniframeworkException(String.Format("未注册IContentMenuBarService无法创建上下文菜单 \"{0}\"。", element.Name));

            BarSubItem item = new BarSubItem();
            item.Name = element.Name;
            item.Tag = element.Path;
            item.Manager = BuilderUtility.GetBarManager(context); // 设置工具栏管理器
            string exPath = BuilderUtility.CombinPath(element.Path, element.Id);
            cmbService.RegisterContentMenu(exPath, item);

            // 添加插件单元到系统中
            if (!String.IsNullOrEmpty(element.Path) && context.UIExtensionSites.Contains(element.Path))
                context.UIExtensionSites[element.Path].Add(item);
            if (!String.IsNullOrEmpty(element.Command))
            {
                Command cmd = BuilderUtility.GetCommand(context, element.Command);
                if (cmd != null)
                    cmd.AddInvoker(item, "Popup");
            }

            context.UIExtensionSites.RegisterSite(exPath, item);
            return item;
        }
예제 #4
0
        public BarLookAndFeelListItem(UserLookAndFeel lookAndFeel)
        {
            this.lookAndFeel = lookAndFeel;

            skinSubMenuItem = new BarSubItem();
            skinSubMenuItem.Caption = "Skin";
        }
예제 #5
0
        private void createChildItem(BarItem itemParent,string itemId)
        {
            BarSubItem parentBar = (BarSubItem)itemParent;
            if (ds.Tables[0].Select("Parents='" + itemId + "'").Length > 0)
            {
                BarSubItem subItem = new BarSubItem();
                subItem.Id = frmRibbonMain.IIII++;
                subItem.Caption = getName(itemId);
                subItem.RibbonStyle = RibbonItemStyles.Default;
                subItem.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                //subItem.Glyph = ResourceMan.getImage16(getImageName(itemId));
                try
                {
                    Image image = this.getImage16(itemId);
                    subItem.Glyph = image;
                }
                catch { }
                subItem.ItemClick += new ItemClickEventHandler(itemClick);
                parentBar.ItemLinks.Add(subItem);
                {
                    CreateToolTip(subItem, getToolTip(itemId));
                }
                //parentBar.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(subItem) });
                foreach (DataRow dr in ds.Tables[0].Select("Parents='" + itemId + "'"))
                {
                    string childId = dr[0] as string;
                    createChildItem(subItem, childId);
                }
            }
            else
            {
                BarButtonItem buttonItem = new BarButtonItem();
                buttonItem.Id = frmRibbonMain.IIII++;
                buttonItem.Name = itemId;
                buttonItem.Caption = getName(itemId);
                buttonItem.RibbonStyle = RibbonItemStyles.Default;
                buttonItem.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                try
                {
                    Image image = this.getImage16(itemId);
                    buttonItem.Glyph = image;
                    //buttonItem.Glyph = ResourceMan.getImage16(getImageName(itemId));
                }
                catch { }
                buttonItem.ItemClick+= new ItemClickEventHandler(itemClick);
                parentBar.ItemLinks.Add(buttonItem);
                if (getToolTip(itemId) != "")
                {
                    CreateToolTip(buttonItem, getToolTip(itemId));
                }
                //parentBar.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[]{new DevExpress.XtraBars.LinkPersistInfo(buttonItem)});

            }
        }
예제 #6
0
        private void createChildItem(BarItem itemParent, string parentItemID)
        {
            BarSubItem subItemParent = (BarSubItem)itemParent;
            if (ds.Tables[0].Select("Parents='" + parentItemID + "'").Length > 0)
            {
                BarSubItem barSubItem = new BarSubItem();
                barSubItem.Id = frmRibbonMain.IIII++;
                barSubItem.Caption = parentItemID;
                barSubItem.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                barSubItem.RibbonStyle = RibbonItemStyles.Default;
                barSubItem.Enabled = getEnable(parentItemID);
                subItemParent.ItemLinks.Add(barSubItem);
                try
                {
                    Image image = getImage48(parentItemID);
                    barSubItem.Glyph = image;
                }
                catch { }
                if (getToolTip(parentItemID) != "")
                {
                    CreateToolTip(barSubItem, getToolTip(parentItemID));
                }
                foreach (DataRow dr in ds.Tables[0].Select("Parents='" + parentItemID + "'"))
                {
                    createChildItem(barSubItem, dr[0].ToString());
                }

            }
            else
            {
                BarButtonItem barButtonItem = new BarButtonItem();
                barButtonItem.Id = frmRibbonMain.IIII++;
                barButtonItem.Name = parentItemID;
                barButtonItem.Caption = getName(parentItemID);
                barButtonItem.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                barButtonItem.RibbonStyle = RibbonItemStyles.Large;
                barButtonItem.Enabled = getEnable(parentItemID);
                //subItemParent.LinksPersistInfo.AddRange(new LinkPersistInfo[] { new LinkPersistInfo(barButtonItem, true) });
                subItemParent.ItemLinks.Add(barButtonItem, getSep(parentItemID));
                if (getToolTip(parentItemID) != "")
                {
                    CreateToolTip(barButtonItem, getToolTip(parentItemID));
                }
                try
                {
                    Image image = getImage48(parentItemID);
                    barButtonItem.Glyph = image;
                }
                catch { }
                barButtonItem.ItemClick += new ItemClickEventHandler(itemClick);
            }
        }
예제 #7
0
        /// <summary>
        /// 加载皮肤列表
        /// </summary>
        public static void LoadSkinList(BarSubItem owner)
        {
            _CurrentSkinList = owner;

            foreach (DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins)
            {
                BarCheckItem item = new BarCheckItem(owner.Manager);
                item.Caption = skin.SkinName;
                item.Checked = skin.SkinName == SystemConfig.CurrentConfig.SkinName;
                item.ItemClick += new ItemClickEventHandler(OnSetSkinClick);
                owner.ItemLinks.Add(item);
            }
        }
예제 #8
0
        /// <summary>
        /// Adds all menu items.
        /// </summary>
        private void AddAllMenuItems()
        {
            bbiTabbed = AddBarItem("选项卡式窗口布局(&T)", null, null, utility.MdiChangeMode, false);
            bbiTabbed.ButtonStyle = BarButtonStyle.Check;

            bbiCascade = AddBarItem("层叠(&C)", Resource.windows, null, utility.MdiLayoutCascade, true);
            bbiHorizontal =  AddBarItem("水表排列(&H)", Resource.window_split_hor, null, utility.MdiLayoutTileHorizontal, false);
            bbiVertical = AddBarItem("垂直排列(&V)", Resource.window_split_ver, null, utility.MdiLayoutTileVertical, false);

            BarSubItem bsiWindows = new BarSubItem(Manager, "所有窗口(&W)");
            BarItemLink link = AddItem(bsiWindows);
            link.BeginGroup = true;
            bsiWindows.AddItem(new BarMdiChildrenListItem());
        }
예제 #9
0
        public frmMain2() {
            InitializeComponent();

            //ucModulBar1.RefreshData("");
            ucModulBar1.PlatForm = this;
            iPaintStyle = new BarSubItem(barManager1, "皮肤");
            //InitMenu("");
            InitSkins();

            helpitem = new BarButtonItem(barManager1, "帮助");
            InitHelp();
            if(MainHelper.User.UserName!="rabbit")
            dockPanel1.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
            Text += string.Format("-{0}生产管理系统",MainHelper.UserCompany);
        }
예제 #10
0
 public ExportMovieList(List<MovieTreeList> source)
 {
     InitializeComponent(); 
     var templates = Exporting.GetExportTemplates("movie");
     if (templates.Count > 0)
     {
         var submenu = new BarSubItem(this.barManager1, "Templates");
         foreach (var template in templates)
         {
             var menu = new BarButtonItem(this.barManager1, template.name);
             menu.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.popupMenuExportTo_ItemClick);
             submenu.AddItem(menu);
         }
         this.popupMenuExportTo.AddItem(submenu);
     }
     this.treeList1.DataSource = source;
     this.Text = string.Format("Movie List ({0})", source.Count);
 }
        private void LoadMenuItems(IEnumerable<MenuViewModel> menuItems)
        {
            foreach (var menuItem in menuItems)
            {
                // top-most menuStrip
                var toolStripItem = new BarSubItem(barManager1, menuItem.Text);

                // left-side navControl
                var navGroup = navBarControl.Groups.Add();
                navGroup.Caption = menuItem.Text;
                navGroup.Name = "navGroup" + menuItem.URL;
                navGroup.SmallImage = Helpers.ViewHelper.LoadImageFromResource(menuItem.Icon);
                navGroup.LargeImage = Helpers.ViewHelper.LoadImageFromResource(menuItem.Icon);
                foreach (var subMenu in menuItem.SubMenus)
                {
                    // top-most menuStrip
                    var subToolStripMenu = new BarButtonItem(barManager1, subMenu.Text);
                    subToolStripMenu.ItemClick += new ItemClickEventHandler(subToolStripMenu_ItemClick);
                        ;// new EventHandler(commonHandler  );
                    subToolStripMenu.Tag = subMenu.URL;
                    // left-side navigation
                    var navLink = navBarControl.Items.Add();
                    navLink.Caption = subMenu.Text;
                    navLink.Name = "navLink" + subMenu.URL;
                    navLink.LargeImage = Helpers.ViewHelper.LoadImageFromResource(subMenu.Icon);
                    navLink.SmallImage = Helpers.ViewHelper.LoadImageFromResource(subMenu.Icon);
                    navLink.Tag = subMenu.URL;
                    navLink.LinkClicked += new NavBarLinkEventHandler(commonEventHandler);
                    if (subMenu.URL == "UM-MA-LO-FR") //Special Handler for logout
                    {
                        navLink.LinkClicked -= new NavBarLinkEventHandler(commonEventHandler);
                        navLink.LinkClicked += new NavBarLinkEventHandler(logOutEventHandler);

                    }
                    navGroup.ItemLinks.Add(navLink);
                    toolStripItem.AddItem(subToolStripMenu);
                }
                menuBar.AddItem(toolStripItem);
            }
        }
예제 #12
0
 /// <summary>Gắn menu chọn Skin vào trong Ribbon Button QuickSet
 /// </summary>
 public static void AddSkinMenuToQuickShortcut(RibbonControl ribbonControl, DevExpress.LookAndFeel.DefaultLookAndFeel defaultLookAndFeel)
 {
     BarSubItem iPaintStyle = new BarSubItem();
     iPaintStyle.Id = frmRibbonMain.IIII++;
     iPaintStyle.Caption = "Paint style";
     iPaintStyle.Description = "Chọn skin cho giao diện";
     iPaintStyle.Hint = "Chọn skin cho giao diện";
     iPaintStyle.Name = "iPaintStyle";
     foreach (DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins)
     {
         BarCheckItem item = ribbonControl.Items.CreateCheckItem(skin.SkinName, false);
         item.Id = frmRibbonMain.IIII++;
         item.Tag = skin.SkinName;
         item.ItemClick += delegate(object sender, ItemClickEventArgs e)
         {
             if(FrameworkParams.currentSkin!=null){
                 for (int i = 0; i < FrameworkParams.currentSkin.arrSkinName.Length; i++)
                 {
                     if (FrameworkParams.currentSkin.arrSkinName[i].ToString() == e.Item.Tag.ToString())
                     {
                         FrameworkParams.option.Skin = "" + i;
                         FrameworkParams.option.update();
                         break;
                     }
                 }
             }
             defaultLookAndFeel.LookAndFeel.SetSkinStyle(e.Item.Tag.ToString());
         };
         iPaintStyle.ItemLinks.Add(item);
     }
     iPaintStyle.Popup += delegate(object sender, System.EventArgs e)
     {
         foreach (BarItemLink link in iPaintStyle.ItemLinks)
             ((BarCheckItem)link.Item).Checked = link.Item.Caption == defaultLookAndFeel.LookAndFeel.ActiveSkinName;
     };
     ribbonControl.Toolbar.ItemLinks.Add(iPaintStyle);
 }
예제 #13
0
 /// <summary>
 /// 将菜单项转换为BarButtonItem对象
 /// </summary>
 /// <param name="owner">按钮的父级拥有者</param>
 /// <param name="item">当前菜单项,每个菜单项对应一个BarButtonItem对象</param>
 private void LoadBarButtonItem(BarSubItem owner, ToolStripItem item)
 {
     BarButtonItem button = new BarButtonItem();
     button.Caption = item.Text;
     button.Tag = item;
     button.ItemClick += new ItemClickEventHandler(OnBarButtonItemClick);
     owner.ItemLinks.Add(button);
 }
예제 #14
0
        private BarItem CreateButton(string extPath, string id, string text, string command, bool regisger)
        {
            BarItem item = null;
            if (regisger)
            {
                item = new BarSubItem();
                WorkItem.UIExtensionSites.RegisterSite(BuilderUtility.CombinPath(extPath, id), item);
            }
            else
                item = new BarButtonItem();
            item.Name = id;
            item.Caption = text;
            item.Hint = text;
            Command cmd = BuilderUtility.GetCommand(WorkItem, command);
            if (cmd != null)
                cmd.AddInvoker(item, "ItemClick");

            return item;
        }
예제 #15
0
        /// <summary>
        /// 跟据菜单创建Bar按钮
        /// </summary>
        /// <param name="menuBar">Bar按钮</param>
        /// <param name="mainMenu">主菜单(各模块主菜单的组合)</param>
        public void CreateToolButtons(Bar menuBar, ToolStrip moduleMainMenu)
        {
            foreach (ToolStripMenuItem moduleTopMenu in moduleMainMenu.Items)
            {
                if (!moduleTopMenu.Enabled) continue;//菜单是禁止使用状态表示无权限

                //模块主菜单名称(一级菜单)
                BarSubItem menuOwner = new BarSubItem(menuBar.Manager, moduleTopMenu.Text);
                menuOwner.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                menuOwner.Glyph = moduleTopMenu.Image;
                menuOwner.Tag = moduleTopMenu;
                menuOwner.ItemClick += new ItemClickEventHandler(menuOwner_ItemClick);
                menuBar.ItemLinks.Add(menuOwner);

                //递归加载
                foreach (ToolStripItem item in moduleTopMenu.DropDownItems)
                {
                    if (item is ToolStripSeparator) continue;
                    if (!item.Enabled) continue;//菜单是禁止使用状态,无权限

                    if (item is ToolStripMenuItem && (item as ToolStripMenuItem).DropDownItems.Count > 0)
                    {
                        BarSubItem itemOwner = new BarSubItem(menuBar.Manager, item.Text);
                        menuOwner.ItemLinks.Add(itemOwner);
                        this.LoadBarSubItems(itemOwner, item as ToolStripMenuItem);
                    }
                    else
                    {
                        this.LoadBarButtonItem(menuOwner, item);
                    }
                }
            }
        }
        public void FormContextMenu(CommonBarItemCollection menuItems)
        {
            menuItems.Clear();

            var createCommentCommand = new DelegateCommand(() =>
            {
                var dlgModel = new CreateCommentDlgViewModel(_particlesManager, _blockManager, _commentManager, _eventAggregator);
                SetParticleIfExist(dlgModel.AddParticleVm);

                var dlg = new CreateCommentDlg(dlgModel);
                var res = dlg.ShowDialog();
                if (res.HasValue && res.Value)
                    UpdateBookmarks();

            });
            var createIdeaCommand = new DelegateCommand(() =>
            {
                var dlgModel = new CreateIdeaDlgViewModel(_tagsManager, _particlesManager, _ideaManager, _blockManager,
                    _eventAggregator);
                SetParticleIfExist(dlgModel.AddParticleVm);

                var dlg = new CreateIdeaDlg(dlgModel);
                var res = dlg.ShowDialog();
                if (res.HasValue && res.Value)
                    UpdateBookmarks();
            });

            var addToCommentCommand = new DelegateCommand(() =>
            {
                var dlgModel = new AddParticleDlgViewModel(_particlesManager, typeof(Entity.Comment), _blockManager);
                SetParticleIfExist(dlgModel.AddParticleVm);

                var dlg = new AddParticleDlg(dlgModel);
                var res = dlg.ShowDialog();
                if (res.HasValue && res.Value)
                    UpdateBookmarks();
            });

            var addToIdeaCommand = new DelegateCommand(() =>
            {
                var dlgModel = new AddParticleDlgViewModel(_particlesManager, typeof(Idea), _blockManager);
                SetParticleIfExist(dlgModel.AddParticleVm);

                var dlg = new AddParticleDlg(dlgModel);
                var res = dlg.ShowDialog();
                if (res.HasValue && res.Value)
                    UpdateBookmarks();
            });

            var createRelationCommand = new DelegateCommand(() =>
            {
                var dlgModel = new CreateRelationDlgViewModel(_particlesManager, _ideaManager, _relationManager, _blockManager, _eventAggregator);
                SetParticleIfExist(dlgModel.AddParticleVm);

                var dlg = new CreateRelationDlg(dlgModel);
                var res = dlg.ShowDialog();
                if (res.HasValue && res.Value)
                    UpdateBookmarks();
            });

            var createMenu = new BarSubItem() {Content = "Создать..."};
            var createComment = new BarButtonItem() {Content = "Комментарий", Command = createCommentCommand};
            var createIdea = new BarButtonItem() {Content = "Понятие", Command = createIdeaCommand};
            var createRelation = new BarButtonItem() {Content = "Отношение", Command = createRelationCommand};
            createMenu.Items.Add(createComment);
            createMenu.Items.Add(createIdea);
            createMenu.Items.Add(createRelation);

            var addMenu = new BarSubItem() { Content = "Добавить в..." };
            var addComment = new BarButtonItem() {Content = "Комментарий", Command = addToCommentCommand};
            var addIdea = new BarButtonItem() { Content = "Понятие", Command = addToIdeaCommand};
            var addRelation = new BarButtonItem() { Content = "Отношение" };
            addMenu.Items.Add(addComment);
            addMenu.Items.Add(addIdea);
            addMenu.Items.Add(addRelation);

            menuItems.Add(createMenu);
            menuItems.Add(addMenu);

            /*if (MyDocument != null)
            {
                foreach (var bm in MyDocument.Bookmarks)
                {
                    var nextBookmark = new BarButtonItem()
                    {
                        Content = bm.Name,
                        CommandParameter = MyDocument,
                        Command = new DelegateCommand<Document>(document =>
                        {
                            document.Bookmarks.Select(bm);
                        })
                    };
                    menuItems.Add(nextBookmark);
                }
            }*/
        }
예제 #17
0
        public static BarSubItem XuatRaFile(BarManager barMan, GridView gridView)
        {
            BarSubItem xuatRaFile = new BarSubItem(barMan, "Xuất ra file");
            xuatRaFile.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph;
            xuatRaFile.Glyph = FWImageDic.EXPORT_TO_FILE_IMAGE20;

            if (barMan.Bars[0].LinksPersistInfo.Count - 3 >= 0)
                barMan.Bars[0].LinksPersistInfo.Insert(barMan.Bars[0].LinksPersistInfo.Count - 3, new LinkPersistInfo(xuatRaFile, true));
            else
                barMan.Bars[0].LinksPersistInfo.Add(new LinkPersistInfo(xuatRaFile, true));

            BarButtonItem itemXuatRaExcel2007 = new BarButtonItem(barMan, "Xuất ra file Excel 2007");
            itemXuatRaExcel2007.PaintStyle = BarItemPaintStyle.CaptionGlyph;
            itemXuatRaExcel2007.ItemClick += delegate(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
            {
                HelpGrid.exportFile(gridView, "xlsx");
            };
            xuatRaFile.LinksPersistInfo.Add(new LinkPersistInfo(itemXuatRaExcel2007));

            BarButtonItem itemXuatRaExcel2003 = new BarButtonItem(barMan, "Xuất ra file Excel 97 - 2003");
            itemXuatRaExcel2003.PaintStyle = BarItemPaintStyle.CaptionGlyph;
            itemXuatRaExcel2003.ItemClick += delegate(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
            {
                HelpGrid.exportFile(gridView, "xls");
            };
            xuatRaFile.LinksPersistInfo.Add(new LinkPersistInfo(itemXuatRaExcel2003));

            BarButtonItem itemXuatRaPDF = new BarButtonItem(barMan, "Xuất ra file PDF");
            itemXuatRaPDF.PaintStyle = BarItemPaintStyle.CaptionGlyph;
            itemXuatRaPDF.ItemClick += delegate(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
            {
                HelpGrid.exportFile(gridView, "pdf");
            };
            xuatRaFile.LinksPersistInfo.Add(new LinkPersistInfo(itemXuatRaPDF));

            BarButtonItem itemXuatRaHTML = new BarButtonItem(barMan, "Xuất ra file HTML");
            itemXuatRaHTML.PaintStyle = BarItemPaintStyle.CaptionGlyph;
            itemXuatRaHTML.ItemClick += delegate(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
            {
                HelpGrid.exportFile(gridView, "htm");
            };
            xuatRaFile.LinksPersistInfo.Add(new LinkPersistInfo(itemXuatRaHTML));

            BarButtonItem itemXuatRaRTF = new BarButtonItem(barMan, "Xuất ra file RTF");
            itemXuatRaRTF.PaintStyle = BarItemPaintStyle.CaptionGlyph;
            itemXuatRaRTF.ItemClick += delegate(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
            {
                HelpGrid.exportFile(gridView, "rtf");
            };
            xuatRaFile.LinksPersistInfo.Add(new LinkPersistInfo(itemXuatRaRTF));

            return xuatRaFile;
        }
예제 #18
0
        private void AddCustomContainer(string ContainerId, string BarName, ActionContainersManager FormContainerManager, BarManager FormBarManager)
        {
            BarSubItem MenuBarItem = new BarSubItem
            {
                Manager = FormBarManager,
                Name = BarName,//CustomToolBarConst.MainNavigationObjectsMenuBarName,
                //Id = manager.GetNewItemId()
            };

            ActionContainerMenuBarItem ActionContainerMenu = new ActionContainerMenuBarItem()
            {
                ContainerId = ContainerId
            };

            MenuBarItem.AddItem(ActionContainerMenu);

            // без добавления в ActionContainersManager не работает !!!
            FormContainerManager.ActionContainerComponents.Add(ActionContainerMenu);
        }
예제 #19
0
        private void InitRowMenu(int handel, DataRow rowHandel)
        {
            barManager1.RepositoryItems.Clear();
            barManager1.Items.Clear();
            popupMenu1.ItemLinks.Clear();

            DataRow cr = gridViewDetail.GetDataRow(handel);

            var itemCopy = new BarButtonItem(barManager1, "Sao chép dòng này")
                               {
                                   Glyph = HelpImage.getImage2020("copy.png"),
                                   ItemShortcut = new BarShortcut(Shortcut.CtrlC)
                               }; //, -1, new BarShortcut(Shortcut.CtrlC));
            var itemCut = new BarButtonItem(barManager1, "Cắt dòng này")
                              {
                                  Glyph = HelpImage.getImage2020("cut.png"),
                                  ItemShortcut = new BarShortcut(Shortcut.CtrlX)
                              };
            var itemPaste = new BarButtonItem(barManager1, "Dán tại dòng này")
                                {
                                    Glyph = HelpImage.getImage2020("paste.png"),
                                    ItemShortcut = new BarShortcut(Shortcut.CtrlV)
                                };
            var itemDelete = new BarButtonItem(barManager1, "Xóa dòng này")
                                 {
                                     Glyph = HelpImage.getImage2020("delete.png"),
                                     ItemShortcut = new BarShortcut(Shortcut.CtrlDel)
                                 };
            var itemDeleteAll = new BarButtonItem(barManager1, "Xóa cả vệt giờ này")
                                    {
                                        Glyph = HelpImage.getImage2020("deleteall.png"),
                                        ItemShortcut = new BarShortcut(Shortcut.ShiftDel)
                                    };
            var itemCopyTo = new BarSubItem(barManager1, "Sao chép dòng này đến") { Glyph = HelpImage.getImage2020("copyto.png") };
            var itemMoveTo = new BarSubItem(barManager1, "Di chuyển dòng này đến") { Glyph = HelpImage.getImage2020("moveto.png") };
            var itemCopyAllTo = new BarSubItem(barManager1,
                                               "Sao chép cả vệt " +
                                               ((DateTime)cr[KE_HOACH_LPS_CT.GIO_PHAT_SONG]).ToString("HH:mm") + " đến")
                                    {
                                        Glyph = HelpImage.getImage2020("copyallto.png")

                                    };
            var itemMoveAllTo = new BarSubItem(barManager1,
                                               "Di chuyển cả vệt " +
                                               ((DateTime)cr[KE_HOACH_LPS_CT.GIO_PHAT_SONG]).ToString("HH:mm") + " đến")
                                    {
                                        Glyph = HelpImage.getImage2020("moveallto.png")

                                    };
            var itemOpen = new BarButtonItem(barManager1, "Mở chương trình")
            {
                Glyph = FWImageDic.VIEW_IMAGE20,
                ItemShortcut = new BarShortcut(Shortcut.CtrlO)
            };
            var itemRefresh = new BarButtonItem(barManager1, "Làm mới")
            {
                Glyph = HelpImage.getImage2020("Restore.png"),
                ItemShortcut = new BarShortcut(Shortcut.F5)
            };
            var itemCopyClipboard = new BarButtonItem(barManager1, "Sao chép dòng này đến Clipboard")
                                        {

                                            Glyph = HelpImage.getImage2020("clipboard.png"),
                                            ItemShortcut = new BarShortcut(Shortcut.CtrlShiftC)
                                        };
            var itemCopyVetClipboard = new BarButtonItem(barManager1, "Sao chép cả vệt " +
                                                                      ((DateTime) cr[KE_HOACH_LPS_CT.GIO_PHAT_SONG]).
                                                                          ToString("HH:mm") + " đến Clipboard")
                                           {
                                               Glyph = HelpImage.getImage2020("clipboard.png"),
                                               ItemShortcut = new BarShortcut(Shortcut.CtrlShiftV)
                                           };
            var itemCopyAllClipboard = new BarButtonItem(barManager1, "Sao chép cả lưới đến Clipboard")
            {
                Glyph = HelpImage.getImage2020("clipboard.png"),
                ItemShortcut = new BarShortcut(Shortcut.CtrlShiftA)
            };

            //, -1, new BarShortcut(Shortcut.CtrlC));

            var timeEdit = new RepositoryItemTimeEdit();
            timeEdit.Mask.EditMask = "HH:mm";
            timeEdit.Mask.UseMaskAsDisplayFormat = true;

            var timeItem = new BarEditItem(barManager1, timeEdit) { PaintStyle = BarItemPaintStyle.Standard };

            itemCopyAllTo.AddItem(timeItem);
            itemCopyTo.AddItem(timeItem);
            itemMoveAllTo.AddItem(timeItem);
            itemMoveTo.AddItem(timeItem);

            timeItem.Width = 60;

            timeItem.Edit.DoubleClick += delegate
                                             {

                                                 BarItemLink link = barManager1.ActiveEditItemLink;
                                                 object obj = barManager1.ActiveEditor.EditValue;
                                                 if (obj == null || !(obj is DateTime)) return;
                                                 DataRow r = gridViewDetail.GetDataRow(handel);
                                                 var time = (DateTime)obj;
                                                 time = new DateTime(1900, 1, 1, time.Hour, time.Minute, 0);
                                                 if (link.OwnerItem == itemCopyTo)
                                                 {
                                                     CutCopyTo(r, time, true);
                                                 }
                                                 else if (link.OwnerItem == itemMoveTo)
                                                 {
                                                     CutCopyTo(r, time, false);
                                                 }
                                                 else if (link.OwnerItem == itemCopyAllTo)
                                                 {
                                                     CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time,
                                                                  true);
                                                 }
                                                 else if (link.OwnerItem == itemMoveAllTo)
                                                 {
                                                     CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time,
                                                                  false);
                                                 }
                                                 popupMenu1.HidePopup();

                                             };
            timeItem.ItemDoubleClick += delegate(object sender, ItemClickEventArgs e)
                                            {
                                                DataRow r = gridViewDetail.GetDataRow(handel);
                                                object obj = barManager1.ActiveEditor.EditValue;
                                                if (obj == null || !(obj is DateTime)) return;
                                                var time = (DateTime)obj;
                                                time = new DateTime(1900, 1, 1, time.Hour, time.Minute, 0);
                                                if (e.Link.OwnerItem == itemCopyTo)
                                                {
                                                    CutCopyTo(r, time, true);
                                                }
                                                else if (e.Link.OwnerItem == itemMoveTo)
                                                {
                                                    CutCopyTo(r, time, false);
                                                }
                                                else if (e.Link.OwnerItem == itemCopyAllTo)
                                                {
                                                    CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, true);
                                                }
                                                else if (e.Link.OwnerItem == itemMoveAllTo)
                                                {
                                                    CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time,
                                                                 false);
                                                }
                                                popupMenu1.HidePopup();
                                            };
            if (_dtGioPhat != null)
            {
                foreach (DataRow rTime in _dtGioPhat.Rows)
                {

                    if (rTime[KE_HOACH_LPS_CT.GIO_PHAT_SONG] is DBNull
                        || rTime[KE_HOACH_LPS_CT.GIO_PHAT_SONG].Equals(rowHandel[KE_HOACH_LPS_CT.GIO_PHAT_SONG]))
                        continue;
                    var time = (DateTime)rTime[KE_HOACH_LPS_CT.GIO_PHAT_SONG];
                    var item = new BarButtonItem(barManager1, time.ToString("HH:mm")) { PaintStyle = BarItemPaintStyle.Standard, Tag = time };
                    itemCopyAllTo.AddItem(item);
                    itemCopyTo.AddItem(item);
                    itemMoveAllTo.AddItem(item);
                    itemMoveTo.AddItem(item);
                    item.ItemClick += delegate(object sender, ItemClickEventArgs e)
                                          {
                                              DataRow r = gridViewDetail.GetDataRow(handel);
                                              if (e.Link.OwnerItem == itemCopyTo)
                                              {
                                                  CutCopyTo(r, time, true);
                                              }
                                              else if (e.Link.OwnerItem == itemMoveTo)
                                              {
                                                  CutCopyTo(r, time, false);
                                              }
                                              else if (e.Link.OwnerItem == itemCopyAllTo)
                                              {
                                                  CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, true);
                                              }
                                              else if (e.Link.OwnerItem == itemMoveAllTo)
                                              {
                                                  CutCopyAllTo((DateTime)r[KE_HOACH_LPS_CT.GIO_PHAT_SONG], time, false);
                                              }
                                          };

                }
            }
            // ReSharper disable ImplicitlyCapturedClosure
            itemCopy.ItemClick += (sender, e) =>
                                      {
                                          _rowCut = null;
                                          _rowCopy = gridViewDetail.GetDataRow(handel);
                                      };

            itemCut.ItemClick += (sender, args) =>
                                     {
                                         _rowCopy = null;
                                         _rowCut = gridViewDetail.GetDataRow(handel);
                                     };

            itemPaste.ItemClick += (sender, e) => Paste(handel);
            itemDelete.ItemClick += (sender, e) => DeleteRow(handel);
            itemDeleteAll.ItemClick += (sender, e) => DeleteVetGio(handel);
            itemRefresh.ItemClick += (sender, e) =>
                                         {
                                             gridViewDetail.RefreshData();
                                             gridViewDetail.UpdateGroupSummary();
                                         };
            itemOpen.ItemClick += (sender, e) =>
                                      {
                                          long ctID = HelpNumber.ParseInt64(cr[KE_HOACH_LPS_CT.CT_ID]);
                                          if (
                                              ChuongTrinhPermission.I._CheckPerChuongTrinh(RES_PERMISSION_TYPE.READ,
                                                                                           ctID) == false)
                                          {
                                              HelpMsgBox.ShowNotificationMessage(
                                                  "Bạn không được phép xem chương trình này!");
                                              return;
                                          }
                                          var frm = new FrmChuongTrinh(ctID, null);
                                          HelpProtocolForm.ShowModalDialog(this, frm);
                                      };
            itemCopyClipboard.ItemClick += (sender, e) =>
                                               {
                                                   gridViewDetail.BeginSelection();
                                                   gridViewDetail.ClearSelection();
                                                   gridViewDetail.SelectRow(handel);
                                                   gridViewDetail.EndSelection();
                                                   gridViewDetail.CopyToClipboard();
                                               };
            itemCopyAllClipboard.ItemClick += (sender, e) => CopyClipboard(null);

             itemCopyVetClipboard.ItemClick += (sender, e) => CopyClipboard((DateTime)cr[KE_HOACH_LPS_CT.GIO_PHAT_SONG]);

            // ReSharper restore ImplicitlyCapturedClosure
            if (IsAdd == null)
            {
                popupMenu1.ItemLinks.AddRange(new BarItem[]
                                                  {
                                                      itemOpen,itemCopyClipboard,itemCopyVetClipboard,itemCopyAllClipboard, itemRefresh
                                                  });
                popupMenu1.ItemLinks[1].BeginGroup = true;
                popupMenu1.ItemLinks[4].BeginGroup = true;
            }
            else
            {

                popupMenu1.ItemLinks.AddRange(new BarItem[]
                                                  {
                                                      itemCopy, itemCut, itemPaste, itemDelete, itemDeleteAll,
                                                      itemCopyTo,
                                                      itemMoveTo, itemCopyAllTo, itemMoveAllTo, itemOpen,itemCopyClipboard,itemCopyVetClipboard,itemCopyAllClipboard, itemRefresh
                                                  });
                popupMenu1.ItemLinks[5].BeginGroup = true;
                popupMenu1.ItemLinks[7].BeginGroup = true;
                popupMenu1.ItemLinks[9].BeginGroup = true;
                popupMenu1.ItemLinks[10].BeginGroup = true;
                popupMenu1.ItemLinks[13].BeginGroup = true;
            }

            itemPaste.Enabled = _rowCopy != null || _rowCut != null;
        }
		public LibraryObjectNotesEditor(BarSubItem itemsContainer) : base(itemsContainer)
		{
			InitContextMenu();
		}
예제 #21
0
        private void CreateBarItem(object pGroup, XmlNode xmlNode)
        {
            if (xmlNode != null)
            {
                string itemTye    = GetXMLAttribute(xmlNode, "ItemType");
                string nodeKey    = GetXMLAttribute(xmlNode, "Key");
                string widthStr   = GetXMLAttribute(xmlNode, "Width");
                string subItemStr = GetXMLAttribute(xmlNode, "SubItems");
                if (itemTye.ToLower().Equals("buttongroup"))
                {
                    //表示下面还是组的形式,有子对象;
                    BarItem groupButton = CreateRibbonButtonGroup(pGroup as RibbonPageGroup, xmlNode);
                    if (!string.IsNullOrEmpty(widthStr))
                    {
                        groupButton.Width = Convert.ToInt32(widthStr);
                    }
                    return;
                }
                else if (!string.IsNullOrEmpty(subItemStr))
                {
                    BarSubItem barItem = _ribbonManager.Items[nodeKey] as BarSubItem;
                    if (barItem == null)
                    {
                        return;
                    }
                    if (!string.IsNullOrEmpty(subItemStr))
                    {
                        string[] subs = subItemStr.Split(';');
                        for (int i = 0; i < subs.Length; i++)
                        {
                            BarItem oneItem = _ribbonManager.Items[subs[i]];
                            if (oneItem == null)
                            {
                                continue;
                            }
                            barItem.LinksPersistInfo.Add(new LinkPersistInfo(oneItem));
                        }
                    }
                    if (pGroup is RibbonPageGroup)
                    {
                        ((pGroup) as RibbonPageGroup).ItemLinks.Add(barItem);
                    }
                    else if (pGroup is BarButtonGroup)
                    {
                        ((pGroup) as BarButtonGroup).ItemLinks.Add(barItem);
                    }
                }
                else
                {
                    //首先检查已有的对象里面是否存在该菜单
                    BarItem barItem = _ribbonManager.Items[nodeKey];
                    if (barItem == null)
                    {
                        return;
                    }

                    if (!string.IsNullOrEmpty(widthStr))
                    {
                        barItem.Width = Convert.ToInt32(widthStr);
                    }
                    if (barItem != null)
                    {
                        if (pGroup is RibbonPageGroup)
                        {
                            ((pGroup) as RibbonPageGroup).ItemLinks.Add(barItem);
                        }
                        else if (pGroup is BarButtonGroup)
                        {
                            ((pGroup) as BarButtonGroup).ItemLinks.Add(barItem);
                        }
                    }
                }
            }
            return;
        }
예제 #22
0
        void barManager_ItemClick(object sender, ItemClickEventArgs e)
        {
            BarSubItem subMenu = e.Item as BarSubItem;

            if (subMenu != null)
            {
                return;
            }

            TreeList tmpTl = null;

            if (e.Item.Caption.Equals("Save Orginal Bom as Excel ..."))
            {
                tmpTl = treeList1;
            }
            else if (e.Item.Caption.Equals("Save Filter Bom as Excel ..."))
            {
                tmpTl = treeList2;
            }
            else if (e.Item.Caption.Equals("Save All as Excel ..."))
            {
                // unfinished
            }
            else if (e.Item.Caption.Equals("ExpandAll"))
            {
                treeList1.ExpandAll();
                treeList2.ExpandAll();
                treeList3.ExpandAll();
                return;
            }
            else if (e.Item.Caption.Equals("CollapseAll"))
            {
                treeList1.CollapseAll();
                treeList2.CollapseAll();
                treeList3.CollapseAll();
                return;
            }


            // 往下跑, 目前只有存檔功能, 用tmpTreeList看有沒有指定來判斷
            if (tmpTl != null)
            {
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.Filter = "Excel 活頁簿 |*.xlsx";
                saveFileDialog1.Title  = "Save an Excel File";
                saveFileDialog1.ShowDialog();
                // If the file name is not an empty string open it for saving.
                if (saveFileDialog1.FileName == "")
                {
                    return;
                }
                string filePathAndName = saveFileDialog1.FileName;

                try
                {
                    tmpTl.ExportToXlsx(filePathAndName);
                }
                catch (System.IO.IOException)
                {
                    MessageBox.Show(string.Format("please close the file first, then do save excel again.{0}{1}", Environment.NewLine, filePathAndName));
                    return;
                }
                MessageBox.Show(string.Format("Save as path {0}{1}", Environment.NewLine, filePathAndName));
            }
        }
 private void InitializeComponent()
 {
     this.components = new Container();
     this.mainBarManager = new XafBarManager(this.components);
     this._mainMenuBar = new XafBar();
     this.barSubItemFile = new MainMenuItem();
     this.cObjectsCreation = new ActionContainerBarItem();
     this.cFile = new ActionContainerBarItem();
     this.cSave = new ActionContainerBarItem();
     this.cPrint = new ActionContainerBarItem();
     this.cExport = new ActionContainerBarItem();
     this.cExit = new ActionContainerBarItem();
     this.barSubItemEdit = new MainMenuItem();
     this.cUndoRedo = new ActionContainerBarItem();
     this.cEdit = new ActionContainerBarItem();
     this.cRecordEdit = new ActionContainerBarItem();
     this.cOpenObject = new ActionContainerBarItem();
     this.barSubItemView = new MainMenuItem();
     this.cPanels = new ActionContainerMenuBarItem();
     this.cViewsHistoryNavigation = new ActionContainerBarItem();
     this.cMenus = new ActionContainerMenuBarItem();
     this.cRecordsNavigation = new ActionContainerBarItem();
     this.cView = new ActionContainerBarItem();
     this.cReports = new ActionContainerBarItem();
     this.cDefault = new ActionContainerBarItem();
     this.cSearch = new ActionContainerBarItem();
     this.cFilters = new ActionContainerBarItem();
     this.cFullTextSearch = new ActionContainerBarItem();
     this.cAppearance = new ActionContainerMenuBarItem();
     this.barSubItemTools = new MainMenuItem();
     this.cTools = new ActionContainerMenuBarItem();
     this.cOptions = new ActionContainerMenuBarItem();
     this.cDiagnostic = new ActionContainerMenuBarItem();
     this.barSubItemWindow = new MainMenuItem();
     this.cWindows = new XafBarLinkContainerItem();
     this.barMdiChildrenListItem = new BarMdiChildrenListItem();
     this.Window = new ActionContainerBarItem();
     this.barSubItemHelp = new MainMenuItem();
     this.cHelp = new ActionContainerMenuBarItem();
     this.cAbout = new ActionContainerMenuBarItem();
     this.standardToolBar = new XafBar();
     this._statusBar = new XafBar();
     this.mainBarAndDockingController = new BarAndDockingController(this.components);
     this.barDockControlTop = new BarDockControl();
     this.barDockControlBottom = new BarDockControl();
     this.barDockControlLeft = new BarDockControl();
     this.barDockControlRight = new BarDockControl();
     this.mainDockManager = new DockManager(this.components);
     this.imageList1 = new ImageList(this.components);
     this.dockPanelMenus = new DockPanel();
     this.dockPanel1_Container = new ControlContainer();
     this.rootMenuItemsActionContainer1 = new MenuItemsActionContainer();
     this.cMenu = new ActionContainerBarItem();
     this.barSubItemPanels = new BarSubItem();
     this.viewSitePanel = new PanelControl();
     this.formStateModelSynchronizerComponent = new FormStateModelSynchronizer(this.components);
     ((ISupportInitialize)this.documentManager).BeginInit();
     ((ISupportInitialize)this.mainBarManager).BeginInit();
     ((ISupportInitialize)this.mainBarAndDockingController).BeginInit();
     ((ISupportInitialize)this.mainDockManager).BeginInit();
     this.dockPanelMenus.SuspendLayout();
     this.dockPanel1_Container.SuspendLayout();
     ((ISupportInitialize)this.viewSitePanel).BeginInit();
     base.SuspendLayout();
     this.actionsContainersManager.ActionContainerComponents.Add(this.cObjectsCreation);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cFile);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cSave);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cPrint);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cExport);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cExit);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cUndoRedo);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cEdit);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cRecordEdit);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cOpenObject);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cPanels);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cViewsHistoryNavigation);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cMenus);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cRecordsNavigation);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cView);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cReports);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cDefault);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cSearch);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cFilters);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cFullTextSearch);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cAppearance);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cTools);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cOptions);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cDiagnostic);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cAbout);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cMenu);
     this.actionsContainersManager.ActionContainerComponents.Add(this.Window);
     this.actionsContainersManager.ActionContainerComponents.Add(this.cHelp);
     this.actionsContainersManager.ActionContainerComponents.Add(this.rootMenuItemsActionContainer1);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cObjectsCreation);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cSave);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cEdit);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cRecordEdit);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cOpenObject);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cUndoRedo);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cPrint);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cView);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cReports);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cExport);
     this.actionsContainersManager.ContextMenuContainers.Add(this.cMenu);
     this.actionsContainersManager.DefaultContainer = this.cDefault;
     this.modelSynchronizationManager.ModelSynchronizableComponents.Add(this.formStateModelSynchronizerComponent);
     this.modelSynchronizationManager.ModelSynchronizableComponents.Add(this.mainBarManager);
     this.viewSiteManager.ViewSiteControl = this.viewSitePanel;
     this.mainBarManager.Bars.AddRange(new Bar[]
     {
         this._mainMenuBar,
         this.standardToolBar,
         this._statusBar
     });
     this.mainBarManager.Controller = this.mainBarAndDockingController;
     this.mainBarManager.DockControls.Add(this.barDockControlTop);
     this.mainBarManager.DockControls.Add(this.barDockControlBottom);
     this.mainBarManager.DockControls.Add(this.barDockControlLeft);
     this.mainBarManager.DockControls.Add(this.barDockControlRight);
     this.mainBarManager.DockManager = this.mainDockManager;
     this.mainBarManager.Form = this;
     this.mainBarManager.Items.AddRange(new BarItem[]
     {
         this.barSubItemFile,
         this.barSubItemEdit,
         this.barSubItemView,
         this.barSubItemTools,
         this.barSubItemHelp,
         this.cFile,
         this.cObjectsCreation,
         this.cPrint,
         this.cExport,
         this.cSave,
         this.cEdit,
         this.cOpenObject,
         this.cUndoRedo,
         this.cAppearance,
         this.cReports,
         this.cExit,
         this.cRecordEdit,
         this.cRecordsNavigation,
         this.cViewsHistoryNavigation,
         this.cSearch,
         this.cFullTextSearch,
         this.cFilters,
         this.cView,
         this.cDefault,
         this.cTools,
         this.cMenus,
         this.cDiagnostic,
         this.cOptions,
         this.cAbout,
         this.cWindows,
         this.cPanels,
         this.cMenu,
         this.barSubItemWindow,
         this.barMdiChildrenListItem,
         this.Window,
         this.barSubItemPanels,
         this.cHelp
     });
     this.mainBarManager.MainMenu = this._mainMenuBar;
     this.mainBarManager.MaxItemId = 37;
     this.mainBarManager.StatusBar = this._statusBar;
     this.mainBarManager.Disposed += new EventHandler(this.mainBarManager_Disposed);
     this._mainMenuBar.BarName = "Main Menu";
     this._mainMenuBar.DockCol = 0;
     this._mainMenuBar.DockRow = 0;
     this._mainMenuBar.DockStyle = BarDockStyle.Top;
     this._mainMenuBar.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.barSubItemFile),
         new LinkPersistInfo(this.barSubItemEdit),
         new LinkPersistInfo(this.barSubItemView),
         new LinkPersistInfo(this.barSubItemTools),
         new LinkPersistInfo(this.barSubItemWindow),
         new LinkPersistInfo(this.barSubItemHelp)
     });
     this._mainMenuBar.OptionsBar.MultiLine = true;
     this._mainMenuBar.OptionsBar.UseWholeRow = true;
     this._mainMenuBar.TargetPageCategoryColor = Color.Empty;
     this._mainMenuBar.Text = "Main menu";
     this.barSubItemFile.Caption = "Файл";
     this.barSubItemFile.Id = 0;
     this.barSubItemFile.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.cObjectsCreation, true),
         new LinkPersistInfo(this.cFile, true),
         new LinkPersistInfo(this.cSave, true),
         new LinkPersistInfo(this.cPrint, true),
         new LinkPersistInfo(this.cExport, true),
         new LinkPersistInfo(this.cExit, true)
     });
     this.barSubItemFile.MergeType = BarMenuMerge.MergeItems;
     this.barSubItemFile.Name = "barSubItemFile";
     this.barSubItemFile.VisibleInRibbon = false;
     this.cObjectsCreation.ApplicationMenuIndex = 1;
     this.cObjectsCreation.ApplicationMenuItem = true;
     this.cObjectsCreation.TargetPageGroupCaption = null;
     this.cObjectsCreation.Caption = "Создание объектов";
     this.cObjectsCreation.ContainerId = "ObjectsCreation";
     this.cObjectsCreation.Id = 18;
     this.cObjectsCreation.MergeType = BarMenuMerge.MergeItems;
     this.cObjectsCreation.Name = "cObjectsCreation";
     this.cObjectsCreation.TargetPageCategoryColor = Color.Empty;
     this.cFile.ApplicationMenuIndex = 2;
     this.cFile.ApplicationMenuItem = true;
     this.cFile.TargetPageGroupCaption = null;
     this.cFile.Caption = "Файл";
     this.cFile.ContainerId = "File";
     this.cFile.Id = 5;
     this.cFile.MergeOrder = 2;
     this.cFile.MergeType = BarMenuMerge.MergeItems;
     this.cFile.Name = "cFile";
     this.cFile.TargetPageCategoryColor = Color.Empty;
     this.cSave.ApplicationMenuIndex = 7;
     this.cSave.ApplicationMenuItem = true;
     this.cSave.TargetPageGroupCaption = null;
     this.cSave.Caption = "Сохранить";
     this.cSave.ContainerId = "Save";
     this.cSave.Id = 8;
     this.cSave.MergeType = BarMenuMerge.MergeItems;
     this.cSave.Name = "cSave";
     this.cSave.TargetPageCategoryColor = Color.Empty;
     this.cPrint.ApplicationMenuIndex = 11;
     this.cPrint.ApplicationMenuItem = true;
     this.cPrint.TargetPageGroupCaption = null;
     this.cPrint.Caption = "Печать";
     this.cPrint.ContainerId = "Print";
     this.cPrint.Id = 6;
     this.cPrint.MergeType = BarMenuMerge.MergeItems;
     this.cPrint.Name = "cPrint";
     this.cPrint.TargetPageCategoryColor = Color.Empty;
     this.cExport.ApplicationMenuIndex = 10;
     this.cExport.ApplicationMenuItem = true;
     this.cExport.TargetPageGroupCaption = null;
     this.cExport.Caption = "Экспорт";
     this.cExport.ContainerId = "Export";
     this.cExport.Id = 7;
     this.cExport.MergeType = BarMenuMerge.MergeItems;
     this.cExport.Name = "cExport";
     this.cExport.TargetPageCategoryColor = Color.Empty;
     this.cExit.ApplicationMenuIndex = 900;
     this.cExit.ApplicationMenuItem = true;
     this.cExit.TargetPageGroupCaption = null;
     this.cExit.Caption = "Выход";
     this.cExit.ContainerId = "Exit";
     this.cExit.Id = 8;
     this.cExit.MergeOrder = 900;
     this.cExit.Name = "cExit";
     this.cExit.TargetPageCategoryColor = Color.Empty;
     this.barSubItemEdit.Caption = "Правка";
     this.barSubItemEdit.Id = 1;
     this.barSubItemEdit.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.cUndoRedo, true),
         new LinkPersistInfo(this.cEdit, true),
         new LinkPersistInfo(this.cRecordEdit, true),
         new LinkPersistInfo(this.cOpenObject, true)
     });
     this.barSubItemEdit.MergeType = BarMenuMerge.MergeItems;
     this.barSubItemEdit.Name = "barSubItemEdit";
     this.barSubItemEdit.VisibleInRibbon = false;
     this.cUndoRedo.Caption = "Отменить/Повторить";
     this.cUndoRedo.TargetPageGroupCaption = "Edit";
     this.cUndoRedo.ContainerId = "UndoRedo";
     this.cUndoRedo.Id = 10;
     this.cUndoRedo.MergeType = BarMenuMerge.MergeItems;
     this.cUndoRedo.Name = "cUndoRedo";
     this.cUndoRedo.TargetPageCategoryColor = Color.Empty;
     this.cEdit.TargetPageGroupCaption = null;
     this.cEdit.Caption = "Правка";
     this.cEdit.ContainerId = "Edit";
     this.cEdit.Id = 9;
     this.cEdit.MergeType = BarMenuMerge.MergeItems;
     this.cEdit.Name = "cEdit";
     this.cEdit.TargetPageCategoryColor = Color.Empty;
     this.cRecordEdit.TargetPageGroupCaption = null;
     this.cRecordEdit.Caption = "Изменить запись";
     this.cRecordEdit.ContainerId = "RecordEdit";
     this.cRecordEdit.Id = 9;
     this.cRecordEdit.MergeType = BarMenuMerge.MergeItems;
     this.cRecordEdit.Name = "cRecordEdit";
     this.cRecordEdit.TargetPageCategoryColor = Color.Empty;
     this.cOpenObject.TargetPageGroupCaption = null;
     this.cOpenObject.Caption = "Открыть объект";
     this.cOpenObject.ContainerId = "OpenObject";
     this.cOpenObject.Id = 9;
     this.cOpenObject.MergeType = BarMenuMerge.MergeItems;
     this.cOpenObject.Name = "cOpenObject";
     this.cOpenObject.TargetPageCategoryColor = Color.Empty;
     this.barSubItemView.Caption = "Вид";
     this.barSubItemView.Id = 2;
     this.barSubItemView.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.cPanels, true),
         new LinkPersistInfo(this.cViewsHistoryNavigation, true),
         new LinkPersistInfo(this.cMenus, true),
         new LinkPersistInfo(this.cRecordsNavigation, true),
         new LinkPersistInfo(this.cView, true),
         new LinkPersistInfo(this.cReports, true),
         new LinkPersistInfo(this.cDefault, true),
         new LinkPersistInfo(this.cSearch, true),
         new LinkPersistInfo(BarLinkUserDefines.None, false, this.cFilters, true),
         new LinkPersistInfo(BarLinkUserDefines.None, false, this.cFullTextSearch, true),
         new LinkPersistInfo(this.cAppearance, true)
     });
     this.barSubItemView.MergeType = BarMenuMerge.MergeItems;
     this.barSubItemView.Name = "barSubItemView";
     this.cPanels.Caption = "Панели";
     this.cPanels.TargetPageGroupCaption = null;
     this.cPanels.TargetPageCaption = "View";
     this.cPanels.ContainerId = "Panels";
     this.cPanels.Id = 16;
     this.cPanels.MergeType = BarMenuMerge.MergeItems;
     this.cPanels.Name = "cPanels";
     this.cPanels.TargetPageCategoryColor = Color.Empty;
     this.cViewsHistoryNavigation.TargetPageGroupCaption = null;
     this.cViewsHistoryNavigation.Caption = "Просмотр истории навигации";
     this.cViewsHistoryNavigation.ContainerId = "ViewsHistoryNavigation";
     this.cViewsHistoryNavigation.Id = 35;
     this.cViewsHistoryNavigation.MergeType = BarMenuMerge.MergeItems;
     this.cViewsHistoryNavigation.Name = "cViewsHistoryNavigation";
     this.cViewsHistoryNavigation.TargetPageCategoryColor = Color.Empty;
     this.cMenus.TargetPageGroupCaption = null;
     this.cMenus.Caption = "Меню";
     this.cMenus.ContainerId = "Menus";
     this.cMenus.Id = 14;
     this.cMenus.MergeType = BarMenuMerge.MergeItems;
     this.cMenus.Name = "cMenus";
     this.cMenus.TargetPageCategoryColor = Color.Empty;
     this.cRecordsNavigation.TargetPageGroupCaption = null;
     this.cRecordsNavigation.Caption = "Записи навигации";
     this.cRecordsNavigation.ContainerId = "RecordsNavigation";
     this.cRecordsNavigation.Id = 10;
     this.cRecordsNavigation.MergeType = BarMenuMerge.MergeItems;
     this.cRecordsNavigation.Name = "cRecordsNavigation";
     this.cRecordsNavigation.TargetPageCategoryColor = Color.Empty;
     this.cView.TargetPageGroupCaption = null;
     this.cView.Caption = "Вид";
     this.cView.ContainerId = "View";
     this.cView.Id = 12;
     this.cView.MergeType = BarMenuMerge.MergeItems;
     this.cView.Name = "cView";
     this.cView.TargetPageCategoryColor = Color.Empty;
     this.cReports.ApplicationMenuIndex = 12;
     this.cReports.ApplicationMenuItem = true;
     this.cReports.TargetPageGroupCaption = "View";
     this.cReports.Caption = "Отчеты";
     this.cReports.ContainerId = "Reports";
     this.cReports.Id = 11;
     this.cReports.MergeType = BarMenuMerge.MergeItems;
     this.cReports.Name = "cReports";
     this.cReports.TargetPageCategoryColor = Color.Empty;
     this.cDefault.TargetPageGroupCaption = null;
     this.cDefault.Caption = "По умолчанию";
     this.cDefault.ContainerId = "Default";
     this.cDefault.Id = 50;
     this.cDefault.MergeType = BarMenuMerge.MergeItems;
     this.cDefault.Name = "cDefault";
     this.cDefault.TargetPageCategoryColor = Color.Empty;
     this.cSearch.TargetPageGroupCaption = null;
     this.cSearch.Caption = "Поиск";
     this.cSearch.ContainerId = "Search";
     this.cSearch.Id = 11;
     this.cSearch.MergeType = BarMenuMerge.MergeItems;
     this.cSearch.Name = "cSearch";
     this.cSearch.TargetPageCategoryColor = Color.Empty;
     this.cFilters.TargetPageGroupCaption = null;
     this.cFilters.Caption = "Фильтры";
     this.cFilters.ContainerId = "Filters";
     this.cFilters.Id = 26;
     this.cFilters.MergeType = BarMenuMerge.MergeItems;
     this.cFilters.Name = "cFilters";
     this.cFilters.TargetPageCategoryColor = Color.Empty;
     this.cFullTextSearch.Alignment = BarItemLinkAlignment.Right;
     this.cFullTextSearch.TargetPageGroupCaption = null;
     this.cFullTextSearch.Caption = "Полнотекстовый поиск";
     this.cFullTextSearch.ContainerId = "FullTextSearch";
     this.cFullTextSearch.Id = 12;
     this.cFullTextSearch.MergeType = BarMenuMerge.MergeItems;
     this.cFullTextSearch.Name = "cFullTextSearch";
     this.cFullTextSearch.TargetPageCategoryColor = Color.Empty;
     this.cAppearance.TargetPageGroupCaption = null;
     this.cAppearance.Caption = "Внешний вид";
     this.cAppearance.ContainerId = "Appearance";
     this.cAppearance.Id = 9;
     this.cAppearance.MergeType = BarMenuMerge.MergeItems;
     this.cAppearance.Name = "cAppearance";
     this.cAppearance.TargetPageCategoryColor = Color.Empty;
     this.barSubItemTools.Caption = "Инструменты";
     this.barSubItemTools.Id = 3;
     this.barSubItemTools.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.cTools, true),
         new LinkPersistInfo(this.cOptions, true),
         new LinkPersistInfo(this.cDiagnostic, true)
     });
     this.barSubItemTools.MergeType = BarMenuMerge.MergeItems;
     this.barSubItemTools.Name = "barSubItemTools";
     this.cTools.TargetPageGroupCaption = null;
     this.cTools.Caption = "Инструменты";
     this.cTools.ContainerId = "Tools";
     this.cTools.Id = 13;
     this.cTools.MergeType = BarMenuMerge.MergeItems;
     this.cTools.Name = "cTools";
     this.cTools.TargetPageCategoryColor = Color.Empty;
     this.cOptions.TargetPageGroupCaption = null;
     this.cOptions.Caption = "Настройки";
     this.cOptions.ContainerId = "Options";
     this.cOptions.Id = 14;
     this.cOptions.MergeType = BarMenuMerge.MergeItems;
     this.cOptions.Name = "cOptions";
     this.cOptions.TargetPageCategoryColor = Color.Empty;
     this.cDiagnostic.TargetPageGroupCaption = null;
     this.cDiagnostic.Caption = "Диагностика";
     this.cDiagnostic.ContainerId = "Diagnostic";
     this.cDiagnostic.Id = 16;
     this.cDiagnostic.MergeType = BarMenuMerge.MergeItems;
     this.cDiagnostic.Name = "cDiagnostic";
     this.cDiagnostic.TargetPageCategoryColor = Color.Empty;
     this.barSubItemWindow.Caption = "Окно";
     this.barSubItemWindow.Id = 32;
     this.barSubItemWindow.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.cWindows),
         new LinkPersistInfo(this.Window, true)
     });
     this.barSubItemWindow.MergeType = BarMenuMerge.MergeItems;
     this.barSubItemWindow.Name = "barSubItemWindow";
     this.cWindows.TargetPageCaption = "View";
     this.cWindows.TargetPageCategoryCaption = null;
     this.cWindows.Caption = "Окна";
     this.cWindows.TargetPageGroupCaption = null;
     this.cWindows.Id = 16;
     this.cWindows.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.barMdiChildrenListItem)
     });
     this.cWindows.MergeType = BarMenuMerge.MergeItems;
     this.cWindows.Name = "cWindows";
     this.cWindows.TargetPageCategoryColor = Color.Empty;
     this.barMdiChildrenListItem.Caption = "Список окон";
     this.barMdiChildrenListItem.Id = 37;
     this.barMdiChildrenListItem.Name = "barMdiChildrenListItem";
     this.Window.TargetPageCaption = "View";
     this.Window.TargetPageGroupCaption = "Windows";
     this.Window.Caption = "Окно";
     this.Window.ContainerId = "Windows";
     this.Window.Id = 34;
     this.Window.MergeType = BarMenuMerge.MergeItems;
     this.Window.Name = "Window";
     this.Window.TargetPageCategoryColor = Color.Empty;
     this.barSubItemHelp.Caption = "Помощь";
     this.barSubItemHelp.Id = 4;
     this.barSubItemHelp.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.cHelp, true),
         new LinkPersistInfo(this.cAbout, true)
     });
     this.barSubItemHelp.MergeType = BarMenuMerge.MergeItems;
     this.barSubItemHelp.Name = "barSubItemHelp";
     this.barSubItemHelp.VisibleInRibbon = false;
     this.cHelp.Caption = "Помощь";
     this.cHelp.TargetPageGroupCaption = null;
     this.cHelp.ContainerId = "Help";
     this.cHelp.Id = 36;
     this.cHelp.MergeType = BarMenuMerge.MergeItems;
     this.cHelp.Name = "cHelp";
     this.cHelp.TargetPageCategoryColor = Color.Empty;
     this.cAbout.ApplicationMenuIndex = 15;
     this.cAbout.ApplicationMenuItem = true;
     this.cAbout.Caption = "О программе";
     this.cAbout.TargetPageGroupCaption = null;
     this.cAbout.ContainerId = "About";
     this.cAbout.Id = 15;
     this.cAbout.MergeType = BarMenuMerge.MergeItems;
     this.cAbout.Name = "cAbout";
     this.cAbout.TargetPageCategoryColor = Color.Empty;
     this.standardToolBar.BarName = "Main Toolbar";
     this.standardToolBar.DockCol = 0;
     this.standardToolBar.DockRow = 1;
     this.standardToolBar.DockStyle = BarDockStyle.Top;
     this.standardToolBar.LinksPersistInfo.AddRange(new LinkPersistInfo[]
     {
         new LinkPersistInfo(this.cViewsHistoryNavigation, true),
         new LinkPersistInfo(this.cObjectsCreation, true),
         new LinkPersistInfo(this.cSave, true),
         new LinkPersistInfo(this.cEdit, true),
         new LinkPersistInfo(this.cUndoRedo, true),
         new LinkPersistInfo(this.cRecordEdit, true),
         new LinkPersistInfo(this.cOpenObject),
         new LinkPersistInfo(this.cView, true),
         new LinkPersistInfo(this.cReports),
         new LinkPersistInfo(this.cDefault, true),
         new LinkPersistInfo(this.cRecordsNavigation, true),
         new LinkPersistInfo(this.cFilters, true),
         new LinkPersistInfo(this.cSearch, true),
         new LinkPersistInfo(this.cFullTextSearch)
     });
     this.standardToolBar.OptionsBar.UseWholeRow = true;
     this.standardToolBar.TargetPageCategoryColor = Color.Empty;
     this.standardToolBar.Text = "Main Toolbar";
     this._statusBar.BarName = "StatusBar";
     this._statusBar.CanDockStyle = BarCanDockStyle.Bottom;
     this._statusBar.DockCol = 0;
     this._statusBar.DockRow = 0;
     this._statusBar.DockStyle = BarDockStyle.Bottom;
     this._statusBar.OptionsBar.AllowQuickCustomization = false;
     this._statusBar.OptionsBar.DisableClose = true;
     this._statusBar.OptionsBar.DisableCustomization = true;
     this._statusBar.OptionsBar.DrawDragBorder = false;
     this._statusBar.OptionsBar.DrawSizeGrip = true;
     this._statusBar.OptionsBar.UseWholeRow = true;
     this._statusBar.TargetPageCategoryColor = Color.Empty;
     this._statusBar.Text = "Status Bar";
     this.mainBarAndDockingController.PropertiesBar.AllowLinkLighting = false;
     this.barDockControlTop.CausesValidation = false;
     this.barDockControlTop.Parent = this;
     this.barDockControlTop.Size = new Size(792, 51);
     this.barDockControlTop.Dock = DockStyle.Top;
     this.barDockControlTop.Location = new Point(0, 0);
     // this.barDockControlTop.ZOrder = 6;
     this.barDockControlBottom.CausesValidation = false;
     this.barDockControlBottom.Parent = this;
     this.barDockControlBottom.Size = new Size(792, 23);
     this.barDockControlBottom.Dock = DockStyle.Bottom;
     this.barDockControlBottom.Location = new Point(0, 543);
     // this.barDockControlBottom.ZOrder = 5;
     this.barDockControlLeft.CausesValidation = false;
     this.barDockControlLeft.Parent = this;
     // this.barDockControlLeft.ZOrder = 3;
     this.barDockControlLeft.Location = new Point(0, 51);
     this.barDockControlLeft.Dock = DockStyle.Left;
     this.barDockControlLeft.Size = new Size(0, 492);
     this.barDockControlRight.CausesValidation = false;
     this.barDockControlRight.Parent = this;
     // this.barDockControlRight.ZOrder = 4;
     this.barDockControlRight.Location = new Point(792, 51);
     this.barDockControlRight.Dock = DockStyle.Right;
     this.barDockControlRight.Size = new Size(0, 492);
     this.mainDockManager.Controller = this.mainBarAndDockingController;
     this.mainDockManager.Form = this;
     this.mainDockManager.Images = this.imageList1;
     this.mainDockManager.MenuManager = this.mainBarManager;
     this.mainDockManager.RootPanels.AddRange(new DockPanel[]
     {
         this.dockPanelMenus
     });
     this.mainDockManager.TopZIndexControls.AddRange(new string[]
     {
         "DevExpress.XtraBars.BarDockControl",
         "System.Windows.Forms.StatusBar",
         "DevExpress.ExpressApp.Win.Templates.Controls.XafRibbonControl",
         "DevExpress.XtraBars.Ribbon.RibbonStatusBar"
     });
     this.imageList1.ColorDepth = ColorDepth.Depth32Bit;
     this.imageList1.ImageSize = new Size(16, 16);
     this.imageList1.TransparentColor = Color.Transparent;
     this.dockPanelMenus.Controls.Add(this.dockPanel1_Container);
     this.dockPanelMenus.Dock = DockingStyle.Left;
     this.dockPanelMenus.ID = new Guid("17f71733-1ca6-4a29-aa2c-56cbcc2b43dd");
     this.dockPanelMenus.Size = new Size(200, 492);
     this.dockPanelMenus.Text = "Навигация";
     this.dockPanelMenus.Parent = this;
     this.dockPanelMenus.Location = new Point(0, 51);
     this.dockPanelMenus.Name = "dockPanelMenus";
     this.dockPanelMenus.Options.AllowDockBottom = false;
     this.dockPanelMenus.Options.AllowDockTop = false;
     this.dockPanelMenus.OriginalSize = new Size(200, 200);
     this.dockPanelMenus.TabStop = false;
     this.dockPanelMenus.Tag = "Menus";
     this.dockPanel1_Container.Controls.Add(this.rootMenuItemsActionContainer1);
     this.dockPanel1_Container.Parent = dockPanelMenus;
     this.dockPanel1_Container.Location = new Point(4, 23);
     this.dockPanel1_Container.Size = new Size(192, 465);
     this.dockPanel1_Container.TabIndex = 0;
     this.dockPanel1_Container.Name = "dockPanel1_Container";
     this.rootMenuItemsActionContainer1.Parent = dockPanel1_Container;
     this.rootMenuItemsActionContainer1.TabIndex = 0;
     this.rootMenuItemsActionContainer1.Size = new Size(192, 465);
     this.rootMenuItemsActionContainer1.Dock = DockStyle.Fill;
     this.rootMenuItemsActionContainer1.Location = new Point(0, 0);
     this.rootMenuItemsActionContainer1.Name = "rootMenuItemsActionContainer1";
     this.cMenu.Caption = "Меню";
     this.cMenu.TargetPageGroupCaption = null;
     this.cMenu.ContainerId = "Menu";
     this.cMenu.Id = 7;
     this.cMenu.Name = "cMenu";
     this.cMenu.TargetPageCategoryColor = Color.Empty;
     this.barSubItemPanels.Caption = "Панели";
     this.barSubItemPanels.Id = 35;
     this.barSubItemPanels.Name = "barSubItemPanels";
     this.viewSitePanel.BorderStyle = BorderStyles.NoBorder;
     this.viewSitePanel.Parent = this;
     this.viewSitePanel.Location = new Point(200, 51);
     this.viewSitePanel.Size = new Size(592, 492);
     this.viewSitePanel.Dock = DockStyle.Fill;
     this.viewSitePanel.TabIndex = 4;
     this.viewSitePanel.Name = "viewSitePanel";
     this.formStateModelSynchronizerComponent.Form = this;
     this.formStateModelSynchronizerComponent.Model = null;
     this.Text = "MainForm";
     this.ClientSize = new Size(792, 566);
     // this.Margin = new Padding(3, 5, 3, 5);
     this.AutoScaleDimensions = new SizeF(6, 13);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.BarManager = this.mainBarManager;
     base.Controls.Add(this.viewSitePanel);
     base.Controls.Add(this.dockPanelMenus);
     base.Controls.Add(this.barDockControlLeft);
     base.Controls.Add(this.barDockControlRight);
     base.Controls.Add(this.barDockControlBottom);
     base.Controls.Add(this.barDockControlTop);
     base.IsMdiContainer = true;
     base.Name = "MenusMainForm";
     ((ISupportInitialize)this.documentManager).EndInit();
     ((ISupportInitialize)this.mainBarManager).EndInit();
     ((ISupportInitialize)this.mainBarAndDockingController).EndInit();
     ((ISupportInitialize)this.mainDockManager).EndInit();
     this.dockPanelMenus.ResumeLayout(false);
     this.dockPanel1_Container.ResumeLayout(false);
     ((ISupportInitialize)this.viewSitePanel).EndInit();
     base.ResumeLayout(false);
 }
예제 #24
0
        //Tao cac item trong page group
        private void createItem(string strMenuItemID)
        {
            //Thuc hien viec add MenuItem con cua Menu dang xet neu co
            if (ds.Tables[0].Select("Parents='" + strMenuItemID + "'").Length > 0)
            {
                BarItem barItem;
                if (getForm(strMenuItemID) != "")
                {
                    barItem = new BarButtonItem();
                    barItem.ItemClick += new ItemClickEventHandler(itemClick);
                }
                else
                {
                    barItem = new BarSubItem();
                    BarSubItem subItem  = (BarSubItem)barItem;
                    subItem.MenuDrawMode = MenuDrawMode.LargeImagesText;
                }
                barItem.Id = frmRibbonMain.IIII++;
                barItem.Name = strMenuItemID;
                barItem.Caption = getName(strMenuItemID);
                barItem.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                barItem.RibbonStyle = RibbonItemStyles.Large;
                barItem.Enabled = getEnable(strMenuItemID);
                //Gan do rong cho item
                barItem.LargeWidth = 80;
                //Khong co separator giua cac item
                appMenu.ItemLinks.Add(barItem,getSep(strMenuItemID));
                //Co separator giua cac item
                //pageGroup.ItemLinks.Add(barSubItem, true);
                try
                {
                    Image image = this.getImage48(strMenuItemID);
                    barItem.Glyph = image;
                }
                catch { }
                if (getToolTip(strMenuItemID) != "")
                {
                    CreateToolTip(barItem, getToolTip(strMenuItemID));
                }
                if (getForm(strMenuItemID) != "")
                {
                    CreatePopupItem(barItem, strMenuItemID);
                }
                else
                {
                    foreach (DataRow drTemp in ds.Tables[0].Select("Parents='" + strMenuItemID + "'"))
                    {
                        createChildItem(barItem, drTemp[0].ToString());
                    }
                }
            }
            else
            {
                BarButtonItem barButtonItem = new BarButtonItem();
                barButtonItem.Id = frmRibbonMain.IIII++;
                barButtonItem.Name = strMenuItemID;
                barButtonItem.Caption = getName(strMenuItemID);
                barButtonItem.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                barButtonItem.RibbonStyle = RibbonItemStyles.Large;
                barButtonItem.Enabled = getEnable(strMenuItemID);
                //barButtonItem.LargeWidth = 70;
                //Khong co separator giua cac item
                appMenu.ItemLinks.Add(barButtonItem,getSep(strMenuItemID));
                //Co separator giua cac item
                //pageGroup.ItemLinks.Add(barButtonItem, true);
                if (getToolTip(strMenuItemID) != "")
                {
                    CreateToolTip(barButtonItem, getToolTip(strMenuItemID));
                }
                try
                {
                    Image image = this.getImage48(strMenuItemID);
                    barButtonItem.Glyph = image;
                }
                catch { }

                barButtonItem.ItemClick += new ItemClickEventHandler(itemClick);
            }
        }
예제 #25
0
파일: FormMain.cs 프로젝트: fizikci/Cinar
        private void addModuleLinksToNavBarAndMenu()
        {
            navBar.Items.Clear();
            navBar.Groups.Clear();

            foreach (string category in Provider.UIMetaData.EditForms.OrderBy(f=>f.CategoryName).Select(f => f.CategoryName).Distinct())
            {
                BarSubItem menuFormCat = null;
                NavBarGroup navBarCat = null;

                foreach (EditFormAttribute editForm in Provider.UIMetaData.EditForms.Where(f => f.CategoryName == category).OrderBy(f=>f.DisplayName))
                {
                    if (string.IsNullOrEmpty(editForm.DisplayName))
                        continue;

                    if (!DMT.Provider.ClientUser.HasRight(editForm.RequiredRight))
                        continue;

                    if (menuFormCat == null)
                    {
                        menuFormCat = new BarSubItem();
                        barManager.Items.Add(menuFormCat);
                        menuCommands.LinksPersistInfo.Add(new LinkPersistInfo(menuFormCat));
                        menuFormCat.Caption = category;
                    }

                    BarButtonItem item = new BarButtonItem(barManager, editForm.DisplayName);
                    menuFormCat.LinksPersistInfo.Add(new LinkPersistInfo(item));
                    if(!string.IsNullOrEmpty(editForm.ImageKey))
                        item.Glyph = (Image)FamFamFam.ResourceManager.GetObject(editForm.ImageKey);
                    item.Tag = editForm;

                    if (navBarCat == null)
                    {
                        navBarCat = new NavBarGroup();
                        navBarCat.Caption = category;
                        navBar.Groups.Add(navBarCat);
                    }

                    NavBarItem item2 = new NavBarItem(editForm.DisplayName);
                    navBarCat.ItemLinks.Add(new NavBarItemLink(item2));
                    if (!string.IsNullOrEmpty(editForm.ImageKey))
                        item2.SmallImage = (Image)FamFamFam.ResourceManager.GetObject(editForm.ImageKey);
                    item2.Tag = editForm;

                    cmdMan.Commands.Add(
                        new Command
                            {
                                Execute = cmdOpenForm,
                                DisplayName = editForm.DisplayName,
                                Triggers = new List<CommandTrigger>{
                                       new CommandTrigger() {Control=item, Argument = editForm.FormType.FullName },
                                       new CommandTrigger() {Control=item2, Argument = editForm.FormType.FullName, Event="LinkClicked" }
                                   }
                            });
                }
            }
        }
예제 #26
0
        /**/

        /*
         * /// <summary>
         * /// 菜单单击事件
         * /// </summary>
         * /// <param name="sender"></param>
         * /// <param name="e"></param>
         * private void subMenu_ShowForm(object sender, EventArgs e)
         * {
         *  try
         *  {
         *      string acName = ((ToolStripMenuItem) sender).Tag.ToString();
         *
         *      if (acName != "")
         *      {
         *          //根据从数据库中读取的窗体类名称创建窗体
         *          string type = acName.Substring(0, 3);
         *          acName = acName.Substring(4);
         *          Type t = Type.GetType(acName);
         * //                    Object obj = Activator.CreateInstance(t);
         *
         *          if (t != null)
         *          {
         *              Assembly assembly = Assembly.GetAssembly(t);
         *              var frm = (Form) assembly.CreateInstance(t.FullName);
         *
         *
         *              //设置窗体的位置和字体
         *              if (frm != null)
         *              {
         *                  frm.StartPosition = FormStartPosition.CenterScreen;
         *                  frm.Font = Font;
         *
         *                  //为窗体中的所有按钮添加写日志的事件
         *                  foreach (Control control in frm.Controls)
         *                  {
         *                      if (control is Button)
         *                      {
         *                          (control).Click += WriteLog;
         *                      }
         *                  }
         *
         *                  //根据前面是MDI还是SDI来创建窗体
         *                  if (type == "MDI")
         *                  {
         *                      foreach (Form openForm in Application.OpenForms)
         *                      {
         *                          if (openForm.Name == "FrmMain")
         *                          {
         *                              foreach (Form childrenForm in openForm.MdiChildren)
         *                              {
         *                                  if (childrenForm.GetType().FullName == acName)
         *                                  {
         *                                      childrenForm.Visible = true; //如果配置窗口已打开则将其显示
         *                                      childrenForm.Activate(); //并激活该窗体
         *                                      return;
         *                                  }
         *                              }
         *                              frm.MdiParent = openForm;
         *                              frm.Show();
         *                              return;
         *                          }
         *                      }
         *                  }
         *                  else
         *                  {
         *                      frm.ShowDialog();
         *                  }
         *              }
         *          }
         *      }
         *  }
         *  catch
         *  {
         *      MessageBox.Show("创建菜单对应窗体时出错,请联系系统管理员", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         *      throw;
         *  }
         * }
         *
         */
        /**/

        /// <summary>
        /// 菜单单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void subMenu_Click(object sender, EventArgs e)
        {
            try
            {
                //tag属性在这里有用到。
                String str = ((ToolStripMenuItem)sender).Tag.ToString();

                if (str != "")
                {
                    foreach (MethodInfo info in GetType().GetMethods())
                    {
                        if (str.Trim().ToLower().CompareTo(info.ToString().Trim().ToLower()) == 0)
                        {
                            info.Invoke(this, null);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("调用菜单点击事件时出错,请联系系统管理员", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }

        public void DemoShow()
        {
            MessageBox.Show("一个测试");
        }

        /*   由于菜单由barmanange产生,所以不再使用这个函数
         * /// <summary>
         * /// 递归创建MenuStrip菜单(模块列表)
         * /// </summary>
         * /// <param name="dtSource">数据源</param>
         * /// <param name="topMenu">父菜单项</param>
         * /// <param name="inFatherId">父菜单的ID</param>
         * private void LoadSubMenu(DataTable dtSource, ToolStripMenuItem topMenu, String inFatherId)
         * {
         *  DataRow[] rows = dtSource.Select(String.Format("F_ParentID={0}", inFatherId));
         *
         *  ToolStripMenuItem subMenu;
         *  foreach (DataRow row in rows)
         *  {
         *      //创建子菜单项
         *      subMenu = new ToolStripMenuItem();
         *      subMenu.Name = row["F_ID"].ToString();
         *      subMenu.Text = row["F_NAME"].ToString();
         *
         *      if (row["F_AUTH"].ToString() == "0")
         *      {
         *          subMenu.Enabled = false;
         *      }
         *      if (row["F_ACTION"].ToString() == "" && row["F_PATH"].ToString() == "")
         *      {
         *          subMenu.Enabled = true;
         *      }
         *
         *      //判断是否为顶级菜单
         *      if (inFatherId == "0")
         *      {
         *          mmuModule.Items.Add(subMenu);
         *      }
         *      else
         *      {
         *          if (row["F_PATH"].ToString().Length > 0)
         *          {
         *              subMenu.Tag = row["F_PATH"].ToString();
         *              subMenu.Click += subMenu_ShowForm;
         *          }
         *          else if (row["F_ACTION"].ToString().Length > 0)
         *          {
         *              subMenu.Tag = row["F_ACTION"].ToString();
         *              subMenu.Click += subMenu_Click;
         *          }
         *          topMenu.DropDownItems.Add(subMenu);
         *      }
         *
         *      //递归调用
         *      LoadSubMenu(dtSource, subMenu, row["F_ID"].ToString());
         *  }
         * }
         *
         */
        /// <summary>
        /// 递归创建MenuStrip菜单(模块列表)
        /// </summary>
        /// <param name="topMenu">父菜单项</param>
        /// <param name="FATHER_ID">父菜单的ID</param>
        private void LoadSubItem(DataTable dtSource, BarSubItem topMenu, String inFatherId)
        {
            DataRow[] rows = dtSource.Select(String.Format("F_ParentID={0}", inFatherId));


            foreach (DataRow row in rows)
            {
                //创建子菜单项


                //判断是否为顶级菜单
                if (inFatherId == "0")
                {
                    var subItem = new BarSubItem(barManager, row["F_NAME"].ToString());

                    subItem.Id = SubItemId;
                    mmMain.ItemLinks.Add(subItem);
                    LoadSubItem(dtSource, subItem, row["F_ID"].ToString());
                }
                else
                {
                    if (row["F_HASCHILD"].ToString() != "0")
                    {
                        var subItem = new BarSubItem(barManager, row["F_NAME"].ToString());
                        if (row["F_AUTH"].ToString() == "0")
                        {
                            subItem.Enabled = false;
                        }
                        if (row["F_ACTION"].ToString() == "" && row["F_PATH"].ToString() == "")
                        {
                            subItem.Enabled = true;
                        }
//                        topMenu.AddItem(subItem);
                        subItem.Id = SubItemId;
                        topMenu.ItemLinks.Add(subItem);
                        LoadSubItem(dtSource, subItem, row["F_ID"].ToString());
                    }
                    else
                    {
                        var subItem = new BarButtonItem(barManager, row["F_NAME"].ToString());

                        if (row["F_AUTH"].ToString() == "0")
                        {
                            subItem.Enabled = false;
                        }
                        if (row["F_ACTION"].ToString() == "" && row["F_PATH"].ToString() == "")
                        {
                            subItem.Enabled = true;
                        }
                        if (row["F_PATH"].ToString().Length > 0)
                        {
                            subItem.Tag        = row["F_PATH"].ToString();
                            subItem.ItemClick += subItem_ShowForm;
                        }
                        else if (row["F_ACTION"].ToString().Length > 0)
                        {
                            subItem.Tag        = row["F_ACTION"].ToString();
                            subItem.ItemClick += subItem_Click;
                        }

//                        topMenu.AddItem(subItem);
                        subItem.Id = SubItemId;
                        topMenu.ItemLinks.Add(subItem);
                    }
                }
                SubItemId++;
                //递归调用
            }
        }
예제 #27
0
        /// <summary>
        /// 将菜单项转换为BarButtonItem对象
        /// </summary>
        /// <param name="itemOwner">按钮的父级拥有者</param>
        /// <param name="menuItem"></param>
        private void LoadBarSubItems(BarSubItem itemOwner, ToolStripMenuItem menuItem)
        {
            foreach (ToolStripItem item in menuItem.DropDownItems)
            {
                if (item is ToolStripSeparator) continue;
                if (!item.Enabled) continue; //菜单是禁止使用状态,无权限

                if (item is ToolStripMenuItem && (item as ToolStripMenuItem).DropDownItems.Count > 0)
                {
                    BarSubItem subItem = new BarSubItem(itemOwner.Manager, item.Text);
                    itemOwner.ItemLinks.Add(subItem);
                    this.LoadBarSubItems(subItem, item as ToolStripMenuItem);
                }
                else
                {
                    this.LoadBarButtonItem(itemOwner, item);
                }
            }
        }
예제 #28
0
        public void InitializeCommands()
        {
            cmdMan.Commands = new CommandCollection {
                new Command{
                    Execute = cmdAddNewPage,
                    Trigger = new CommandTrigger{Control = btnAddPage}
                },
                new Command{
                    Execute = cmdBringSelectedToFront,
                    Trigger = new CommandTrigger{Control = btnBringToFront},
                    IsEnabled = isThereSelectedElement
                },
                new Command{
                    Execute = cmdDeleteSelectedPage,
                    Trigger = new CommandTrigger{Control = btnDeletePage},
                    IsEnabled = ()=>{ return templateDesigner.template.Pages.Count>1;}
                },
                //new Command{
                //    Execute = cmdExit,
                //    Trigger = new CommandTrigger{Control = menuExit}
                //},
                new Command{
                    Execute = cmdOpenTemplate,
                    Triggers = new List<CommandTrigger>{
                        new CommandTrigger{Control = btnOpen}
                    }
                },
                new Command{
                    Execute = cmdRefreshActivePage,
                    Trigger = new CommandTrigger{Control = propertyGrid, Event="CellValueChanged"}
                },
                new Command{
                    Execute = cmdSaveToLocalAs,
                    Trigger = new CommandTrigger{Control = btnSaveToLocalAs}
                },
                new Command{
                    Execute = cmdSaveTemplate,
                    Triggers = new List<CommandTrigger>{
                        new CommandTrigger{Control = btnSave}
                    }
                },
                new Command{
                    Execute = cmdSelectTool,
                    Triggers = new List<CommandTrigger>{
                        new CommandTrigger{Control = btnNone},
                        new CommandTrigger{Control = btnText},
                        new CommandTrigger{Control = btnRectangle},
                        new CommandTrigger{Control = btnCircle},
                        new CommandTrigger{Control = btnLine},
                        new CommandTrigger{Control = btnPicture}
                    }
                },
                new Command{
                    Execute = cmdSendSelectedBack,
                    Trigger = new CommandTrigger{Control = btnSendBack},
                    IsEnabled = isThereSelectedElement
                },
                new Command{
                    Execute = cmdZoom,
                    Triggers = new List<CommandTrigger>{
                        new CommandTrigger{Control = btnZoom10},
                        new CommandTrigger{Control = btnZoom100},
                        new CommandTrigger{Control = btnZoom150},
                        new CommandTrigger{Control = btnZoom200},
                        new CommandTrigger{Control = btnZoom25},
                        new CommandTrigger{Control = btnZoom400},
                        new CommandTrigger{Control = btnZoom400},
                        new CommandTrigger{Control = btnZoom50},
                        new CommandTrigger{Control = btnZoom75},
                        new CommandTrigger{Control = btnZoom800},
                        new CommandTrigger{Control = btnZoomHeight},
                        new CommandTrigger{Control = btnZoomWidth}
                    }
                },
                new Command{
                    Execute = cmdSetParam,
                    IsEnabled = isSelectedElementText
                }
            };

            templateDesigner.OnElementAdded = () =>
            {
                btnNone.Down = true;
                this.Cursor = Cursors.Default;
            };

            Action<Element> setPropertyGrid = (Element elm) =>
            {
                propertyGrid.SelectedObject = null;
                propertyGrid.SelectedObject = elm;
                cmdMan.SetCommandControlsEnable();
            };

            templateDesigner.OnSelectedElementChanged = setPropertyGrid;
            templateDesigner.OnSelectedElementMoved = setPropertyGrid;
            templateDesigner.OnSelectedElementResized = setPropertyGrid;

            if (templateDesigner.template == null)
            {
                templateDesigner.template = new Template();
                cmdAddNewPage(null);
            }

            // init params
            if (this.Parameters != null)
            {
                barManager1.ForceInitialize();
                Dictionary<string, BarSubItem> subItems = new Dictionary<string, BarSubItem>();
                foreach (string key in Parameters.Keys)
                {
                    BarSubItem bsi = menuParams;
                    string[] pair = key.Split('.');
                    if (subItems.ContainsKey(pair[0]))
                        bsi = subItems[pair[0]];
                    else
                    {
                        bsi = new BarSubItem(barManager1, pair[0]);
                        menuParams.AddItem(bsi);
                        subItems.Add(pair[0], bsi);
                    }

                    BarButtonItem item = new BarButtonItem(barManager1, pair[1]);
                    bsi.AddItem(item);

                    cmdMan.Commands["cmdSetParam"].Triggers.Add(new CommandTrigger
                    {
                        Control = item,
                        Argument = key
                    });
                }
            }

            cmdMan.SetCommandTriggers();
            cmdMan.SetCommandControlsVisibility();
            cmdMan.SetCommandControlsEnable();
        }
        /// <summary>
        /// 构建插件单元
        /// </summary>
        /// <param name="caller">调用者</param>
        /// <param name="context">上下文,用于存放在构建时需要的组件</param>
        /// <param name="element">插件单元</param>
        /// <param name="subItems">被构建的子对象列表</param>
        /// <returns>构建好的插件单元</returns>
        public object BuildItem(object caller, WorkItem context, AddInElement element, ArrayList subItems)
        {
            if (element.Configuration.Attributes["label"] == null)
                throw new AddInException(String.Format("没有为类型为 \"{0}\" 的插件单元{1}提供label属性。",
                    element.ClassName, element.Id));

            string label = element.Configuration.Attributes["label"];
            BarItem item;
            bool register = false;
            if (element.Configuration.Attributes["register"] != null)
                register = bool.Parse(element.Configuration.Attributes["register"]);
            if (register)
                item = new BarSubItem();
            else
                item = new BarButtonItem();
            item.Caption = BuilderUtility.GetStringRES(context, label);
            item.Name = element.Name;
            BarManager barManager = BuilderUtility.GetBarManager(context);
            if (barManager != null)
                item.Id = barManager.GetNewItemId(); // 为BarItem设置Id方便正确的保存和恢复其状态

            if (element.Configuration.Attributes["alignment"] != null)
                item.Alignment = (BarItemLinkAlignment)Enum.Parse(typeof(BarItemLinkAlignment), element.Configuration.Attributes["alignment"]);
            if (element.Configuration.Attributes["paintstyle"] != null)
                item.PaintStyle = (BarItemPaintStyle)Enum.Parse(typeof(BarItemPaintStyle), element.Configuration.Attributes["paintstyle"]);
            if (element.Configuration.Attributes["tooltip"] != null)
                item.Hint = element.Configuration.Attributes["tooltip"];
            else
                item.Hint = BuilderUtility.GetStringRES(context, label);
            if (element.Configuration.Attributes["largeimage"] != null) {
                string largeImage = element.Configuration.Attributes["largeimage"];
                item.LargeGlyph = BuilderUtility.GetBitmap(context, largeImage, 32, 32);
            }
            if (element.Configuration.Attributes["imagefile"] != null) {
                string image = element.Configuration.Attributes["imagefile"];
                item.Glyph = BuilderUtility.GetBitmap(context, image, 16, 16);
            }
            if (element.Configuration.Attributes["shortcut"] != null) {
                string key = element.Configuration.Attributes["shortcut"];
                try {
                    item.ItemShortcut = new BarShortcut((Shortcut)Enum.Parse(typeof(Shortcut), key));
                }
                catch {
                }
            }

            BarItemExtend extend = new BarItemExtend();
            if (element.Configuration.Attributes["begingroup"] != null) {
                bool beginGroup = bool.Parse(element.Configuration.Attributes["begingroup"]);
                extend.BeginGroup = beginGroup;
            }
            if (element.Configuration.Attributes["insertbefore"] != null)
                extend.InsertBefore = element.Configuration.Attributes["insertbefore"];
            item.Tag = extend;

            // 设置菜单项/按钮为选择项
            if ((element.Configuration.Attributes["checked"] != null) && (item is BarButtonItem)) {
                ((BarButtonItem)item).ButtonStyle = BarButtonStyle.Check;
                bool check = bool.Parse(element.Configuration.Attributes["checked"]);
                ((BarButtonItem)item).Down = check;
                if (element.Configuration.Attributes["optiongroup"] != null)
                    ((BarButtonItem)item).GroupIndex = int.Parse(element.Configuration.Attributes["optiongroup"]);
            }

            // 添加插件单元到系统中
            if (!String.IsNullOrEmpty(element.Path) && context.UIExtensionSites.Contains(element.Path))
                context.UIExtensionSites[element.Path].Add(item);
            Command cmd = BuilderUtility.GetCommand(context, element.Command);
            if (cmd != null) // 如果操作命令不为空则绑定命令
                cmd.AddInvoker(item, "ItemClick");

            // 注册此路径的插件
            if (register)
                context.UIExtensionSites.RegisterSite(BuilderUtility.CombinPath(element.Path, element.Id), item);
            return item;
        }
예제 #30
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="barManager"></param>
 /// <param name="subItem"> </param>
 /// <param name="caption"> </param>
 /// <param name="gridView"></param>
 /// <param name="excludeColumns"> </param>
 /// <param name="defaultColumns"></param>
 /// <returns></returns>
 public static void AddTuyBienCot(BarManager barManager, BarSubItem subItem, string caption, GridView gridView,
     GridColumn[] excludeColumns, params string[] defaultColumns)
 {
     AddTuyBienCot(barManager, subItem.LinksPersistInfo, caption, gridView, excludeColumns, defaultColumns);
 }
		private void InitContextMenu()
		{
			_barManager.BeginInit();

			var buttonEditor = new RepositoryItemButtonEdit { AutoHeight = false };
			buttonEditor.Buttons.Clear();
			buttonEditor.Buttons.AddRange(new[]
			{
				new EditorButton(ButtonPredefines.Delete)
			});
			buttonEditor.ButtonClick += (o, e) =>
			{
				((ButtonEdit)o).EditValue = null;
			};

			var colorEditor = new RepositoryItemHtmlColorEdit
			{
				AutoHeight = false,
			};
			colorEditor.Buttons.Clear();
			colorEditor.Buttons.AddRange(new[] { new EditorButton(ButtonPredefines.Ellipsis) });
			colorEditor.OnColorSelected += (o, e) =>
			{
				_barManager.CloseMenus();
			};

			var maxId = _barManager.MaxItemId++;

			var linkNoteControlButtonCollection = new List<BarItem>();
			ItemLinkNoteCustom = new BarEditItem
			{
				Id = maxId,
				Caption = "Custom",
				Edit = buttonEditor,
				Width = 150
			};
			ItemLinkNoteCustom.EditValueChanged += (o, e) => LibraryObjectLoader.OnNoteChanged();
			maxId++;
			foreach (var noteText in LibraryObjectNotesLoader.PredefinedNotes)
			{
				var itemLinkNote = new BarButtonItem
				{
					Caption = noteText,
					Id = maxId,
					Tag = noteText
				};
				maxId++;
				itemLinkNote.ItemClick += (o, e) =>
				{
					var itemNoteText = e.Item.Tag as String;
					ItemLinkNoteCustom.EditValue = itemNoteText;
				};
				linkNoteControlButtonCollection.Add(itemLinkNote);
			}
			linkNoteControlButtonCollection.Add(ItemLinkNoteCustom);
			ItemLinkNote = new BarSubItem();
			ItemLinkNote.Caption = "Link Note";
			ItemLinkNote.Id = maxId;
			_barManager.Items.AddRange(linkNoteControlButtonCollection.ToArray());
			ItemLinkNote.LinksPersistInfo.AddRange(linkNoteControlButtonCollection
				.Select(barItem => new LinkPersistInfo(barItem)).ToArray());
			maxId++;

			ItemHoverNote = new BarEditItem
			{
				Id = maxId,
				Caption = "Hover Note",
				Edit = buttonEditor,
				Width = 150
			};
			maxId++;
			ItemHoverNote.EditValueChanged += (o, e) => LibraryObjectLoader.OnHoverChanged();

			_barManager.Items.Add(ItemLinkNote);
			_barManager.Items.Add(ItemHoverNote);
			_barManager.MaxItemId = maxId;

			_barManager.EndInit();
		}
예제 #32
0
 private static void BuildMenu(IModelNavigationItems items, BarLinksHolder ctrl, IBarManagerHolder dock)
 {
     foreach (var x in items)
     {
         if (x.Items.Count > 0)
         {
             var sub = new BarSubItem(dock.BarManager, x.Caption);
             sub.LargeGlyph = ImageLoader.Instance.GetImageInfo(x.ImageName).Image;
             ctrl.AddItem(sub);
             BuildMenu(x.Items, sub, dock);
         }
         else
         {
             var item = new BarButtonItem(dock.BarManager, x.Caption);
             item.LargeGlyph = ImageLoader.Instance.GetImageInfo(x.ImageName).Image;
             ctrl.AddItem(item);
         }
     }
 }
		public LineBreakTextFormatEditor(BarSubItem itemsContainer) : base(itemsContainer)
		{
			InitContextMenu();
		}
예제 #34
0
파일: MainFrm.cs 프로젝트: zydccf85/jdk
        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"));
            }
        }