Exemplo n.º 1
0
 public void DeselectAll()
 {
     foreach (var item in SelectedNodesDictionary.Select(x => x.Value).ToList())
     {
         item.SetSelected(false);
     }
 }
Exemplo n.º 2
0
 internal void SelectedNodeRemove(TreeNode treeNodes)
 {
     if (SelectedNodesDictionary.ContainsKey(treeNodes.NodeId) == true)
     {
         SelectedNodesDictionary.Remove(treeNodes.NodeId);
     }
 }
Exemplo n.º 3
0
 internal void SelectedNodeAdd(TreeNode treeNodes)
 {
     if (SelectedNodesDictionary.ContainsKey(treeNodes.NodeId) == false)
     {
         SelectedNodesDictionary.Add(treeNodes.NodeId, treeNodes);
     }
 }
Exemplo n.º 4
0
        internal void SelectedNodeRemove(TreeNode <TItem> treeNode)
        {
            if (SelectedNodesDictionary.ContainsKey(treeNode.NodeId) == true)
            {
                SelectedNodesDictionary.Remove(treeNode.NodeId);
            }

            UpdateBindData();
        }
Exemplo n.º 5
0
        internal void SelectedNodeAdd(TreeNode <TItem> treeNode)
        {
            if (SelectedNodesDictionary.ContainsKey(treeNode.NodeId) == false)
            {
                SelectedNodesDictionary.Add(treeNode.NodeId, treeNode);
            }

            UpdateBindData();
        }
Exemplo n.º 6
0
        /// <summary>
        /// 更新绑定数据
        /// </summary>
        private void UpdateBindData()
        {
            if (SelectedNodesDictionary.Count == 0)
            {
                SelectedKey   = null;
                SelectedNode  = null;
                SelectedData  = default(TItem);
                SelectedKeys  = Array.Empty <string>();
                SelectedNodes = Array.Empty <TreeNode <TItem> >();
                SelectedDatas = Array.Empty <TItem>();
            }
            else
            {
                var selectedFirst = SelectedNodesDictionary.FirstOrDefault();
                SelectedKey   = selectedFirst.Value?.Key;
                SelectedNode  = selectedFirst.Value;
                SelectedData  = selectedFirst.Value.DataItem;
                SelectedKeys  = SelectedNodesDictionary.Select(x => x.Value.Key).ToArray();
                SelectedNodes = SelectedNodesDictionary.Select(x => x.Value).ToArray();
                SelectedDatas = SelectedNodesDictionary.Select(x => x.Value.DataItem).ToArray();
            }

            if (SelectedKeyChanged.HasDelegate)
            {
                SelectedKeyChanged.InvokeAsync(SelectedKey);
            }
            if (SelectedNodeChanged.HasDelegate)
            {
                SelectedNodeChanged.InvokeAsync(SelectedNode);
            }
            if (SelectedDataChanged.HasDelegate)
            {
                SelectedDataChanged.InvokeAsync(SelectedData);
            }
            if (SelectedKeysChanged.HasDelegate)
            {
                SelectedKeysChanged.InvokeAsync(SelectedKeys);
            }
        }