Exemple #1
0
 public void HideGroup(GroupBase group)
 {
     if (_layout != null)
     {
         if (_layout.Group != group)
         {
             return;
         }
         _groupScrollPosition[group] = _verticalScrollBar.Value;
         try
         {
             ServerLabel   serverLabel = Program.TheForm.ActiveControl as ServerLabel;
             ServerLabel[] labelArray  = _layout.LabelArray;
             foreach (ServerLabel serverLabel2 in labelArray)
             {
                 if (serverLabel == serverLabel2)
                 {
                     Program.TheForm.ActiveControl = this;
                 }
                 serverLabel2.Server.Hide();
                 base.Controls.Remove(serverLabel2);
             }
         }
         finally
         {
             _layout = null;
         }
     }
     _verticalScrollBar.Hide();
 }
Exemple #2
0
        public void ShowGroup(GroupBase group)
        {
            bool flag = true;

            if (_layout != null && _layout.Group == group)
            {
                flag = false;
            }
            if (!_layoutHash.TryGetValue(group, out _layout))
            {
                _layout = CreateThumbnailLayout(group);
                _layoutHash.Add(group, _layout);
            }
            ComputeScrollBarLimits();
            if (flag)
            {
                if (!_groupScrollPosition.TryGetValue(group, out int value))
                {
                    value = 0;
                }
                SetScrollPosition(value);
            }
            _thumbnailDrawn = new bool[_layout.NodeCount];
            DrawThumbnails(group);
        }
Exemple #3
0
 private void UpdateNonLayoutSettings(ThumbnailLayout shownLayout)
 {
     shownLayout.LabelArray.ForEach(delegate(ServerLabel l)
     {
         UpdateNonLayoutSettings(l.Server);
     });
 }
Exemple #4
0
 private ThumbnailLayout CreateThumbnailLayout(GroupBase group)
 {
     using (Helpers.Timer("creating thumbnail layout for {0}", group.Text))
     {
         ThumbnailLayout thumbnailLayout = new ThumbnailLayout(group);
         int             num;
         if (Program.Preferences.ThumbnailSizeIsInPixels)
         {
             Size thumbnailSize = Program.Preferences.ThumbnailSize;
             _thumbnailUnitWidth  = thumbnailSize.Width;
             _thumbnailUnitHeight = thumbnailSize.Height;
             num = ComputeNumAcross(base.ClientSize.Width, _thumbnailUnitWidth);
         }
         else
         {
             num = 100 / Program.Preferences.ThumbnailPercentage;
             _thumbnailUnitWidth  = (base.ClientSize.Width - _verticalScrollBar.Width - 8) / num - 8;
             _thumbnailUnitHeight = (base.ClientSize.Height - 6) / num - ThumbnailLabelHeight - 6;
             Program.Preferences.ThumbnailSize = new Size(_thumbnailUnitWidth, _thumbnailUnitHeight);
         }
         thumbnailLayout.Compute(num);
         return(thumbnailLayout);
     }
 }
Exemple #5
0
        private void OnGroupChanged(GroupChangedEventArgs obj)
        {
            if ((obj.Group == ServerTree.Instance.RootNode && !obj.ChangeType.HasFlag(ChangeType.PropertyChanged)) || (obj.Group != ServerTree.Instance.RootNode && !obj.ChangeType.HasFlag(ChangeType.InvalidateUI)))
            {
                return;
            }
            ThumbnailLayout layout    = _layout;
            GroupBase       groupBase = layout?.Group;
            bool            flag      = false;

            if (layout != null)
            {
                ThumbnailLayout thumbnailLayout = CreateThumbnailLayout(groupBase);
                if (!obj.ChangeType.HasFlag(ChangeType.PropertyChanged) && thumbnailLayout.Equals(layout))
                {
                    Log.Write("布局不变,不重绘");
                    thumbnailLayout.Dispose();
                    UpdateNonLayoutSettings(layout);
                }
                else
                {
                    HideGroup(groupBase);
                    layout.Dispose();
                    _layoutHash[groupBase] = thumbnailLayout;
                    ShowGroup(groupBase);
                    flag = true;
                }
            }
            TreeNode treeNode = obj.Group;

            if (treeNode != ServerTree.Instance.RootNode)
            {
                while (treeNode != null)
                {
                    ThumbnailLayout value;
                    if (treeNode == groupBase)
                    {
                        if (!flag)
                        {
                            break;
                        }
                    }
                    else if (_layoutHash.TryGetValue(treeNode, out value))
                    {
                        _layoutHash.Remove(treeNode);
                        value.Dispose();
                    }
                    treeNode = treeNode.Parent;
                }
            }
            else
            {
                ResetLayout();
            }
            if (layout == null)
            {
                ServerBase serverBase = ServerTree.Instance.SelectedNode as ServerBase;
                if (serverBase != null)
                {
                    UpdateNonLayoutSettings(serverBase.ServerNode);
                }
            }
        }