当前位置: 首页>>代码示例>>C#>>正文


C# BaseItem.Copy方法代码示例

本文整理汇总了C#中DevComponents.DotNetBar.BaseItem.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.Copy方法的具体用法?C# BaseItem.Copy怎么用?C# BaseItem.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DevComponents.DotNetBar.BaseItem的用法示例。


在下文中一共展示了BaseItem.Copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddCopy

		public void AddCopy(BaseItem objItem)
		{
			if(objItem==null)
				throw new System.ArgumentNullException("Item must be valid value");
			if(objItem.Name==null || objItem.Name=="")
			{
				// Auto assign item name
				objItem.Name="item_"+objItem.Id.ToString();
			}
			if(m_Items.ContainsKey(objItem.Name))
				throw new System.InvalidOperationException("Item with this name already exists");
			BaseItem objCopy=objItem.Copy();
			objCopy.SetOwner(m_Owner);
			objCopy.GlobalItem=true;
			m_Items.Add(objCopy.Name,objCopy);
		}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例2: AutoCategorizeItem

		private void AutoCategorizeItem(BaseItem item)
		{
			if(item.Category!="" && item.Name!="" && !m_DotNetBar.Items.Contains(item.Name))
				m_DotNetBar.Items.Add(item.Copy());
			foreach(BaseItem i in item.SubItems)
				AutoCategorizeItem(i);
		}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: AddToCustomizationCollection

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// At this point, the item passed to this method has not been added to any toolbar or
		/// menu. Before doing so, we need to add it to the DNB Manager because that internally
		/// (to the DNB manager) assigns the item to its category and makes it available for
		/// customization purposes through DNB's customize dialog. But, only add an item if
		/// there is a category for the item and if the item is not a ControlContainerItem.
		/// We don't allow ControlContainerItems because it appears DotNetBar's customize
		/// dialog doesn't allow dragging new copies of ControlContainerItems to user-defined
		/// toolbars. And if they don't allow that, I don't want them in the list appearing
		/// like they should be able to be dragged to new toolbars. This means a DotNetBar
		/// manager may only have one (visible - See comments in
		/// HandleControlContainerLoadRequests) instance of application-defined toolbar items.
		/// </summary>
		/// <param name="node"></param>
		/// <param name="item"></param>
		/// <param name="isMenuItem"></param>
		/// ------------------------------------------------------------------------------------
		private void AddToCustomizationCollection(XmlNode node, BaseItem item, bool isMenuItem)
		{
			if (!(item is ButtonItem) || item.Category == null ||
				item.Category == string.Empty || m_readingContextMenuDef)
			{
				return;
			}

			string replaceItemCmdId = GetAttributeValue(node, "replacecustomizeitem");
			bool addToCustomizeList = GetBoolFromAttribute(node, "customizeitem", true);

			// Only add menu items unless a toolbar item's XML definition contains one of the
			// attributes: customizeitem or replacecustomizeitem.
			if ((!isMenuItem && replaceItemCmdId == null) || !addToCustomizeList)
				return;

			// If this item should replace another in the customization item collection,
			// find the item it should replace and get rid of it.
			if (replaceItemCmdId != null)
			{
				for (int i = 0; i < m_dnbMngr.Items.Count; i++)
				{
					if (replaceItemCmdId == (m_dnbMngr.Items[i].Tag as string))
					{
						m_dnbMngr.Items.Remove(m_dnbMngr.Items[i]);
						break;
					}
				}
			}

			BaseItem itemCopy = item.Copy();

			// Check if the text for the copy should be different from the original's.
			CommandInfo cmdInfo = GetCommandInfo(item);
			if (cmdInfo.TextAlt != null)
				itemCopy.Text = cmdInfo.TextAlt;

			// If the item already exists (for some odd reason) in the manager's collection
			// then remove it first since the manager doesn't like two items with the same name.
			if (m_dnbMngr.Items.Contains(itemCopy.Name))
				m_dnbMngr.Items.Remove(itemCopy.Name);

			m_dnbMngr.Items.Add(itemCopy);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:62,代码来源:DNBAdapter.cs


注:本文中的DevComponents.DotNetBar.BaseItem.Copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。