コード例 #1
0
        /// <summary>
        /// Searches for a node which contains a particular QSetItemBase object.
        /// </summary>
        /// <param name="item">QSetItemBase to search for.</param>
        /// <param name="searchRootNode">Tree node to start search from.</param>
        /// <returns>The node hosting the item if found, else null.</returns>
        private QSetItemTreeNode FindNode(QSetItemBase item, QSetItemTreeNode searchRootNode)
        {
            QSetItemTreeNode result = null;

            foreach (TreeNode node in searchRootNode.Nodes)
            {
                QSetItemTreeNode checkQSetNode = ((QSetItemTreeNode)node);

                if (checkQSetNode.QSetItem == item)
                {
                    result = checkQSetNode;
                    break;
                }
                else if (checkQSetNode.QSetItem is QSetFolderItem)
                {
                    result = FindNode(item, checkQSetNode);
                    if (result != null)
                    {
                        break;
                    }
                }
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Handles event fired when a child item is removed from the current item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChildItems_BeforeItemRemoved(object sender, BeforeItemRemovedEventArgs e)
        {
            QSetItemTreeNode removedNode = (QSetItemTreeNode)base.Nodes[e.RemovedAt];

            base.Nodes.RemoveAt(e.RemovedAt);
            removedNode.Dispose();
        }
コード例 #3
0
 /// <summary>
 /// Displays a QSet in the explorer.
 /// </summary>
 /// <param name="queueSet">QSet to display.</param>
 private void DisplayQSet(QSetModel queueSet)
 {
     _qsetTreeView.Nodes.Clear();
     if (_qset != null)
     {
         QSetItemTreeNode queueSetNode = new QSetItemTreeNode(_qset);
         _qsetTreeView.Nodes.Add((QSetItemTreeNode)queueSetNode);
         DisplayQSetChildItems(queueSet, queueSetNode);
     }
 }
コード例 #4
0
        /// <summary>
        /// Recursively adds child nodes to a node.
        /// </summary>
        /// <param name="parentItem">Parent folder item.</param>
        /// <param name="parentNode">Parent node.</param>
        public void CreateChildNodes(QSetFolderItem parentFolderItem, TreeNode parentNode)
        {
            foreach (QSetItemBase item in parentFolderItem.ChildItems)
            {
                QSetItemTreeNode itemNode = new QSetItemTreeNode(item);
                parentNode.Nodes.Add((TreeNode)itemNode);

                if (item is QSetFolderItem)
                {
                    CreateChildNodes((QSetFolderItem)item, itemNode);
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Handles event fired when a child is added to the current item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChildItems_AfterItemAdded(object sender, AfterItemAddedEventArgs e)
        {
            QSetItemTreeNode newNode    = new QSetItemTreeNode(e.Item);
            QSetItemTreeNode newNodeRef = newNode;

            if (e.Item is QSetFolderItem)
            {
                CreateChildNodes((QSetFolderItem)e.Item, newNodeRef);
            }

            base.Nodes.Insert(e.InsertedAt, newNode);

            base.Expand();
            base.TreeView.SelectedNode = newNode;
            newNode.EnsureVisible();
        }
コード例 #6
0
ファイル: QSetExplorer.cs プロジェクト: modulexcite/QSet
		/// <summary>
		/// Recursively adds child nodes to a node.
		/// </summary>
		/// <param name="parentItem">Parent folder item.</param>
		/// <param name="parentNode">Parent node.</param>
		public void CreateChildNodes(QSetFolderItem parentFolderItem, TreeNode parentNode)
		{
			foreach (QSetItemBase item in parentFolderItem.ChildItems)
			{
				QSetItemTreeNode itemNode = new QSetItemTreeNode(item);
				parentNode.Nodes.Add((TreeNode)itemNode);

				if (item is QSetFolderItem)
					CreateChildNodes((QSetFolderItem)item, itemNode);
			}
		}
コード例 #7
0
ファイル: QSetExplorer.cs プロジェクト: modulexcite/QSet
		/// <summary>
		/// Handles event fired when a child is added to the current item.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void ChildItems_AfterItemAdded(object sender, AfterItemAddedEventArgs e)
		{
			QSetItemTreeNode newNode = new QSetItemTreeNode(e.Item);
			QSetItemTreeNode newNodeRef = newNode;
			
			if (e.Item is QSetFolderItem)
				CreateChildNodes((QSetFolderItem)e.Item, newNodeRef);

			base.Nodes.Insert(e.InsertedAt, newNode);
						
			base.Expand();			
			base.TreeView.SelectedNode = newNode;			
			newNode.EnsureVisible();			
		}
コード例 #8
0
ファイル: QSetExplorer.cs プロジェクト: modulexcite/QSet
		/// <summary>
		/// Displays a QSet in the explorer.
		/// </summary>
		/// <param name="queueSet">QSet to display.</param>
		private void DisplayQSet(QSetModel queueSet)
		{
			_qsetTreeView.Nodes.Clear();
			if (_qset != null)	
			{
				QSetItemTreeNode queueSetNode = new QSetItemTreeNode(_qset);
				_qsetTreeView.Nodes.Add((QSetItemTreeNode)queueSetNode);
				DisplayQSetChildItems(queueSet, queueSetNode);
			}			
		}
コード例 #9
0
ファイル: QSetExplorer.cs プロジェクト: modulexcite/QSet
		/// <summary>
		/// Searches for a node which contains a particular QSetItemBase object.
		/// </summary>
		/// <param name="item">QSetItemBase to search for.</param>
		/// <param name="searchRootNode">Tree node to start search from.</param>
		/// <returns>The node hosting the item if found, else null.</returns>
		private QSetItemTreeNode FindNode(QSetItemBase item, QSetItemTreeNode searchRootNode)
		{
			QSetItemTreeNode result = null;
			
			foreach(TreeNode node in searchRootNode.Nodes)
			{
				QSetItemTreeNode checkQSetNode = ((QSetItemTreeNode)node);

				if (checkQSetNode.QSetItem == item)
				{
					result = checkQSetNode;
					break;
				}
				else if (checkQSetNode.QSetItem is QSetFolderItem)
				{
					result = FindNode(item, checkQSetNode);
					if (result != null)
						break;
				}
			}

			return result;
		}