Ejemplo n.º 1
0
        protected override void ExecuteOverride()
        {
            this.Inputs.Clear();
            this.Description = "Initializing Query";
            this.Initialize();
            this.Description = "Performing additional action";
            this.PerformAction(_action);

            this.Description = string.Format("Start with {0}", _startingItems);
            if (_action != NotifyCollectionChangedAction.Reset)
            {
                this.Description += string.Format(", then {0} {1}", _action.ToString(), _additionalItems);
            }
        }
Ejemplo n.º 2
0
 private void InitializeAddOrRemove(NotifyCollectionChangedAction action, IList changedItems, int startingIndex)
 {
     if (action == NotifyCollectionChangedAction.Add)
     {
         InitializeAdd(action, changedItems, startingIndex);
     }
     else if (action == NotifyCollectionChangedAction.Remove)
     {
         InitializeRemove(action, changedItems, startingIndex);
     }
     else
     {
         throw new Exception(string.Format("Unsupported action: {0}", action.ToString()));
     }
 }
 //---------------------------------------------------------------------
 private void _initializeAddOrRemove(NotifyCollectionChangedAction action, IList <T> changedItems, int startingIndex)
 {
     if (action == NotifyCollectionChangedAction.Add)
     {
         _initializeAdd(action, changedItems, startingIndex);
     }
     else if (action == NotifyCollectionChangedAction.Remove)
     {
         _initializeRemove(action, changedItems, startingIndex);
     }
     else
     {
         Contract.Assert(false, $"Unsupported action: { action.ToString() }");
     }
 }
Ejemplo n.º 4
0
 private void UpdateView(int rowIndex, int count, NotifyCollectionChangedAction action)
 {
     if (this.View == null || this.treeGrid.TreeGridPanel == null)
     {
         return;
     }
     if (action == NotifyCollectionChangedAction.Add)
     {
         this.treeGrid.TreeGridPanel.InsertRows(rowIndex, count);
     }
     else if (action == NotifyCollectionChangedAction.Remove)
     {
         this.treeGrid.TreeGridPanel.RemoveRows(rowIndex, count);
     }
     else
     {
         throw new NotImplementedException("UpdateView not implemented for" + action.ToString());
     }
     this.treeGrid.TreeGridPanel.UpdateScrollBars();
     this.treeGrid.TreeGridPanel.InvalidateMeasureInfo();
 }
 private void InitializeAddOrRemove(NotifyCollectionChangedAction action, IList changedItems, int startingIndex)
 {
     if (action == NotifyCollectionChangedAction.Add)
         InitializeAdd(action, changedItems, startingIndex);
     else if (action == NotifyCollectionChangedAction.Remove)
         InitializeRemove(action, changedItems, startingIndex);
     else
         throw new Exception(string.Format("Unsupported action: {0}", action.ToString()));
 }
Ejemplo n.º 6
0
        private void UpdateDataRow(int index, int count, NotifyCollectionChangedAction action)
        {
            if (this.treeGrid.TreeGridPanel == null)
            {
                return;
            }

            var datarow = this.treeGrid.RowGenerator.Items.FirstOrDefault(row => row.RowIndex == index);
            var level   = count;

            if (datarow != null)
            {
                if (action == NotifyCollectionChangedAction.Add)
                {
                    var rowItems = this.treeGrid.RowGenerator.Items.Where(rowInfo => rowInfo.RowIndex >= index).OrderBy(item => item.RowIndex);
                    rowItems.ForEach(row =>
                    {
                        row.SuspendUpdateStyle();
                        if (row.RowType != TreeRowType.HeaderRow)
                        {
                            row.RowIndex += level;
                        }
                        row.ResumeUpdateStyle();
                    });
                }
                else if (action == NotifyCollectionChangedAction.Remove)
                {
                    datarow.RowIndex = -1;
                    var rowItems     = this.treeGrid.RowGenerator.Items.Where(rowInfo => rowInfo.RowIndex >= (index + count)).OrderBy(item => item.RowIndex);
                    var removedItems = this.treeGrid.RowGenerator.Items.Where(rowInfo => ((rowInfo.RowIndex < (index + count)) && rowInfo.RowIndex >= index));
                    removedItems.ForEach(ResetRowIndex);
                    rowItems.ForEach(row =>
                    {
                        row.SuspendUpdateStyle();
                        if (row.RowType != TreeRowType.HeaderRow)
                        {
                            row.RowIndex -= level;
                        }
                        row.ResumeUpdateStyle();
                    });
                }
                else
                {
                    throw new NotImplementedException("UpdateDataRow is not implemented for" + action.ToString());
                }
            }
            UpdateView(index, count, action);
        }
Ejemplo n.º 7
0
        private void RefreshView(int rowIndex, int count, NotifyCollectionChangedAction action, int recordIndex = 0, int recordCount = 0)
        {
            if (this.View == null || this.treeGrid.TreeGridPanel == null)
            {
                return;
            }

            if (action == NotifyCollectionChangedAction.Add)
            {
                this.treeGrid.TreeGridPanel.InsertRows(rowIndex, count);
            }
            else if (action == NotifyCollectionChangedAction.Remove)
            {
                this.treeGrid.TreeGridPanel.RemoveRows(rowIndex, count);
            }
            else
            {
                throw new NotImplementedException("RefreshView not implemented for" + action.ToString());
            }
            this.RefreshDataRows();
            this.treeGrid.TreeGridPanel.UpdateScrollBars();
        }