コード例 #1
0
        protected override void ClearItems()
        {
            try
            {
                _owningGrid.NoCurrentCellChangeCount++;
                if (ItemsInternal.Count > 0)
                {
                    if (_owningGrid.InDisplayIndexAdjustments)
                    {
                        // We are within columns display indexes adjustments. We do not allow changing the column collection while adjusting display indexes.
                        throw DataGridError.DataGrid.CannotChangeColumnCollectionWhileAdjustingDisplayIndexes();
                    }

                    _owningGrid.OnClearingColumns();
                    for (int columnIndex = 0; columnIndex < ItemsInternal.Count; columnIndex++)
                    {
                        // Detach the column...
                        ItemsInternal[columnIndex].OwningGrid = null;
                    }
                    ItemsInternal.Clear();
                    DisplayIndexMap.Clear();
                    AutogeneratedColumnCount = 0;
                    _owningGrid.OnColumnCollectionChanged_PreNotification(false /*columnsGrew*/);
                    base.ClearItems();
                    VisibleEdgedColumnsWidth = 0;
                    _owningGrid.OnColumnCollectionChanged_PostNotification(false /*columnsGrew*/);
                }
            }
            finally
            {
                _owningGrid.NoCurrentCellChangeCount--;
            }
        }
コード例 #2
0
 /// <summary>
 /// Clears this instance.
 /// </summary>
 public virtual void Clear()
 {
     for (var i = 0; i < Items.Count; ++i)
     {
         Items[i].Detach();
         Items[i].Parent = null;
     }
     itemHashSet.Clear();
     ItemsInternal.Clear();
 }
コード例 #3
0
 /// <summary>
 /// Clears this instance.
 /// </summary>
 public void Clear()
 {
     for (int i = 0; i < ItemsInternal.Count; ++i)
     {
         ItemsInternal[i].Detach();
         ItemsInternal[i].Parent = null;
     }
     ItemsInternal.Clear();
     itemHashSet.Clear();
     Cleared?.Invoke(this, new OnChildNodeChangedArgs(null, Operation.Clear));
 }
コード例 #4
0
            protected virtual void Sort(IList <SceneNode> nodes, RenderContext context)
            {
                sortingTransparentCache.Clear();
                sortingOpaqueCache.Clear();
                notSorted.Clear();

                Vector3 cameraPosition = context.Camera.Position;

                if (SortTransparentOnly)
                {
                    for (int i = 0; i < nodes.Count; ++i)
                    {
                        if (nodes[i].RenderCore.RenderType == RenderType.Transparent)
                        {
                            sortingTransparentCache.Add(new SortStruct(GetDistance(nodes[i], ref cameraPosition), nodes[i]));
                        }
                        else
                        {
                            notSorted.Add(nodes[i]);
                        }
                    }
                    sortingTransparentCache.Sort(delegate(SortStruct a, SortStruct b) { return(a.Key > b.Key ? -1 : a.Key < b.Key ? 1 : 0); });
                }
                else
                {
                    for (int i = 0; i < nodes.Count; ++i)
                    {
                        if (nodes[i].RenderCore.RenderType == RenderType.Transparent)
                        {
                            sortingTransparentCache.Add(new SortStruct(GetDistance(nodes[i], ref cameraPosition), nodes[i]));
                        }
                        else if (nodes[i].RenderCore.RenderType == RenderType.Opaque)
                        {
                            sortingOpaqueCache.Add(new SortStruct(GetDistance(nodes[i], ref cameraPosition), nodes[i]));
                        }
                        else
                        {
                            notSorted.Add(nodes[i]);
                        }
                    }
                    if (sortingTransparentCache.Count > 50 && sortingOpaqueCache.Count > 50)
                    {
                        Parallel.Invoke(() =>
                        {
                            sortingTransparentCache.Sort(delegate(SortStruct a, SortStruct b) { return(a.Key > b.Key ? -1 : a.Key < b.Key ? 1 : 0); });
                        }, () =>
                        {
                            sortingOpaqueCache.Sort(delegate(SortStruct a, SortStruct b) { return(a.Key > b.Key ? 1 : a.Key < b.Key ? -1 : 0); });
                        });
                    }
                    else
                    {
                        sortingTransparentCache.Sort(delegate(SortStruct a, SortStruct b) { return(a.Key > b.Key ? -1 : a.Key < b.Key ? 1 : 0); });
                        sortingOpaqueCache.Sort(delegate(SortStruct a, SortStruct b) { return(a.Key > b.Key ? 1 : a.Key < b.Key ? -1 : 0); });
                    }
                }

                ItemsInternal.Clear();
                for (int i = 0; i < notSorted.Count; ++i)
                {
                    ItemsInternal.Add(notSorted[i]);
                }
                for (int i = 0; i < sortingOpaqueCache.Count; ++i)
                {
                    ItemsInternal.Add(sortingOpaqueCache[i].Value);
                }
                for (int i = 0; i < sortingTransparentCache.Count; ++i)
                {
                    ItemsInternal.Add(sortingTransparentCache[i].Value);
                }

                sortingTransparentCache.Clear();
                sortingOpaqueCache.Clear();
                notSorted.Clear();
                InvalidateSceneGraph();
            }
コード例 #5
0
 private void Clear()
 {
     ItemsInternal.Clear();
     UpdateItems();
 }