Esempio n. 1
0
        private static bool SortNodes(this ServerTree tree, TreeNodeCollection nodes, bool recurse)
        {
            List <TreeNode> list  = new List <TreeNode>(nodes.Count);
            List <TreeNode> list2 = new List <TreeNode>(nodes.Count);

            foreach (TreeNode node in nodes)
            {
                if (node is ServerBase)
                {
                    list2.Add(node);
                }
                else
                {
                    list.Add(node);
                }
            }
            bool flag = false;

            if (recurse)
            {
                foreach (GroupBase item in from g in list.OfType <GroupBase>()
                         where g.AllowSort
                         select g)
                {
                    flag |= tree.SortNodes(item.Nodes, recurse: true);
                }
            }
            flag |= nodes.SortAndRebuildNodeList(list, Program.Preferences.GroupSortOrder);
            return(flag | nodes.SortAndRebuildNodeList(list2, Program.Preferences.ServerSortOrder));
        }
Esempio n. 2
0
 public static void SortRoot(this ServerTree tree)
 {
     tree.Operation((OperationBehavior)21, delegate
     {
         tree.SortHelper(tree.Nodes, recurse: false);
         tree.SortBuiltinGroups();
     });
 }
Esempio n. 3
0
 public static void SortBuiltinGroups(this ServerTree tree)
 {
     if (!tree.SuppressSorting)
     {
         List <TreeNode> list = tree.Nodes.OfType <IBuiltInVirtualGroup>().Cast <TreeNode>().ToList();
         tree.Nodes.SortAndRebuildNodeList(list, SortOrder.ByName);
     }
 }
Esempio n. 4
0
        public static bool SortGroup(this ServerTree tree, GroupBase group, bool recurse)
        {
            bool result = false;

            if (group.AllowSort)
            {
                result = tree.SortHelper(group.Nodes, recurse);
            }
            return(result);
        }
Esempio n. 5
0
 public static void SortAllNodes(this ServerTree tree)
 {
     using (Helpers.Timer("sorting all nodes"))
     {
         tree.Operation(OperationBehavior.RestoreSelected, delegate
         {
             tree.SortHelper(tree.Nodes, recurse: true);
             tree.SortBuiltinGroups();
         });
     }
 }
Esempio n. 6
0
        private static bool SortHelper(this ServerTree tree, TreeNodeCollection nodes, bool recurse)
        {
            if (tree.SuppressSorting)
            {
                return(false);
            }
            bool anyChanged = false;

            tree.Operation((OperationBehavior)21, delegate
            {
                anyChanged = tree.SortNodes(nodes, recurse);
            });
            return(anyChanged);
        }
Esempio n. 7
0
        public static bool SortNode(this ServerTree tree, RdcTreeNode node)
        {
            GroupBase groupBase = node.Parent as GroupBase;

            if (groupBase != null)
            {
                return(tree.SortGroup(groupBase));
            }
            if (node.Parent == null)
            {
                tree.SortRoot();
            }
            return(false);
        }
Esempio n. 8
0
 public int Compare(TreeNode treeNode1, TreeNode treeNode2)
 {
     if (_sortOrder == SortOrder.ByStatus)
     {
         ImageConstants imageConstants  = ServerTree.TranslateImage((ImageConstants)treeNode1.ImageIndex, toSelected: false);
         ImageConstants imageConstants2 = ServerTree.TranslateImage((ImageConstants)treeNode2.ImageIndex, toSelected: false);
         int            num             = imageConstants2 - imageConstants;
         if (num != 0)
         {
             return(num);
         }
     }
     return(Helpers.NaturalCompare(treeNode1.Text, treeNode2.Text));
 }
Esempio n. 9
0
 static ServerTree()
 {
     NotFocusedForeColor = Color.FromKnownColor(KnownColor.ControlDark);
     NotFocusedBackColor = Color.White;
     FocusedForeColor    = Color.Black;
     FocusedBackColor    = Color.White;
     ImageConstantLookup = new ImageConstants[2, 9];
     foreach (ImageConstants item in Helpers.EnumValues <ImageConstants>())
     {
         ImageConstantLookup[0, (int)item] = item;
         ImageConstantLookup[1, (int)item] = item;
     }
     ImageConstantLookup[0, 4] = ImageConstants.ConnectedServer;
     ImageConstantLookup[0, 2] = ImageConstants.ConnectingServer;
     ImageConstantLookup[1, 3] = ImageConstants.ConnectedSelectedServer;
     ImageConstantLookup[1, 1] = ImageConstants.ConnectingSelectedServer;
     Instance = new ServerTree();
 }
Esempio n. 10
0
 public virtual void ChangeImageIndex(ImageConstants index)
 {
     base.ImageIndex         = (int)index;
     base.SelectedImageIndex = (int)ServerTree.TranslateImage(index, true);
 }
Esempio n. 11
0
 public static bool SortGroup(this ServerTree tree, GroupBase group)
 {
     return(tree.SortGroup(group, recurse: false));
 }