Exemple #1
0
        /// <summary>
        /// Invoked when a method on the invoker has been raised.
        /// </summary>
        /// <param name="sender">Object whose event was raised</param>
        /// <param name="e">Event arguments for the raised event.</param>
#endif
        internal override void OnEventInvoked(object sender, EventArgs e)
        {
            bool          isSameItem = false;
            UltraTreeNode item       = this.Invoker;

            UltraTreeNode eventItem = this.GetItem(e);

            if (eventItem != null)
            {
                isSameItem = eventItem != null && eventItem == item;
            }
            else
            {
                SelectedNodesCollection nodes = this.GetSelectedNodes(e);

                if (nodes != null)
                {
                    isSameItem = nodes.Contains(item);
                }
                else
                {
                    UltraTreeNode[] nodeArray = this.GetNodeArray(e);

                    if (nodeArray != null)
                    {
                        isSameItem = Array.IndexOf <UltraTreeNode>(nodeArray, item) >= 0;
                    }
                }
            }

            if (isSameItem)
            {
                this.FireCommand();
            }
        }
Exemple #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            AssetDAO objAsseDAO = new AssetDAO();
            SelectedNodesCollection objSelectednode = tree.SelectedNodes;

            if (buttonOK.Text == "Apply" && bApply == true)
            {
                int iCount = objSelectednode.Count;
                for (int i = 0; i < iCount; i++)
                {
                    string strTag = objSelectednode[i].Tag.ToString();
                    if (GetSupportContractDetails(strTag))
                    {
                        objAsseDAO.AddSupportContract(m_objSupportContract);
                    }
                }
                tree.SelectedNodes.Clear();
                ClearControlsSupportContract();
                FillControlsOnLoad();
                FillSupportContractComboBox();
                FillSuppliersComboBox();
                checkBoxSupportContract.Checked = false;
                InitialiseSupportContractTab();
                MessageBox.Show("Support Contract Successfully Added for the Selected Assets.", "AuditWizard", MessageBoxButtons.OK, MessageBoxIcon.Information);
                buttonOK.Text = "OK";
                bApply        = false;
            }

            else if (MessageBox.Show("Do you wish to Deploy Support Contract to other Assets?\nTo deploy, highlight required assets in Network View using Ctrl key", "AuditWizard", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                buttonOK.Text = "Apply";
                bApply        = true;
                GetSupportContractDetails();
            }
            else
            {
                if (GetSupportContractDetails())
                {
                    objAsseDAO.AddSupportContract(m_objSupportContract);

                    ClearControlsSupportContract();
                    FillControlsOnLoad();
                    FillSupportContractComboBox();
                    FillSuppliersComboBox();
                    checkBoxSupportContract.Checked = false;
                    InitialiseSupportContractTab();
                }
                MessageBox.Show("Support Contract Successfully Added", "AuditWizard", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Restore the selection state of any nodes contained within the supplied list
 /// </summary>
 /// <param name="selectedNodes"></param>
 protected void RestoreSelectedNodes(SelectedNodesCollection selectedNodes)
 {
     foreach (UltraTreeNode node in selectedNodes)
     {
         UltraTreeNode selectedNode = locationsTree.GetNodeByKey(node.Key);
         if (selectedNode != null)
         {
             selectedNode.BringIntoView();
             if (selectedNode.Selected == false)
             {
                 selectedNode.Selected = true;
             }
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// 获取子类集合
        /// </summary>
        /// <param name="selectedNodes">选中的树节点集合</param>
        /// <param name="getChildren"></param>
        public List <T> GetChildren(SelectedNodesCollection selectedNodes, Func <List <T> > getChildren = null)
        {
            var children = new List <T>();

            foreach (var node in selectedNodes)
            {
                if (ChildrenDic.ContainsKey(node.Key) && ChildrenDic[node.Key].IsNotNullorEmpty())
                {
                    children.AddRange(ChildrenDic[node.Key]);
                }
                else if (getChildren != null && getChildren().IsNotNullorEmpty())
                {
                    ChildrenDic.Add(node.Key, getChildren());
                }
            }

            return(children);
        }
        /// <summary>
        /// Refresh the current view
        /// </summary>
        public void RefreshView()
        {
            // First save any existing selections
            SelectedNodesCollection selectedNodes = locationsTree.SelectedNodes;

            // ...then save any 'expanded' nodes
            List <UltraTreeNode> expandedNodes = new List <UltraTreeNode>();

            GetExpandedNodes(expandedNodes, locationsTree.Nodes);

            // Initialize the view
            presenter.Initialize();

            // Call our base class refresh code next
            base.Refresh();

            // ...then reinstate any selections
            RestoreSelectedNodes(selectedNodes);

            // ...then re-instate any expansions
            RestoreExpandedNodes(expandedNodes);
        }
Exemple #6
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public TreeViewX()
 {
     selectedNodes = new SelectedNodesCollection(this);
 }