private void BuildMainMenu(BarSubItem barItem, IList <MenuData> menuList) { foreach (MenuData data in menuList) { if ((data.menus != null) && (data.menus.Count > 0)) { BarSubItem item = new BarSubItem(barManager1, data.menu_name) { Tag = data }; barItem.AddItem(item); this.BuildMainMenu(item, data.menus); } else { BarLargeButtonItem item3 = new BarLargeButtonItem(barManager1, data.menu_name) { Tag = data, Glyph = this.LoadImageFormFile(data.menu_icon) }; if (barItem != null) { barItem.AddItem(item3); } item3.ItemClick += new ItemClickEventHandler(this.barLargeButtonItem_ItemClick); } } }
public void ClearEmptyItemsTest() { var barItem = new BarSubItem { Caption = @"Test1" }; BarSubItem expected = null; BarSubItem actual = MenuActionManager.ClearEmptyItems(barItem); Assert.AreEqual(expected, actual); barItem = new BarSubItem(); var childItem = new BarSubItem(); barItem.AddItem(new BarLargeButtonItem()); barItem.AddItem(childItem); expected = barItem; actual = MenuActionManager.ClearEmptyItems(barItem); Assert.AreEqual(expected, actual); Assert.AreEqual(1, barItem.ItemLinks.Count); barItem.AddItem(childItem); childItem.AddItem(new BarLargeButtonItem()); actual = MenuActionManager.ClearEmptyItems(barItem); Assert.AreEqual(expected, actual); Assert.AreEqual(2, barItem.ItemLinks.Count); Assert.AreEqual(1, childItem.ItemLinks.Count); }
/// <summary>初始化皮肤 /// /// </summary> private void InitSkin() { BarSubItem bar = new BarSubItem(); bar.Caption = "系统主题"; bar.Name = "系统主题"; //迭代出所有皮肤样式 //this.bar2.AddItem(bar); this.bar3.AddItem(bar); foreach (DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins) { BarButtonItem barBI = new BarButtonItem(); barBI.Tag = skin.SkinName; barBI.Name = skin.SkinName; barBI.Caption = skin.SkinName; barBI.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(ItemClick); bar.AddItem(barBI); //this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { barBI }); //bar.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(barBI) }); } //this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { bar }); //this.bar2.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(bar) }); bar.ItemAppearance.Normal.ForeColor = Color.Red; bar.ItemAppearance.Normal.Font = new Font("宋体", 9, FontStyle.Bold); }
public BarSubItem MapFrom(BarManager barManager, IMenuBarSubMenu menuBarSubMenu) { try { barManager.BeginUpdate(); var existingItem = barManager.Items[menuBarSubMenu.Name]; if (existingItem != null) { return(existingItem as BarSubItem); } var mainMenu = new BarSubItem(barManager, menuBarSubMenu.Caption); foreach (var menuElement in menuBarSubMenu.AllItems()) { var barItem = menuElement.IsAnImplementationOf <IMenuBarButton>() ? _mapper.MapFrom(barManager, menuElement as IMenuBarButton) : MapFrom(barManager, menuElement as IMenuBarSubMenu); mainMenu.AddItem(barItem).BeginGroup = menuElement.BeginGroup; //this is required since sometime this information is not updated as expected mainMenu.LinksPersistInfo[mainMenu.LinksPersistInfo.Count - 1].BeginGroup = menuElement.BeginGroup; } UpdateBarButtonItem(menuBarSubMenu, mainMenu); return(mainMenu); } finally { barManager.EndUpdate(); } }
void CreateBarShortcuts(BarManager barManager, BarSubItem rootMenu) { foreach (var barSubItem in _shortCuts.Select(GetBarItem(barManager))) { barSubItem.ItemClick += BarSubItemOnItemClick; rootMenu.AddItem(barSubItem); } }
/// <summary> /// Handles the BeforePopup event of the popupSeries control. /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data. /// </param> private void popupSeries_BeforePopup(object sender, CancelEventArgs e) { var rows = this.gridViewTvTitleList.GetSelectedRows(); rows.Select(row => this.gridViewTvTitleList.GetRow(row) as MasterSeriesListModel).ToList(); this.popupSeries.ClearLinks(); var addBarItem = new BarSubItem(this.barManager1, "Add Series") { Glyph = Resources.add32 }; this.popupSeries.AddItem(addBarItem); addBarItem.AddItem(new BarButtonItem(this.barManager1, "Add TvDB Series")); addBarItem.AddItem(new BarButtonItem(this.barManager1, "Add Custom Series")); var updateBarItem = new BarSubItem(this.barManager1, "Update Series") { Glyph = Resources.globe32 }; this.popupSeries.AddItem(updateBarItem); updateBarItem.AddItem(new BarButtonItem(this.barManager1, "From TvDB")); var hideItem = new BarButtonItem(this.barManager1, "Hide") { Glyph = Resources.find1 }; hideItem.ItemClick += this.hideItem_ItemClick; this.popupSeries.AddItem(hideItem); var deleteItem = new BarButtonItem(this.barManager1, "Remove") { Glyph = Resources.find1 }; deleteItem.ItemClick += this.deleteItem_ItemClick; this.popupSeries.AddItem(deleteItem); }
/// <summary> /// Добавить новую кнопку в контекстное меню /// </summary> /// <param name="bsi">Кнопка меню, к которой нужно добавить кнопку</param> /// <param name="name">Название кнопки</param> /// <param name="click">Обработчик нажатия</param> /// <param name="glyph">Изображение на кнопке</param> /// <param name="tag">Tag</param> public static BarButtonItem AddBarButton(this BarSubItem bsi, string name, ItemClickEventHandler click, object tag = null, Bitmap glyph = null) { var addBarButton = new BarButtonItem { Caption = name, Glyph = glyph, Tag = tag }; addBarButton.ItemClick += click; bsi.AddItem(addBarButton); return(addBarButton); }
private void popupSeries_BeforePopup(object sender, System.ComponentModel.CancelEventArgs e) { var rows = gridViewTvTitleList.GetSelectedRows(); var seriesList = rows.Select(row => this.gridViewTvTitleList.GetRow(row) as MasterSeriesListModel).ToList(); popupSeries.ClearLinks(); var addBarItem = new BarSubItem(barManager1, "Add Series"); addBarItem.Glyph = Resources.add32; popupSeries.AddItem(addBarItem); addBarItem.AddItem(new BarButtonItem(barManager1, "Add TvDB Series")); addBarItem.AddItem(new BarButtonItem(barManager1, "Add Custom Series")); var updateBarItem = new BarSubItem(barManager1, "Update Series"); updateBarItem.Glyph = Resources.globe32; popupSeries.AddItem(updateBarItem); updateBarItem.AddItem(new BarButtonItem(barManager1, "From TvDB")); }
void AddImageFormat(BarSubItem biImagesMenuItem, ImageFormat format) { ImageCodecInfo codecInfo = FindImageCodec(format); if (codecInfo == null) { return; } BarExportToImageItem item = new BarExportToImageItem(this.manager, format, codecInfo); item.ItemClick += new ItemClickEventHandler(OnExportImageClick); biImagesMenuItem.AddItem(item); }
//加载模块功能 private void LoadModuleFunction(NavBarGroup CurrentGroup, BarSubItem CurrentBarItem, ModuleFunction fun) { if (CurrentGroup != null) { //添加功能到navBarControl1 NavBarItem item = navBarControl1.Items.Add(); item.Caption = fun.Caption; item.Tag = fun.FunctionID; //item.SmallImage = FunSmallImage; //item.SmallImage = imageList1.Images["Forward"]; item.SmallImage = Common.ImageLibrary.ResizeImage(fun.FormIcon, 16, 16); //item.SmallImage = Common.ImageLibrary.ResizeImage(fun.LoadFormEx().Icon.ToBitmap(), 16, 16); item.LinkClicked += item_LinkClicked; CurrentGroup.ItemLinks.Insert(0, item); if (fun.IsNew) { item.Appearance.ForeColor = Color.FromArgb(0x99, 0x00, 0x33); item.Appearance.Font = new Font(CurrentGroup.Appearance.Font, FontStyle.Bold); } } if (CurrentBarItem != null) { //添加功能到bbi_Module var bbif = new DevExpress.XtraBars.BarButtonItem() { Caption = fun.Caption, Tag = fun.FunctionID, //Glyph = FunSmallImage Glyph = imageList1.Images["Forward"] }; //if (fun.IsNew) //{ // item.Appearance.ForeColor = Color.FromArgb(0x99, 0x00, 0x33); // item.Appearance.Font = new Font(CurrentGroup.Appearance.Font, FontStyle.Bold); //} bbif.ItemClick += bbi_ItemClick; this.ribbonControl1.Items.Add(bbif); if (CurrentBarItem.ItemLinks.Count > 0) { CurrentBarItem.InsertItem(CurrentBarItem.ItemLinks[0], bbif); } else { CurrentBarItem.AddItem(bbif); } } }
/// <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()); }
public void YazdirmaSecenekleriniEkle(BarSubItem btnYazdir, DizaynTipi dizaynTipi, ItemClickEventHandler action) { var resYSecenekleri = raporDal.GetAll(context, x => x.DizaynTipi == dizaynTipi.ToString()); //var resYSecenekleri = repo.Rapor.Getir(x => x.DizaynTipi == dizaynTipi.ToString()); btnYazdir.ClearLinks(); foreach (var item in resYSecenekleri) { var br = CreateItem(item); btnYazdir.AddItem(br); br.ItemClick += action; } }
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.Replace("&", ""); navGroup.Name = "navGroup" + menuItem.URL; navGroup.LargeImage = navGroup.SmallImage = HCMIS.Desktop.Helpers.ViewHelper.LoadImageFromResource(menuItem.Icon, 24, 24); foreach (var subMenu in menuItem.SubMenus) { // top-most menuStrip var subToolStripMenu = new BarButtonItem(barManager1, subMenu.Text); subToolStripMenu.ItemClick += new ItemClickEventHandler(subToolStripMenu_ItemClick); subToolStripMenu.Glyph = subToolStripMenu.LargeGlyph = HCMIS.Desktop.Helpers.ViewHelper.LoadImageFromResource(subMenu.Icon, 16, 16); ;// new EventHandler(commonHandler ); subToolStripMenu.Tag = subMenu.URL; // left-side navigation var navLink = navBarControl.Items.Add(); navLink.Caption = subMenu.Text.Replace("&", ""); navLink.Name = "navLink" + subMenu.URL; navLink.SmallImage = navLink.LargeImage = HCMIS.Desktop.Helpers.ViewHelper.LoadImageFromResource(subMenu.Icon, 40, 40); 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); subToolStripMenu.ItemClick -= new ItemClickEventHandler(subToolStripMenu_ItemClick); subToolStripMenu.ItemClick += new ItemClickEventHandler(logoutStripMenu_ItemClick); } navGroup.ItemLinks.Add(navLink); toolStripItem.AddItem(subToolStripMenu); } toolStripItem.Alignment = BarItemLinkAlignment.Left; menuBar.AddItem(toolStripItem); } menuBar.AddItem(barVersionInfo2); }
public BarButtonItem AddNewToolbarButton(BarSubItem parentItem, String strCaption, object tag, String strName, int iImageIndex) { BarButtonItem barItem = new BarButtonItem(); barItem.Caption = strCaption; barItem.Name = strName; barItem.Tag = tag; barItem.ImageIndex = iImageIndex; barItem.PaintStyle = BarItemPaintStyle.CaptionGlyph; ToolbarManager.Items.Add(barItem); parentItem.AddItem(barItem); parentItem.LinksPersistInfo.Add(new LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, barItem, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph)); return(barItem); }
public void Extend() { foreach (IMenuItem menuItem in _menuList) { BarItem item = CreateItem(menuItem); if (item != null) { _barSubItemRoot.AddItem(item); if (menuItem.HasSubMenu) { CreateSubMenuItems(menuItem, (BarSubItem)item); } } } }
private void CreateSubMenuItems(IMenuItem menuItem, BarSubItem subItem) { foreach (IMenuItem m in menuItem.SubMenus) { BarItem item = CreateItem(m); if (item != null) { subItem.AddItem(item); if (m.HasSubMenu) { CreateSubMenuItems(m, (BarSubItem)item); } } } }
private static void AddAllRibbonItems(WorkItem workItem) { AddBarItem(workItem, "&Cascade", Resources.WindowCascade16, Resources.WindowCascade32, windowMenuHelper.MdiLayoutCascade); AddBarItem(workItem, "Tile &Horizontally", Resources.WindowsTileHoriz16, Resources.WindowsTileHoriz32, windowMenuHelper.MdiLayoutTileHorizontal); AddBarItem(workItem, "Tile &Vertically", Resources.WindowsTileVert16, Resources.WindowsTileVert32, windowMenuHelper.MdiLayoutTileVertical); BarCheckItem bbiTabbed = AddCheckItem(workItem, "&Use Tabbed MDI", windowMenuHelper.MdiChangeMode); bbiTabbed.Checked = true; BarSubItem bsiWindows = new BarSubItem(); bsiWindows.Caption = "&Windows"; AddItem(bsiWindows, workItem); bsiWindows.AddItem(new BarMdiChildrenListItem()); }
private void AddAllMenuItems() { BarButtonItem bbiTabbed = AddBarItem("&Use Tabbed MDI", null, null, menuHelper.MdiChangeMode); bbiTabbed.ButtonStyle = BarButtonStyle.Check; bbiTabbed.Down = true; AddBarItem("&Cascade", Resources.WindowCascade16, Resources.WindowCascade32, menuHelper.MdiLayoutCascade); AddBarItem("Tile &Horizontally", Resources.WindowsTileHoriz16, Resources.WindowsTileHoriz32, menuHelper.MdiLayoutTileHorizontal); AddBarItem("Tile &Vertically", Resources.WindowsTileVert16, Resources.WindowsTileVert32, menuHelper.MdiLayoutTileVertical); BarSubItem bsiWindows = new BarSubItem(Manager, "&Windows"); AddItem(bsiWindows); bsiWindows.AddItem(new BarMdiChildrenListItem()); }
void CreateBECEQuestionGroupGroup(IGrouping <string, BeceFileInfo> questionGroup) { BarSubItem bsItem = new BarSubItem() { Tag = questionGroup }; bsItem.Caption = questionGroup.Key.ToUpper(); foreach (var question in questionGroup) { var bbItem = new BarButtonItem(); bbItem.Caption = question.Year.ToString(); bbItem.ItemClick += (s, e) => ProcessHelper.Start(question.FileName, string.Empty); bsItem.AddItem(bbItem); } bsiBece.AddItem(bsItem); }
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); }
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); }
/// <summary> /// Add BarItem into barSubItem. /// </summary> /// <typeparam name="T">Type of BarItem.</typeparam> /// <param name="barSubItem">Owner item</param> /// <param name="caption">Caption of BarItem.</param> /// <param name="glyph">Glyph of BarItem.</param> /// <param name="key">Key of BarItem (ItemShortcut).</param> /// <param name="itemClick">ItemClick of BarItem.</param> /// <returns>Returns added BarItem</returns> public static T AddBarItem <T>(this BarSubItem barSubItem, string caption, Image glyph, Keys key = Keys.None, ItemClickEventHandler itemClick = null) where T : BarItem, new() { var item = new T { Caption = caption, Glyph = glyph }; if (key != Keys.None) { item.ItemShortcut = new BarShortcut(key); } barSubItem.AddItem(item); if (itemClick != null) { item.ItemClick += itemClick; } return(item); }
private void LoadReportMenu() { barReportPreview.ClearLinks(); var path = Application .ExecutablePath .Substring(0, Application.ExecutablePath.LastIndexOf('\\')); foreach (var f in Directory.EnumerateFiles(path, "*.repx")) { BarSubItem b = new BarSubItem(barMain, f); BarButtonItem edit = new BarButtonItem(barMain, "Edit"); edit.ItemClick += new ItemClickEventHandler(edit_ItemClick); edit.Tag = f; b.AddItem(edit); b.Tag = f; b.Caption = f.Substring(f.LastIndexOf('\\') + 1, f.Length - f.LastIndexOf('\\') - 1); b.ItemClick += new ItemClickEventHandler(preview_ItemClick); barReportPreview.ItemLinks.Add(b); } }
private void CreateBonusSkins(BarSubItem subItem) { foreach (BarItemLink item in subItem.ItemLinks) { if (bonusSkinNames.IndexOf(string.Format(";{0}", item.Caption)) > -1) { MIBonusSkin.AddItem(item.Item); } } if (miBonusSkins == null) { return; } miLookAndFeel.AddItem(miBonusSkins); for (int i = subItem.ItemLinks.Count - 1; i >= 0; i--) { if (bonusSkinNames.IndexOf(string.Format(";{0}", subItem.ItemLinks[i].Caption)) > -1) { miSkin.RemoveLink(subItem.ItemLinks[i]); } } }
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")); } }
private void CustomizeMainMenuTollBar(XtraFormTemplateBase form) { if (form != null) { BarManager manager = form.BarManager; if (manager != null) { Bar bar = null; foreach (Bar b in manager.Bars) { if (b.IsMainMenu == true) { bar = b; break; } } if (bar != null) { BarSubItem item = new BarSubItem(manager, "iTEST"); item.Name = "iTEST"; IActionContainer container = form.ActionContainersManager.ActionContainerComponents.Find(a => a.ContainerId == "TEST"); ActionContainerMenuBarItem cTEST = container as ActionContainerMenuBarItem; //ActionContainerMenuBarItem cTEST = new ActionContainerMenuBarItem() //{ // ContainerId = "TEST", // Name = "cTEST" //}; //BarItemLink cViewLink = null; //foreach (BarItemLink link in bar.ItemLinks) //{ // if (link.Item.Name == "View") // cViewLink = link; //} item.AddItem(cTEST); //// manager.Items.Insert(0, item); //bar.InsertItem(cViewLink, item); ////bar.AddItem(item); //form.ActionContainersManager.ActionContainerComponents.Add(cTEST); BarItemLink toolLink = null; //BarItemLink iTESTLink = null; foreach (BarItemLink link in bar.ItemLinks) { if (link.Item.Name == "barSubItemTools") toolLink = link; //if (link.Item.Name == "iTEST") // iTESTLink = link; } //if(iTESTLink!=null) // Console.WriteLine(iTESTLink.Caption); //if (toolLink != null) // Console.WriteLine(toolLink.Caption); bar.InsertItem(toolLink, item); //item.AddItem(cTEST); // manager.Items.Insert(0, item); //bar.InsertItem(cViewLink, item); //bar.AddItem(item); //form.ActionContainersManager.ActionContainerComponents.Add(cTEST); } } } }
private void ProcessActionTree(BarManager manager, BarSubItem parentBar, BarSubItem childBar, ChoiceActionItem actionItem) { childBar.Name = Guid.NewGuid().ToString(); parentBar.AddItem(childBar); foreach (ChoiceActionItem item in actionItem.Items) { BarSubItem subChildBar = new BarSubItem(manager, item.Caption); if (item.Items.Count > 0) { ProcessActionTree(manager, childBar, subChildBar, item); } else { AddBarButtonItem(manager, childBar, item); } } }
private void UpdateFileNameSetupButton(IIndexField[] indexFields) { foreach (DefaultName name in DefaultName.GeneralValues) { pmFileName.AddItem(CreateBarButtonItem(name)); pmFolderPath.AddItem(CreateBarButtonItem(name)); } BarSubItem dateGroup = new BarSubItem(); dateGroup.Name = dateGroup.Caption = DefaultName.DateGroupName; dateGroup.ClearLinks(); pmFileName.AddItem(dateGroup); pmFolderPath.AddItem(dateGroup); foreach (DefaultName name in DefaultName.DateValues) dateGroup.AddItem(CreateBarButtonItem(name)); BarSubItem timeGroup = new BarSubItem(); timeGroup.Caption = DefaultName.TimeGroupName; timeGroup.ClearLinks(); pmFileName.AddItem(timeGroup); pmFolderPath.AddItem(timeGroup); foreach (DefaultName name in DefaultName.TimeValues) timeGroup.AddItem(CreateBarButtonItem(name)); if (indexFields != null && indexFields.Length > 0) { BarSubItem indexGroup = new BarSubItem(); indexGroup.Caption = "Index Fields"; indexGroup.ClearLinks(); pmFileName.AddItem(indexGroup); pmFolderPath.AddItem(indexGroup); for (int i = 0; i < indexFields.Length; i++) { BarButtonItem barButtonItem = new BarButtonItem(); barButtonItem.Caption = DefaultName.IndexValue.DescriptionOf(i + 1) + " - " + indexFields[i].Label; barButtonItem.Tag = DefaultName.IndexValue.TagOf(i + 1); barButtonItem.ItemClick += barButtonItem_ItemClick; indexGroup.AddItem(barButtonItem); } } }
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 void LoadTopMenus(RibbonControl iMaster) { RibbonPage pgActions = new RibbonPage("Home"); pgActions.Name = "Home"; RibbonPageGroup grpActions = new RibbonPageGroup("Purchase"); RibbonPageGroup grpUsers = new RibbonPageGroup("Adminstration"); RibbonPageGroup grpSales = new RibbonPageGroup("Sales"); RibbonPageGroup grpSetups = new RibbonPageGroup("Setups"); RibbonPageGroup grpReports = new RibbonPageGroup("Reports"); BarButtonItem DirectInvoice = new BarButtonItem(); iMaster.Items.Add(DirectInvoice); DirectInvoice.Caption = "Direct Purchase"; DirectInvoice.LargeImageIndex = 13; DirectInvoice.Id = iMaster.Manager.GetNewItemId(); //Ensures correct runtime layout (de)serialization. // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); DirectInvoice.ItemClick += new ItemClickEventHandler(DirectInvoice_ItemClick); BarButtonItem rUsers = new BarButtonItem(); iMaster.Items.Add(rUsers); rUsers.Caption = "Users"; rUsers.LargeImageIndex = 9; // rUsers.ImageIndex = 9; rUsers.Id = iMaster.Manager.GetNewItemId(); //Ensures correct runtime layout (de)serialization. // rUsers.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rUsers.ItemClick += new ItemClickEventHandler(rUsers_ItemClick); BarButtonItem rUsersRoles = new BarButtonItem(); iMaster.Items.Add(rUsersRoles); rUsersRoles.Caption = "Users Roles"; rUsersRoles.LargeImageIndex = 10; rUsersRoles.Id = iMaster.Manager.GetNewItemId(); // rUsersRoles.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rUsersRoles.ItemClick += new ItemClickEventHandler(rUsersRoles_ItemClick); BarButtonItem rRoles = new BarButtonItem(); iMaster.Items.Add(rRoles); rRoles.Caption = "Roles"; rRoles.LargeImageIndex = 21; rRoles.Id = iMaster.Manager.GetNewItemId(); // rUsersRoles.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rRoles.ItemClick += new ItemClickEventHandler(rRoles_ItemClick); BarButtonItem rPOReceipt = new BarButtonItem(); iMaster.Items.Add(rPOReceipt); rPOReceipt.Caption = "PO Receipt"; rPOReceipt.LargeImageIndex = 15; rPOReceipt.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rPOReceipt.ItemClick += new ItemClickEventHandler(rPOReceipt_ItemClick); BarButtonItem rSupplierPayment = new BarButtonItem(); iMaster.Items.Add(rSupplierPayment); rSupplierPayment.Caption = "Supplier Payment"; rSupplierPayment.LargeImageIndex = 12; rSupplierPayment.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rSupplierPayment.ItemClick += new ItemClickEventHandler(rSupplierPayment_ItemClick); BarButtonItem rReturnOutwards = new BarButtonItem(); iMaster.Items.Add(rReturnOutwards); rReturnOutwards.Caption = "Return Outwards"; rReturnOutwards.LargeImageIndex = 14; rReturnOutwards.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rReturnOutwards.ItemClick += new ItemClickEventHandler(rReturnOutwards_ItemClick); BarButtonItem rSalesOrder = new BarButtonItem(); iMaster.Items.Add(rSalesOrder); rSalesOrder.Caption = "Sales Order"; rSalesOrder.LargeImageIndex = 16; rSalesOrder.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rSalesOrder.ItemClick += new ItemClickEventHandler(rSalesOrder_ItemClick); BarButtonItem rCustomerReceipt = new BarButtonItem(); iMaster.Items.Add(rCustomerReceipt); rCustomerReceipt.Caption = "Customer Receipt"; rCustomerReceipt.LargeImageIndex = 19; rCustomerReceipt.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rCustomerReceipt.ItemClick += new ItemClickEventHandler(rCustomerReceipt_ItemClick); BarButtonItem rReturnInwards = new BarButtonItem(); iMaster.Items.Add(rReturnInwards); rReturnInwards.Caption = "Return Inwards"; rReturnInwards.LargeImageIndex = 18; rReturnInwards.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rReturnInwards.ItemClick += new ItemClickEventHandler(rReturnInwards_ItemClick); BarButtonItem rCustomerRefunds = new BarButtonItem(); iMaster.Items.Add(rCustomerRefunds); rCustomerRefunds.Caption = "Customer Refunds"; rCustomerRefunds.LargeImageIndex = 17; rCustomerRefunds.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rCustomerRefunds.ItemClick += new ItemClickEventHandler(rCustomerRefunds_ItemClick); BarButtonItem rCostRevision = new BarButtonItem(); iMaster.Items.Add(rCostRevision); rCostRevision.Caption = "Cost/Price Revisions"; rCostRevision.LargeImageIndex = 22; rCostRevision.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rCostRevision.ItemClick += new ItemClickEventHandler(rCostRevision_ItemClick); BarButtonItem rSaleSummary = new BarButtonItem(); iMaster.Items.Add(rSaleSummary); rSaleSummary.Caption = "Sales Summary"; rSaleSummary.LargeImageIndex = 22; rSaleSummary.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rSaleSummary.ItemClick += new ItemClickEventHandler(rSaleSummary_ItemClick); BarButtonItem rCustomerInvoices = new BarButtonItem(); iMaster.Items.Add(rCustomerInvoices); rCustomerInvoices.Caption = "Customer Invoices"; rCustomerInvoices.LargeImageIndex = 22; rCustomerInvoices.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rCustomerInvoices.ItemClick += new ItemClickEventHandler(rCustomerInvoices_ItemClick); BarButtonItem rCustomerBalances = new BarButtonItem(); iMaster.Items.Add(rCustomerBalances); rCustomerBalances.Caption = "Customer Balances"; rCustomerBalances.LargeImageIndex = 22; rCustomerBalances.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rCustomerBalances.ItemClick += new ItemClickEventHandler(rCustomerBalances_ItemClick); BarButtonItem rCreditNotes = new BarButtonItem(); iMaster.Items.Add(rCreditNotes); rCreditNotes.Caption = "Credit Notes"; rCreditNotes.LargeImageIndex = 22; rCreditNotes.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rCreditNotes.ItemClick += new ItemClickEventHandler(rCreditNotes_ItemClick); BarSubItem Setups = new BarSubItem(); iMaster.Items.Add(Setups); Setups.Caption = "Setups"; Setups.LargeImageIndex = 25; Setups.Id = iMaster.Manager.GetNewItemId(); //Ensures correct runtime layout (de)serialization. BarButtonItem rItemMaster = new BarButtonItem(); iMaster.Items.Add(rItemMaster); rItemMaster.Caption = "Item Master"; rItemMaster.LargeImageIndex = 23; rItemMaster.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rItemMaster.ItemClick += new ItemClickEventHandler(rItemMaster_ItemClick); BarButtonItem rCustomers = new BarButtonItem(); iMaster.Items.Add(rCustomers); rCustomers.Caption = "Customers"; rCustomers.ImageIndex = 15; Setups.AddItem(rCustomers); rCustomers.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rCustomers.ItemClick += new ItemClickEventHandler(rCustomers_ItemClick); BarButtonItem rSuppliers = new BarButtonItem(); iMaster.Items.Add(rSuppliers); rSuppliers.Caption = "Suppliers"; rSuppliers.ImageIndex = 16; Setups.AddItem(rSuppliers); rSuppliers.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rSuppliers.ItemClick += new ItemClickEventHandler(rSuppliers_ItemClick); BarButtonItem rCategory = new BarButtonItem(); iMaster.Items.Add(rCategory); rCategory.Caption = "Categories"; rCategory.ImageIndex = 19; Setups.AddItem(rCategory); rCategory.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rCategory.ItemClick += new ItemClickEventHandler(rCategory_ItemClick); BarButtonItem rUOM = new BarButtonItem(); iMaster.Items.Add(rUOM); rUOM.Caption = "UOM"; rUOM.ImageIndex = 17; Setups.AddItem(rUOM); rUOM.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rUOM.ItemClick += new ItemClickEventHandler(rUOM_ItemClick); BarButtonItem rUOMConversions = new BarButtonItem(); iMaster.Items.Add(rUOMConversions); rUOMConversions.Caption = "UOM Conversions"; rUOMConversions.ImageIndex = 18; Setups.AddItem(rUOMConversions); rUOMConversions.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rUOMConversions.ItemClick += new ItemClickEventHandler(rUOMConversions_ItemClick); BarButtonItem rPriceBands = new BarButtonItem(); iMaster.Items.Add(rPriceBands); rPriceBands.Caption = "Price Bands"; rPriceBands.ImageIndex = 20; Setups.AddItem(rPriceBands); rPriceBands.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rPriceBands.ItemClick += new ItemClickEventHandler(rPriceBands_ItemClick); BarButtonItem rWareHouses = new BarButtonItem(); iMaster.Items.Add(rWareHouses); rWareHouses.Caption = "Warehouses"; rWareHouses.ImageIndex = 21; Setups.AddItem(rWareHouses); rWareHouses.Id = iMaster.Manager.GetNewItemId(); // EmployeeInfo.RibbonStyle = ((DevExpress.XtraBars.Ribbon.RibbonItemStyles)((DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText))); rWareHouses.ItemClick += new ItemClickEventHandler(rWareHouses_ItemClick); RibbonPageGroup Skins = new RibbonPageGroup(); RibbonGalleryBarItem rgbiSkins = new DevExpress.XtraBars.RibbonGalleryBarItem(); rgbiSkins.Caption = "Skins"; rgbiSkins.Gallery.AllowHoverImages = true; rgbiSkins.Gallery.Appearance.ItemCaptionAppearance.Normal.Options.UseFont = true; rgbiSkins.Gallery.Appearance.ItemCaptionAppearance.Normal.Options.UseTextOptions = true; rgbiSkins.Gallery.Appearance.ItemCaptionAppearance.Normal.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; rgbiSkins.Gallery.ColumnCount = 4; rgbiSkins.Gallery.FixedHoverImageSize = false; rgbiSkins.Gallery.ImageSize = new System.Drawing.Size(32, 17); rgbiSkins.Gallery.ItemImageLocation = DevExpress.Utils.Locations.Top; rgbiSkins.Gallery.RowCount = 4; rgbiSkins.Id = 60; rgbiSkins.Name = "rgbiSkins"; iMaster.Items.AddRange(new DevExpress.XtraBars.BarItem[] { rgbiSkins }); Skins.ItemLinks.Add(rgbiSkins); Skins.Name = "skinsRibbonPageGroup"; Skins.ShowCaptionButton = false; Skins.Text = "Skins"; SkinHelper.InitSkinGallery(rgbiSkins, true); grpSetups.ItemLinks.AddRange(new BarItem[] { rItemMaster, rCostRevision, rCustomers, rSuppliers }); grpSetups.ItemLinks.AddRange(Setups); grpSales.ItemLinks.AddRange(new BarItem[] { rSalesOrder, rCustomerReceipt, rReturnInwards, rCustomerRefunds }); grpUsers.ItemLinks.AddRange(new BarItem[] { rUsers, rRoles, rUsersRoles }); grpActions.ItemLinks.AddRange(new BarItem[] { DirectInvoice, rSupplierPayment, rReturnOutwards }); grpReports.ItemLinks.AddRange(new BarItem[] { rSaleSummary, rCustomerInvoices, rCustomerBalances, rCreditNotes }); pgActions.Groups.Add(grpUsers); pgActions.Groups.Add(grpSales); pgActions.Groups.Add(Skins); pgActions.Groups.Add(grpActions); pgActions.Groups.Add(grpSetups); pgActions.Groups.Add(grpReports); iMaster.Pages.Add(pgActions); }
/// <versions>20-02-2018(GesAMFC-v1.0.0.3)</versions> private void SetMenuOptions() { try { System.Drawing.Font objFontMenu = new System.Drawing.Font("Verdana", 13); System.Drawing.Font objFontSubMenu = new System.Drawing.Font("Verdana", 11); #region Members BarSubItem objSubItem_Members = new BarSubItem(); objSubItem_Members.Appearance.Font = objFontMenu; objSubItem_Members.Caption = "SÓCIOS"; this.BarMainMenu.AddItem(objSubItem_Members); #region Ficha Sócio BarButtonItem objButtonItem_MemberFile = new BarButtonItem(); objButtonItem_MemberFile.Appearance.Font = objFontSubMenu; objButtonItem_MemberFile.Caption = "FICHAS SÓCIOS"; objButtonItem_MemberFile.Tag = "Members"; objButtonItem_MemberFile.ButtonStyle = BarButtonStyle.Default; objButtonItem_MemberFile.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Members.AddItem(objButtonItem_MemberFile); #endregion Ficha Sócio #region Lotes Sócio BarButtonItem objButtonItem_MemberlLotes = new BarButtonItem(); objButtonItem_MemberlLotes.Appearance.Font = objFontSubMenu; objButtonItem_MemberlLotes.Caption = "LOTES SÓCIOS"; objButtonItem_MemberlLotes.Tag = "Lotes"; objButtonItem_MemberlLotes.ButtonStyle = BarButtonStyle.Default; objButtonItem_MemberlLotes.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Members.AddItem(objButtonItem_MemberlLotes); #endregion Lotes Sócio #endregion Members #region Payments BarSubItem objSubItem_Payments = new BarSubItem(); objSubItem_Payments.Appearance.Font = objFontMenu; objSubItem_Payments.Caption = "PAGAMENTOS"; this.BarMainMenu.AddItem(objSubItem_Payments); #region Cash On Hand BarButtonItem objButtonItem_CashPayments = new BarButtonItem(); objButtonItem_CashPayments.Appearance.Font = objFontSubMenu; objButtonItem_CashPayments.Caption = "CAIXA"; objButtonItem_CashPayments.Tag = "Caixa"; objButtonItem_CashPayments.ButtonStyle = BarButtonStyle.Default; objButtonItem_CashPayments.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Payments.AddItem(objButtonItem_CashPayments); #endregion Cash On Hand #region Admission Fee BarButtonItem objButtonItem_Joias = new BarButtonItem(); objButtonItem_Joias.Appearance.Font = objFontSubMenu; objButtonItem_Joias.Caption = "JOIAS"; objButtonItem_Joias.Tag = "Joias"; objButtonItem_Joias.ButtonStyle = BarButtonStyle.Default; objButtonItem_Joias.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Payments.AddItem(objButtonItem_Joias); #endregion Admission Fee #region Periodic Member Due BarButtonItem objButtonItem_Quotas = new BarButtonItem(); objButtonItem_Quotas.Appearance.Font = objFontSubMenu; objButtonItem_Quotas.Caption = "QUOTAS"; objButtonItem_Quotas.Tag = "Quotas"; objButtonItem_Quotas.ButtonStyle = BarButtonStyle.Default; objButtonItem_Quotas.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Payments.AddItem(objButtonItem_Quotas); #endregion Periodic Member Due #region Infrastructures BarButtonItem objButtonItem_Infrastructures = new BarButtonItem(); objButtonItem_Infrastructures.Appearance.Font = objFontSubMenu; objButtonItem_Infrastructures.Caption = "INFRAESTRUTURAS"; objButtonItem_Infrastructures.Tag = "Infraestruturas"; objButtonItem_Infrastructures.ButtonStyle = BarButtonStyle.Default; objButtonItem_Infrastructures.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Payments.AddItem(objButtonItem_Infrastructures); #endregion Infrastructures #region Land Area Transfer BarButtonItem objButtonItem_LandAreaTransfer = new BarButtonItem(); objButtonItem_LandAreaTransfer.Appearance.Font = objFontSubMenu; objButtonItem_LandAreaTransfer.Caption = "CEDÊNCIAS TERRENO"; objButtonItem_LandAreaTransfer.Tag = "Cedências"; objButtonItem_LandAreaTransfer.ButtonStyle = BarButtonStyle.Default; objButtonItem_LandAreaTransfer.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Payments.AddItem(objButtonItem_LandAreaTransfer); #endregion Land Area Transfer #region Sewers BarButtonItem objButtonItem_Sewers = new BarButtonItem(); objButtonItem_Sewers.Appearance.Font = objFontSubMenu; objButtonItem_Sewers.Caption = "ESGOTOS"; objButtonItem_Sewers.Tag = "Esgotos"; objButtonItem_Sewers.ButtonStyle = BarButtonStyle.Default; objButtonItem_Sewers.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Payments.AddItem(objButtonItem_Sewers); #endregion Sewers #region Urban Reconversion BarButtonItem objButtonItem_UrbanReconversion = new BarButtonItem(); objButtonItem_UrbanReconversion.Appearance.Font = objFontSubMenu; objButtonItem_UrbanReconversion.Caption = "RECONVERSÃO URBANÍSTICA"; objButtonItem_UrbanReconversion.Tag = "Reconversao"; objButtonItem_UrbanReconversion.ButtonStyle = BarButtonStyle.Default; objButtonItem_UrbanReconversion.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Payments.AddItem(objButtonItem_UrbanReconversion); #endregion Urban Reconversion #region Other Payments //BarButtonItem objButtonItem_OtherPayments = new BarButtonItem(); //objButtonItem_OtherPayments.Appearance.Font = objFontSubMenu; //objButtonItem_OtherPayments.Caption = "Outros pagamentos"; //objButtonItem_OtherPayments.Tag = "OtherPayments"; //objButtonItem_OtherPayments.ButtonStyle = BarButtonStyle.Default; //objButtonItem_OtherPayments.ItemClick += new ItemClickEventHandler(MenuItemClicked); //objSubItem_Payments.AddItem(objButtonItem_OtherPayments); #endregion Other Payments #endregion Payments #region CONTA CORRENTE BarSubItem objSubItem_CC = new BarSubItem(); objSubItem_CC.Caption = "CONTA CORRENTE"; objSubItem_CC.Appearance.Font = objFontMenu; this.BarMainMenu.AddItem(objSubItem_CC); #region CC INFRA BarButtonItem objButtonItem_CCINFRA = new BarButtonItem(); objButtonItem_CCINFRA.Appearance.Font = objFontSubMenu; objButtonItem_CCINFRA.Caption = "INFRAESTRUTURAS"; objButtonItem_CCINFRA.Tag = "CC_INFRA"; objButtonItem_CCINFRA.ButtonStyle = BarButtonStyle.Default; objButtonItem_CCINFRA.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_CC.AddItem(objButtonItem_CCINFRA); #endregion CC INFRA #region CC CEDEN BarButtonItem objButtonItem_CCCEDEN = new BarButtonItem(); objButtonItem_CCCEDEN.Appearance.Font = objFontSubMenu; objButtonItem_CCCEDEN.Caption = "CEDÊNCIAS"; objButtonItem_CCCEDEN.Tag = "CC_CEDEN"; objButtonItem_CCCEDEN.ButtonStyle = BarButtonStyle.Default; objButtonItem_CCCEDEN.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_CC.AddItem(objButtonItem_CCCEDEN); #endregion CC CEDEN #region CC ESGOT BarButtonItem objButtonItem_CCESGOT = new BarButtonItem(); objButtonItem_CCESGOT.Appearance.Font = objFontSubMenu; objButtonItem_CCESGOT.Caption = "ESGOTOS"; objButtonItem_CCESGOT.Tag = "CC_ESGOT"; objButtonItem_CCESGOT.ButtonStyle = BarButtonStyle.Default; objButtonItem_CCESGOT.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_CC.AddItem(objButtonItem_CCESGOT); #endregion CC ESGOT #region CC RECON BarButtonItem objButtonItem_CCRECON = new BarButtonItem(); objButtonItem_CCRECON.Appearance.Font = objFontSubMenu; objButtonItem_CCRECON.Caption = "RECONVERSÃO URBANÍSTICA"; objButtonItem_CCRECON.Tag = "CC_RECON"; objButtonItem_CCRECON.ButtonStyle = BarButtonStyle.Default; objButtonItem_CCRECON.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_CC.AddItem(objButtonItem_CCRECON); #endregion CC RECON #endregion CONTA CORRENTE #region Receipts BarSubItem objSubItem_Receipts = new BarSubItem(); objSubItem_Receipts.Appearance.Font = objFontMenu; objSubItem_Receipts.Caption = "RECIBOS"; this.BarMainMenu.AddItem(objSubItem_Receipts); #region Pay Receipts BarButtonItem objButtonItem_PayReceipts = new BarButtonItem(); objButtonItem_PayReceipts.Appearance.Font = objFontSubMenu; objButtonItem_PayReceipts.Caption = "RECIBOS PAGAMENTO"; objButtonItem_PayReceipts.Tag = "Recibos_Pagamento"; objButtonItem_PayReceipts.ButtonStyle = BarButtonStyle.Default; objButtonItem_PayReceipts.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Receipts.AddItem(objButtonItem_PayReceipts); #endregion Pay Receipts #region Pay Receipts //BarButtonItem objButtonItem_QuotasReceipts = new BarButtonItem(); //objButtonItem_QuotasReceipts.Appearance.Font = objFontSubMenu; //objButtonItem_QuotasReceipts.Caption = "RECIBOS QUOTAS"; //objButtonItem_QuotasReceipts.Tag = "Recibos_Quotas"; //objButtonItem_QuotasReceipts.ButtonStyle = BarButtonStyle.Default; //objButtonItem_QuotasReceipts.ItemClick += new ItemClickEventHandler(MenuItemClicked); //objSubItem_Receipts.AddItem(objButtonItem_QuotasReceipts); #endregion Pay Receipts #endregion Receipts #region Communicated BarSubItem objSubItem_Communicated = new BarSubItem(); objSubItem_Communicated.Appearance.Font = objFontMenu; objSubItem_Communicated.Caption = "CARTAS"; this.BarMainMenu.AddItem(objSubItem_Communicated); #region Envelopes BarButtonItem objButtonItem_Envelopes = new BarButtonItem(); objButtonItem_Envelopes.Appearance.Font = objFontSubMenu; objButtonItem_Envelopes.Caption = "ENVELOPES"; objButtonItem_Envelopes.Tag = "Envelopes"; objButtonItem_Envelopes.ButtonStyle = BarButtonStyle.Default; objButtonItem_Envelopes.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Communicated.AddItem(objButtonItem_Envelopes); #endregion Envelopes //#region Letters //BarButtonItem objButtonItem_Letters = new BarButtonItem(); //objButtonItem_Letters.Appearance.Font = objFontSubMenu; //objButtonItem_Letters.Caption = "Cartas"; //objButtonItem_Letters.Tag = "Letters"; //objButtonItem_Letters.ButtonStyle = BarButtonStyle.Default; //objButtonItem_Letters.ItemClick += new ItemClickEventHandler(MenuItemClicked); //objSubItem_Communicated.AddItem(objButtonItem_Letters); //#endregion Letters #endregion Communicated #region Documents BarSubItem objSubItem_Documents = new BarSubItem(); objSubItem_Documents.Appearance.Font = objFontMenu; objSubItem_Documents.Caption = "DOCUMENTOS"; this.BarMainMenu.AddItem(objSubItem_Documents); #region NIB BarButtonItem objButtonItem_NIB = new BarButtonItem(); objButtonItem_NIB.Appearance.Font = objFontSubMenu; objButtonItem_NIB.Caption = "NIB/IBAN ASSOCIAÇÃO"; objButtonItem_NIB.Tag = "NIB"; objButtonItem_NIB.ButtonStyle = BarButtonStyle.Default; objButtonItem_NIB.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Documents.AddItem(objButtonItem_NIB); #endregion NIB #region Parametros BarButtonItem objButtonItem_Parametros = new BarButtonItem(); objButtonItem_Parametros.Appearance.Font = objFontSubMenu; objButtonItem_Parametros.Caption = "PARÂMETROS PAGAMENTOS"; objButtonItem_Parametros.Tag = "Parametros"; objButtonItem_Parametros.ButtonStyle = BarButtonStyle.Default; objButtonItem_Parametros.ItemClick += new ItemClickEventHandler(MenuItemClicked); objSubItem_Documents.AddItem(objButtonItem_Parametros); #endregion Parametros #endregion Documents } catch (Exception ex) { Program.HandleError(ex.TargetSite.Name, ex.Message, Program.ErroType.EXCEPTION, true, false); return; } }
private void BuildMenu() { this.barManager_0.ForceLinkCreate(); BarManager manager = null; bool flag = false; BarSubItem item = new BarSubItem(); MenusService menusSer = new MenusService(); TList <Menus> lstMainMenu = menusSer.GetAll(); foreach (Menus menu in lstMainMenu) { if (menu.Subitem == 1 && menu.Skip == true) { item = new BarSubItem(manager, menu.Prompt.Trim()); item.Name = menu.Menukey.Trim(); this.menuBar.AddItem(item); continue; } if (menu.Menukey.Trim() == "/-") { flag = true; continue; } if (menu.Subitem == 2 && menu.Skip == true) { BarSubItem item2 = new BarSubItem(manager, menu.Prompt.ToString()); item2.Tag = menu.Id.ToString(); item2.Enabled = menu.Skip == null ? false : menu.Skip.Value; item2.ImageIndex = menu.Imageidx == null ? -1 : menu.Imageidx.Value; item.AddItem(item2); TList <Menus> lstSubMenu = menusSer.Find("parent=" + int.Parse(item2.Tag.ToString())); foreach (Menus submenu in lstSubMenu) { if (submenu.Menukey.Trim() == "/-") { flag = true; } else { BarButtonItem item3 = new BarButtonItem(manager, submenu.Prompt, submenu.Imageidx.Value); item3.Tag = submenu.Menukey.Trim(); item3.Enabled = submenu.Skip.Value; BarItemLink link = item2.AddItem(item3); if (flag) { link.BeginGroup = true; flag = false; } } } continue; } if ((menu.Subitem == 0) && (menu.Menukey.Trim() != "/-") && menu.Skip == true) { BarButtonItem item4 = new BarButtonItem(manager, menu.Prompt, menu.Imageidx.Value); item4.Tag = menu.Menukey.Trim(); item4.Enabled = menu.Skip.Value; BarItemLink link2 = item.AddItem(item4); if (!flag) { continue; } link2.BeginGroup = true; flag = false; } } }
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.Replace("&",""); navGroup.Name = "navGroup" + menuItem.URL; navGroup.LargeImage = navGroup.SmallImage = HCMIS.Desktop.Helpers.ViewHelper.LoadImageFromResource(menuItem.Icon,24,24); foreach (var subMenu in menuItem.SubMenus) { // top-most menuStrip var subToolStripMenu = new BarButtonItem(barManager1, subMenu.Text); subToolStripMenu.ItemClick += new ItemClickEventHandler(subToolStripMenu_ItemClick); subToolStripMenu.Glyph = subToolStripMenu.LargeGlyph = HCMIS.Desktop.Helpers.ViewHelper.LoadImageFromResource(subMenu.Icon, 16, 16); ;// new EventHandler(commonHandler ); subToolStripMenu.Tag = subMenu.URL; // left-side navigation var navLink = navBarControl.Items.Add(); navLink.Caption = subMenu.Text.Replace("&", ""); navLink.Name = "navLink" + subMenu.URL; navLink.SmallImage = navLink.LargeImage = HCMIS.Desktop.Helpers.ViewHelper.LoadImageFromResource(subMenu.Icon,40,40); 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); subToolStripMenu.ItemClick -= new ItemClickEventHandler(subToolStripMenu_ItemClick); subToolStripMenu.ItemClick +=new ItemClickEventHandler(logoutStripMenu_ItemClick); } navGroup.ItemLinks.Add(navLink); toolStripItem.AddItem(subToolStripMenu); } toolStripItem.Alignment = BarItemLinkAlignment.Left; menuBar.AddItem( toolStripItem ); } menuBar.AddItem(barVersionInfo2); }
private void StatusBarInitialize() { // bar1.AddItem(NewBarStaticItem("Прием:")); // // for (int i = 0; i < _readPortsValuesStaticItems.Length; i++) // { // bar1.AddItem(NewBarStaticItem("Порт " + (i + 1))); // _readPortsValuesStaticItems[i] = NewBarStaticItem("Value" + (i + 1)); // bar1.AddItem(_readPortsValuesStaticItems[i]); // } bar1.AddItem(NewBarStaticItem("Передача:")); _writePortValueStaticitem.Caption = "Value"; bar1.AddItem(_writePortValueStaticitem); bar1.AddItem(NewBarStaticItem("ID:")); _IdValueStaticitem.Caption = "Value"; bar1.AddItem(_IdValueStaticitem); BarButtonItem settingsButton = new BarButtonItem(); settingsButton.Caption = "Настройки"; settingsButton.Alignment = BarItemLinkAlignment.Right; settingsButton.ItemClick += (ea, s) => { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); using (var settingsForm = new SettingsForm(new Setting { WindowEnabled1 = Convert.ToBoolean(config.AppSettings.Settings["EnabledVideoWindow1"].Value), WindowEnabled2 = Convert.ToBoolean(config.AppSettings.Settings["EnabledVideoWindow2"].Value), WindowEnabled3 = Convert.ToBoolean(config.AppSettings.Settings["EnabledVideoWindow3"].Value), WindowEnabled4 = Convert.ToBoolean(config.AppSettings.Settings["EnabledVideoWindow4"].Value) })) { if (settingsForm.ShowDialog(this) == DialogResult.OK) { config.AppSettings.Settings["EnabledVideoWindow1"].Value = settingsForm.Setting.WindowEnabled1.ToString(); config.AppSettings.Settings["EnabledVideoWindow2"].Value = settingsForm.Setting.WindowEnabled2.ToString(); config.AppSettings.Settings["EnabledVideoWindow3"].Value = settingsForm.Setting.WindowEnabled3.ToString(); config.AppSettings.Settings["EnabledVideoWindow4"].Value = settingsForm.Setting.WindowEnabled4.ToString(); config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); ShowVideoWindows(); } } }; bar1.AddItem(settingsButton); BarButtonItem saveButton = new BarButtonItem(); saveButton.Caption = "Сохранить"; saveButton.Alignment = BarItemLinkAlignment.Right; saveButton.ItemClick += (ea, s) => { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); foreach (var window in _videoWindows) { config.AppSettings.Settings[String.Format("VideoWindowTop{0}", window.Key + 1)].Value = window.Value.Top.ToString(); config.AppSettings.Settings[String.Format("VideoWindowLeft{0}", window.Key + 1)].Value = window.Value.Left.ToString(); config.AppSettings.Settings[String.Format("VideoWindowHeight{0}", window.Key + 1)].Value = window.Value.Height.ToString(); config.AppSettings.Settings[String.Format("VideoWindowWidth{0}", window.Key + 1)].Value = window.Value.Width.ToString(); } config.AppSettings.Settings["MainWindowTop"].Value = this.Top.ToString(); config.AppSettings.Settings["MainWindowLeft"].Value = this.Left.ToString(); config.AppSettings.Settings["MainWindowHeight"].Value = this.Height.ToString(); config.AppSettings.Settings["MainWindowWidth"].Value = this.Width.ToString(); config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); }; // bar1.AddItem(saveButton); BarButtonItem resetButton = new BarButtonItem(); resetButton.Caption = "Сбросить"; resetButton.Alignment = BarItemLinkAlignment.Right; resetButton.ItemClick += (ea, s) => { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings["MainWindowTop"].Value = Properties.Settings.Default.DefaultTop.ToString(); config.AppSettings.Settings["MainWindowLeft"].Value = Properties.Settings.Default.DefaultLeft.ToString(); config.AppSettings.Settings["MainWindowHeight"].Value = this.MinimumSize.Height.ToString(); config.AppSettings.Settings["MainWindowWidth"].Value = this.MinimumSize.Width.ToString(); int i = 10; foreach (var window in _videoWindows) { config.AppSettings.Settings[String.Format("VideoWindowTop{0}", window.Key + 1)].Value = Properties.Settings.Default.DefaultTop+i.ToString(); config.AppSettings.Settings[String.Format("VideoWindowLeft{0}", window.Key + 1)].Value = Properties.Settings.Default.DefaultLeft+i.ToString(); config.AppSettings.Settings[String.Format("VideoWindowHeight{0}", window.Key + 1)].Value = Properties.Settings.Default.DefaultHeight.ToString(); config.AppSettings.Settings[String.Format("VideoWindowWidth{0}", window.Key + 1)].Value = Properties.Settings.Default.DefaultWidth.ToString(); i += 10; } config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); this.Top = int.Parse(config.AppSettings.Settings["MainWindowTop"].Value); this.Left = int.Parse(config.AppSettings.Settings["MainWindowLeft"].Value); this.Width = int.Parse(config.AppSettings.Settings["MainWindowWidth"].Value); this.Height = int.Parse(config.AppSettings.Settings["MainWindowHeight"].Value); ShowVideoWindows(); }; // bar1.AddItem(resetButton); var windowMenu = new BarSubItem(); windowMenu.Caption = "Окна"; windowMenu.Alignment = BarItemLinkAlignment.Right; bar1.AddItem(windowMenu); windowMenu.AddItem(saveButton); windowMenu.AddItem(resetButton); if (_cu != null && _cu.ClietnId != null) _IdValueStaticitem.Caption = _cu.ClietnId.ToString(); }
private void AddBarButtonItem(BarManager manager, BarSubItem barSubItem, ChoiceActionItem actionItem) { //actionItem.ImageName BarButtonItem button = new BarButtonItem(manager, actionItem.Caption) { Tag = actionItem , Name = Guid.NewGuid().ToString(), LargeImageIndex=0, }; button.ItemClick += new ItemClickEventHandler(button_ItemClick); barSubItem.AddItem(button); }
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); }
void AddImageFormat(BarSubItem biImagesMenuItem, ImageFormat format) { ImageCodecInfo codecInfo = FindImageCodec(format); if (codecInfo == null) return; BarExportToImageItem item = new BarExportToImageItem(this.manager, format, codecInfo); item.ItemClick += new ItemClickEventHandler(OnExportImageClick); biImagesMenuItem.AddItem(item); }
public void RefreshModule() { navBarControl1.Items.Clear(); navBarControl1.Groups.Clear(); bsi_Modules.LinksPersistInfo.Clear(); ModuleFunctionsPool LocalFunction = new LoadModuleFunctions().GetLocalAllModules(AppDomain.CurrentDomain.BaseDirectory); navBarControl1.BeginInit(); NavBarGroup group; string ModuleID; foreach (var v in LocalFunction.Modules) { //添加模块到navBarControl1 group = navBarControl1.Groups.Add(); group.Caption = v.ModuleName; group.SmallImage = LoadUIImage.LoadNavBarImage_Group(ConvertEx.ToString(v.ImgPath)); group.Tag = v.ModuleID; //添加模块到bbi_Module BarSubItem BSI = new BarSubItem() { Caption = v.ModuleName, Glyph = LoadUIImage.LoadNavBarImage_Group(ConvertEx.ToString(v.ImgPath)) }; this.ribbonControl1.Items.Add(BSI); bsi_Modules.AddItem(BSI); ModuleID = v.ModuleID; foreach (var fun in v.Functions) { if (fun == null) continue; fun.UserAuthority = 1073741823; //添加功能到navBarControl1 NavBarItem item = navBarControl1.Items.Add(); item.Caption = fun.FunctionName; item.Tag = fun; item.SmallImage = LoadUIImage.LoadNavBarImage_Item(fun.FunctionPng); item.LinkClicked += item_LinkClicked; group.ItemLinks.Add(item); //添加功能到bbi_Module var bbif = new DevExpress.XtraBars.BarButtonItem() { Caption = fun.FunctionName, Tag = fun, Glyph = LoadUIImage.LoadNavBarImage_Item(fun.FunctionPng) }; bbif.ItemClick += bbi_ItemClick; this.ribbonControl1.Items.Add(bbif); BSI.AddItem(bbif); } if (group.ItemLinks.Count == 0) navBarControl1.Groups.Remove(group); } navBarControl1.EndInit(); }