예제 #1
0
 public BestFitQueue.BestFitRequest Dequeue(GridViewColumn column)
 {
     if (column == null)
     {
         throw new ArgumentNullException(nameof(column));
     }
     if (column.OwnerTemplate != this.template)
     {
         throw new ArgumentException("Column " + (object)column + " is not owned by the current GridViewTemplate.");
     }
     BestFitQueue.BestFitRequest bestFitRequest = new BestFitQueue.BestFitRequest(BestFitQueue.BestFitOperation.BestFitColumn, column);
     if (this.bestFitRequests.Contains(BestFitQueue.BestFitAllColumns))
     {
         this.bestFitRequests.Clear();
         foreach (GridViewColumn column1 in (Collection <GridViewDataColumn>) this.template.Columns)
         {
             if (column1 != column)
             {
                 this.bestFitRequests.AddLast(new BestFitQueue.BestFitRequest(BestFitQueue.BestFitOperation.BestFitColumn, column1));
             }
         }
     }
     else
     {
         this.bestFitRequests.Remove(bestFitRequest);
     }
     return(bestFitRequest);
 }
예제 #2
0
 public BestFitQueue.BestFitRequest Dequeue()
 {
     if (this.bestFitRequests.First == null)
     {
         return((BestFitQueue.BestFitRequest)null);
     }
     BestFitQueue.BestFitRequest bestFitRequest = this.bestFitRequests.First.Value;
     this.bestFitRequests.RemoveFirst();
     return(bestFitRequest);
 }
예제 #3
0
 public void ProcessRequests()
 {
     if (this.processing > 0 || this.tableElement == null || this.tableElement.ViewTemplate == null)
     {
         return;
     }
     ++this.processing;
     if (this.BestFitQueue.Count == 0 || !this.TableElement.CanBestFit())
     {
         --this.processing;
     }
     else
     {
         this.TableElement.UpdateLayout();
         if (this.TableElement.VisualRows.Count == 0 || this.tableElement.ViewTemplate == null || this.TableElement.ViewTemplate.Columns.Count == 0)
         {
             --this.processing;
         }
         else if (this.TableElement.ViewInfo.ParentRow != null && this.TableElement.DesiredSize == SizeF.Empty)
         {
             this.TableElement.GridViewElement.UpdateLayout();
             --this.processing;
         }
         else
         {
             this.updateRowsHeight = false;
             while (this.BestFitQueue.Count > 0)
             {
                 BestFitQueue.BestFitRequest bestFitRequest = this.BestFitQueue.Dequeue();
                 BestFitColumnMode?          autoSizeMode   = bestFitRequest.AutoSizeMode;
                 if (bestFitRequest.Operation == BestFitQueue.BestFitOperation.BestFitAllColumns)
                 {
                     this.BestFitColumnsCore(autoSizeMode);
                 }
                 else
                 {
                     GridViewGroupColumn column = bestFitRequest.Column as GridViewGroupColumn;
                     if (column != null)
                     {
                         this.BestFitGroupColumn(column, true, new BestFitColumnMode?());
                     }
                     else
                     {
                         BestFitColumnMode mode = autoSizeMode.HasValue ? autoSizeMode.Value : bestFitRequest.Column.AutoSizeMode;
                         this.BestFitColumnCore(bestFitRequest.Column, mode);
                     }
                 }
             }
             this.UpdateLayout();
             this.SynchronizeViews();
             --this.processing;
         }
     }
 }
예제 #4
0
        private void ClearBestFitColumnRequests(BestFitColumnMode?mode)
        {
            LinkedListNode <BestFitQueue.BestFitRequest> previous;

            for (LinkedListNode <BestFitQueue.BestFitRequest> node = this.bestFitRequests.Last; node != null; node = previous)
            {
                BestFitQueue.BestFitRequest bestFitRequest = node.Value;
                previous = node.Previous;
                if (bestFitRequest.Operation != BestFitQueue.BestFitOperation.BestFitColumn)
                {
                    BestFitColumnMode?autoSizeMode = bestFitRequest.AutoSizeMode;
                    BestFitColumnMode?nullable     = mode;
                    if ((autoSizeMode.GetValueOrDefault() != nullable.GetValueOrDefault() ? 0 : (autoSizeMode.HasValue == nullable.HasValue ? 1 : 0)) == 0)
                    {
                        continue;
                    }
                }
                this.bestFitRequests.Remove(node);
            }
        }
예제 #5
0
 public void EnqueueBestFitColumn(GridViewColumn column)
 {
     if (column == null)
     {
         throw new ArgumentNullException(nameof(column));
     }
     if (column.OwnerTemplate != this.template)
     {
         throw new ArgumentException("Column " + (object)column + " is from different GridViewTemplate");
     }
     if (!column.IsVisible)
     {
         return;
     }
     BestFitQueue.BestFitRequest bestFitRequest = new BestFitQueue.BestFitRequest(BestFitQueue.BestFitOperation.BestFitColumn, column);
     if (this.bestFitRequests.Contains(BestFitQueue.BestFitAllColumns) || this.bestFitRequests.Contains(bestFitRequest))
     {
         return;
     }
     this.bestFitRequests.AddLast(bestFitRequest);
 }