Exemplo n.º 1
0
        private static void TestMinimapItem(object item, DataGridContext gridContext, List <DiffMinimapItemInfo> itemInfoList, ref DiffMinimapItemInfo itemInfo)
        {
            var rowState = GetDiffState(item);

            if (rowState != itemInfo.DiffState || itemInfo.GridContext != gridContext)
            {
                if (itemInfo.Count != 0)
                {
                    itemInfoList.Add(itemInfo);
                    itemInfo = new DiffMinimapItemInfo();
                }
            }

            itemInfo.GridContext = gridContext;
            itemInfo.DiffState   = rowState;
            itemInfo.Count++;
        }
Exemplo n.º 2
0
        private void ResetVerticalMinimap()
        {
            if (this.grid == null || this.GridControl == null)
            {
                return;
            }

            var gridContext = DataGridControl.GetDataGridContext(this.GridControl);
            var items       = DiffMinimapItemInfo.CollectMinimapItems(gridContext);

            this.grid.Children.Clear();
            this.grid.RowDefinitions.Clear();
            this.grid.ColumnDefinitions.Clear();
            this.grid.ColumnDefinitions.Add(new ColumnDefinition());
            this.grid.ColumnDefinitions.Add(new ColumnDefinition());
            this.grid.ColumnDefinitions.Add(new ColumnDefinition());

            foreach (var item in items)
            {
                var brush  = item.Background;
                var border = new Border()
                {
                    BorderThickness = new Thickness(0), Background = brush,
                };
                Grid.SetRow(border, this.grid.RowDefinitions.Count);
                Grid.SetColumn(border, 0);
                Grid.SetColumnSpan(border, 3);
                if (item.GridContext.ParentItem != null)
                {
                    if (item.DiffState == DiffMinimapItemState.Null)
                    {
                        border.Width = 1;
                    }
                    else
                    {
                        Grid.SetColumn(border, 1);
                        Grid.SetColumnSpan(border, 1);
                    }
                }
                this.grid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength((double)item.Count / items.Length, GridUnitType.Star),
                });
                this.grid.Children.Add(border);
            }
        }
Exemplo n.º 3
0
        public static               DiffMinimapItemInfo[] CollectMinimapItems(DataGridContext gridContext)
        {
            var itemInfoList = new List <DiffMinimapItemInfo>();
            var itemInfo     = new DiffMinimapItemInfo();

            var items = DiffItemInfo.GetVisibleItems(gridContext);

            foreach (var item in items)
            {
                TestMinimapItem(item.Item, item.GridContext, itemInfoList, ref itemInfo);
            }
            if (itemInfo.Count != 0)
            {
                itemInfoList.Add(itemInfo);
            }

            return(itemInfoList.ToArray());
        }