private void EstablecerTema(BarItemLinkCollection links) { try { foreach (var item in links) { if (item.GetType() == typeof(BarSubItemLink)) { BarSubItemLink subItems = (BarSubItemLink)item; CapturarEventosApariencia(subItems.Item.ItemLinks); } if (item.GetType() == typeof(BarButtonItemLink)) { BarButtonItemLink barItem = (BarButtonItemLink)item; //blcApariencia.ItemLinks[barItem.ItemId].Item.PerformClick(); } } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; NameMetodo = NameMetodo + " - " + ex.ToString(); MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
public void RefreshPropertiesGrid(BarItemLinkCollection sourceControl) { rowCaption.Visible = categoryLocation.Visible = categorySize.Visible = false; categoryMenuItems.Visible = true; Model = new ControlModel { CanCaptionChange = false }; foreach (var o in sourceControl) { var caption = String.Empty; if (o is BarSubItemLink) { caption = ((BarSubItemLink)o).Item.Caption; } else if (o is BarLargeButtonItemLink) { caption = ((BarLargeButtonItemLink)o).Item.Caption; } if (caption.Length == 0) { continue; } Model.MenuItems.Add(caption); } propGrid.SelectedObject = Model; }
private void InitVericalGrid(BarItemLinkCollection menuItemLinks) { menuEditoGrid.CloseEditor(); menuEditoGrid.Rows.Clear(); var cRow = new CategoryRow("Menu items"); menuEditoGrid.OptionsView.AutoScaleBands = true; foreach (BarItemLink link in menuItemLinks) { if (link.Item.Tag == menuItemLinks) { continue; } var eRow = new EditorRow(); var a = link.Item.Tag as MenuAction; string caption; if (a != null && a.ItemsStorage != null) { caption = a.ItemsStorage.GetString(a.ResourceKey, null, Localizer.lngEn); } else { caption = link.Caption; } eRow.Properties.Caption = caption; eRow.Properties.Value = link.Caption; eRow.Tag = link; cRow.ChildRows.Add(eRow); } menuEditoGrid.Rows.Add(cRow); }
/// <summary> /// Initializes a new instance of the <see cref="BarLinksCollectionUIAdapter"/> class. /// </summary> /// <param name="linkCollection"></param> /// <param name="itemCollection"></param> public BarLinksCollectionUIAdapter(BarItemLinkCollection linkCollection, BarItems itemCollection) { Guard.ArgumentNotNull(itemCollection, "BarItems"); this.itemCollection = itemCollection; Guard.ArgumentNotNull(linkCollection, "BarItemLinkCollection"); this.linkCollection = linkCollection; }
public DialogResult EditMenu(BarItemLinkCollection menuItemLinks) { if (menuItemLinks == null || menuItemLinks.Count == 0) { return(DialogResult.Cancel); } InitVericalGrid(menuItemLinks); return(ShowDialog()); }
void FillItemBranch(TreeListNode parent, BarItemLinkCollection links) { foreach (BarItemLink link in links) { TreeListNode node = parent.TreeList.AppendNode(new object[] { link.Caption }, parent); if (link.Item is BarSubItem) { FillItemBranch(node, ((BarSubItem)link.Item).ItemLinks); } } }
private void DeletePopupItems() { BarItemLinkCollection itemLinks = this.popupMenu.ItemLinks; this.popupMenu.BeginUpdate(); try { while (itemLinks.Count > 0) { itemLinks[0].Item.Dispose(); } } finally { this.popupMenu.EndUpdate(); } }
private void BandItemLinks(BarItemLinkCollection linkCollection, ref List <BarItem> itemList) { int itemCount = linkCollection.Count; for (int i = 0; i < itemCount; i++) { BarItem barItem = linkCollection[i].Item; m_BarItems.Add(barItem); barItem.ItemClick += new ItemClickEventHandler(BarItemClick); if (barItem is BarSubItem) { BandItemLinks((barItem as BarSubItem).ItemLinks, ref itemList); } } }
private void EstablecerTema(BarItemLinkCollection links) { try { foreach (var item in links) { if (item.GetType() == typeof(BarSubItemLink)) { BarSubItemLink subItems = (BarSubItemLink)item; CapturarEventosApariencia(subItems.Item.ItemLinks); } if (item.GetType() == typeof(BarButtonItemLink)) { BarButtonItemLink barItem = (BarButtonItemLink)item; } } } catch (Exception) { } }
private bool TraverseItems(BarItemLinkCollection col, string[] arrItems, int iCurrentLevel, List <BarItemLink> lstMenuChain) { if (iCurrentLevel >= arrItems.Length) { Logger.Error("TraverseItems", "Can't get the right menuItem when Navigating reaches the last item."); return(false); } foreach (BarItemLink link in col) { //SomeAction(link); if (!(TigerMarsUtil.RegularTest(arrItems[iCurrentLevel], link.Caption))) { continue; } /** keep the current menuItem **/ lstMenuChain.Add(link); if (link.Item is BarSubItem) { if (TraverseItems((link.Item as BarSubItem).ItemLinks, arrItems, iCurrentLevel + 1, lstMenuChain)) { return(true); } else { /** remove the last one **/ if (lstMenuChain.Count > 0) { Logger.Info("TraverseItems", string.Format("Its Subitems [{0}] are not match to [{1}], level:[{2}]. Remove last node of the chain", link.Caption, arrItems[iCurrentLevel], iCurrentLevel)); lstMenuChain.RemoveAt(lstMenuChain.Count - 1); return(false); } } } else { return(true); } } return(false); }
private void EstablecerTema(BarItemLinkCollection links) { try { foreach (var item in links) { if (item.GetType() == typeof(BarSubItemLink)) { BarSubItemLink subItems = (BarSubItemLink)item; CapturarEventosApariencia(subItems.Item.ItemLinks); } if (item.GetType() == typeof(BarButtonItemLink)) { BarButtonItemLink barItem = (BarButtonItemLink)item; } } } catch (Exception) { MessageBox.Show("Ha ocurrido un error, comuníquese con sistemas", param.nom_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BandItemLinks2(BarItemLinkCollection linkCollection, ref List <BarItem> itemList) { int itemCount = linkCollection.Count; for (int i = 0; i < itemCount; i++) { BarItem barItem = linkCollection[i].Item; if (barItem.Tag != null) // 将Tag作为Command解析出来 { AddCommand(barItem.Tag as string); } m_BarItems.Add(barItem); barItem.ItemClick += new ItemClickEventHandler(BarItemClick); if (barItem is BarSubItem) { BandItemLinks2((barItem as BarSubItem).ItemLinks, ref itemList); } } }
private void CapturarEventosApariencia(BarItemLinkCollection links) { try { foreach (var item in links) { if (item.GetType() == typeof(BarSubItemLink)) { BarSubItemLink subItems = (BarSubItemLink)item; CapturarEventosApariencia(subItems.Item.ItemLinks); } if (item.GetType() == typeof(BarButtonItemLink)) { BarButtonItemLink barItem = (BarButtonItemLink)item; barItem.Item.ItemPress += itemAparienciaPresionado; } } } catch (Exception ex) { } }
public BarLinksCollectionDynamicUIAdapter(BarItemLinkCollection linkCollection, BarItems itemCollection, WorkItem rootWorkItem) : base(linkCollection, itemCollection) { this.rootWorkItem = rootWorkItem; }
private void BandItemLinks(BarItemLinkCollection linkCollection, ref List<BarItem> itemList) { int itemCount = linkCollection.Count; for (int i = 0; i < itemCount; i++) { BarItem barItem = linkCollection[i].Item; m_BarItems.Add(barItem); barItem.ItemClick += new ItemClickEventHandler(BarItemClick); if (barItem is BarSubItem) { BandItemLinks((barItem as BarSubItem).ItemLinks, ref itemList); } } }
private void BandItemLinks2(BarItemLinkCollection linkCollection,ref List<BarItem> itemList) { int itemCount = linkCollection.Count; for (int i = 0; i < itemCount; i++) { BarItem barItem = linkCollection[i].Item; if (barItem.Tag != null) // 将Tag作为Command解析出来 { AddCommand(barItem.Tag as string); } m_BarItems.Add(barItem); barItem.ItemClick += new ItemClickEventHandler(BarItemClick); if (barItem is BarSubItem) { BandItemLinks2((barItem as BarSubItem).ItemLinks, ref itemList); } } }
private bool TraverseItems(BarItemLinkCollection col, string[] arrItems, int iCurrentLevel, List<BarItemLink> lstMenuChain ) { if (iCurrentLevel >= arrItems.Length) { Logger.Error("TraverseItems", "Can't get the right menuItem when Navigating reaches the last item."); return false; } foreach (BarItemLink link in col) { //SomeAction(link); if (!(TigerMarsUtil.RegularTest(arrItems[iCurrentLevel], link.Caption))) continue; /** keep the current menuItem **/ lstMenuChain.Add(link); if (link.Item is BarSubItem) { if (TraverseItems((link.Item as BarSubItem).ItemLinks, arrItems, iCurrentLevel + 1, lstMenuChain)) { return true; } else { /** remove the last one **/ if (lstMenuChain.Count > 0) { Logger.Info("TraverseItems", string.Format("Its Subitems [{0}] are not match to [{1}], level:[{2}]. Remove last node of the chain", link.Caption, arrItems[iCurrentLevel], iCurrentLevel)); lstMenuChain.RemoveAt(lstMenuChain.Count - 1); return false; } } } else { return true; } } return false; }
/// <summary> /// Initializes a new instance of the <see cref="BarLinksOwnerCollectionUIAdapter"/> using the /// specified item and linkCollection /// </summary> /// <param name="item"></param> /// <param name="linkCollection"></param> public BarLinksOwnerCollectionUIAdapter(BarItem item, BarItemLinkCollection linkCollection) : base(linkCollection, item.Manager.Items) { this.item = item; }
private void AddTranslateBarItem(BarItemLinkCollection collection, BarManager manager) { var bi = new BarButtonItem(manager, "Translate"); m_TranslateButtons.Add(bi); bi.ItemClick += TranslationBarItem_Click; bi.Tag = collection; foreach (BarItemLink il in collection) { var action = il.Item.Tag as MenuAction; if (action != null) { if (string.IsNullOrEmpty(il.Item.Name)) { il.Item.Name = GetUniqueMenuName(); } m_View.ExclusionsList.Add(il.Item, new ExclusionItem() { Resource = CommonResource.EidssMenu, Disabled = false, Keys = new[] { action.ResourceKey }, Source = ExclusionSource.MenuAction }); var propName = TranslationToolHelperWinClient.GetPropertyNameForComponent(il.Item, DesignElement.Caption); string englishCaption; if (action.ItemsStorage != null) { englishCaption = action.ItemsStorage.GetString(action.ResourceKey, null, Localizer.lngEn); } else { englishCaption = il.Caption; } if (m_View.ResourcesList.ContainsKey(propName)) { m_View.ResourcesList[propName].EnglishText = englishCaption; m_View.ResourcesList[propName].ResourceName = CommonResource.EidssMenu.ToString(); m_View.ResourcesList[propName].SourceKey = action.ResourceKey; m_View.ResourcesList[propName].Value = il.Caption; } else { m_View.ResourcesList.Add(propName, new ResourceValue() { EnglishText = englishCaption, ResourceName = CommonResource.EidssMenu.ToString(), SourceKey = action.ResourceKey, Value = il.Caption }); } } var bsi = il.Item as BarSubItem; if (bsi == null) { il.Item.Enabled = false; continue; } AddTranslateBarItem(bsi.ItemLinks, manager); } collection.Add(bi); }
///<summary> /// constructor ///</summary> public BarItemWrapper(BarItemLinkCollection itemLinkCollection, BarItem barItem) { this.barItem = barItem; barItemLinks = itemLinkCollection; }
/// <summary> /// BarItem的初始化... /// </summary> /// <param name="xmlItem"></param> /// <param name="ctrlAction"></param> /// <param name="itemlinks">包含BarItem的父类</param> /// <returns></returns> public static BarItem GetBarItem(XMLItem xmlItem, CtrlAction ctrlAction, BarItemLinkCollection itemlinks) { System.Reflection.Assembly asmb = System.Reflection.Assembly.LoadFrom(@"./DevExpress.XtraBars.v14.1.dll"); Type t = asmb.GetType(xmlItem.ItemItemType); BarItem result = Activator.CreateInstance(t) as BarItem; if (result != null) { bool isBeginGroup = xmlItem.ItemBeginGroup == "true"; itemlinks.Add(result, isBeginGroup); result.Name = Guid.NewGuid() + ""; result.Caption = xmlItem.ItemText; result.Visibility = xmlItem.ItemVisible != "false" ? BarItemVisibility.Always : BarItemVisibility.Never; result.RibbonStyle = xmlItem.ItemRibbonStyle == "large" ? RibbonItemStyles.Large : RibbonItemStyles.Default; if (ctrlAction != null) { ctrlAction.BarItem = result; result.ItemClick += (m, n) => { ctrlAction.Run(); }; } result.Tag = ctrlAction; try { Bitmap bitMap = new Bitmap(xmlItem.ItemImage); result.Glyph = bitMap; } catch (Exception) { } #region 不同类型按钮的处理 //5.根据xmlItem.ItemName 来判断类型 if (xmlItem.ItemName == XMLItemName.Button) { if (xmlItem.ItemChecked != "") { BarButtonItem barButtonItem = result as BarButtonItem; barButtonItem.ButtonStyle = BarButtonStyle.Check; if (xmlItem.ItemChecked == "true") { barButtonItem.Down = true; //if (ctrlAction != null) // ctrlAction.Run(); } else barButtonItem.Down = false; } } else if (xmlItem.ItemName == XMLItemName.ButtonCheckDropDown) { //判断如果有子菜单的情况 XMLItemName.ButtonCheckDropDown,暂时用不到,等换了新版本再说 } else if (xmlItem.ItemName == XMLItemName.ButtonDropDownAct) { BarButtonItem barButtonItem = result as BarButtonItem; barButtonItem.ButtonStyle = BarButtonStyle.DropDown; barButtonItem.ActAsDropDown = true; } else if (xmlItem.ItemName == XMLItemName.ButtonDropDown) { BarButtonItem barButtonItem = result as BarButtonItem; barButtonItem.ButtonStyle = BarButtonStyle.DropDown; } else if (xmlItem.ItemName == XMLItemName.Check) { if (xmlItem.ItemChecked != "") { BarCheckItem barCheckItem = result as BarCheckItem; barCheckItem.CheckBoxVisibility = CheckBoxVisibility.BeforeText; } } else if (xmlItem.ItemName == XMLItemName.SkinRibbonGallery) { SkinRibbonGalleryBarItem item = result as SkinRibbonGalleryBarItem; SkinHelper.InitSkinGallery(item); } #endregion } return result; }