internal DeferDisposable(ObservableHashList owner)
            {
                Debug.Assert(owner != null);

                m_owner = owner;
                m_owner.m_deferCount++;
            }
Example #2
0
            public DeferOperationNotifications(ObservableHashList owner)
            {
                Debug.Assert(owner != null);

                m_owner = owner;
                m_owner.m_deferOperationCount++;
            }
    public ReadOnlyObservableHashList()
    {
      m_hashList = new ObservableHashList();

      m_hashList.CollectionChanged += new NotifyCollectionChangedEventHandler( this.OnInnerCollectionChanged );
      m_hashList.PropertyChanged += new PropertyChangedEventHandler( this.OnInnerPropertyChanged );
    }
Example #4
0
        public ReadOnlyObservableHashList()
        {
            m_hashList = new ObservableHashList();

            m_hashList.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnInnerCollectionChanged);
            m_hashList.PropertyChanged   += new PropertyChangedEventHandler(this.OnInnerPropertyChanged);
        }
 public ObservableHashListDebugView(ObservableHashList hashlist)
 {
     if (hashlist == null)
     {
         throw new ArgumentNullException("hashlist");
     }
     m_hashList = hashlist;
 }
Example #6
0
            public ObservableHashListDebugView(ObservableHashList list)
            {
                if (list == null)
                {
                    throw new ArgumentNullException("list");
                }

                m_list = list;
            }
            internal ObservableHashListDebugView(ObservableHashList owner)
            {
                if (owner == null)
                {
                    throw new ArgumentNullException("list");
                }

                m_owner = owner;
            }
    internal void ForceRefreshDistinctValuesForFieldName( string fieldName, ObservableHashList columnDistinctValues )
    {
      if( this.AutoFilterMode == AutoFilterMode.None )
        return;

      // Avoid multiple refreshes caused by NotifyCollectionChanged events when adding or removing
      // values from distinct values lists
      if( this.IsRefreshingDistinctValues )
        throw new InvalidOperationException( "An attempt was made to refresh the DataGridCollectionView while it is already in the process of refreshing." );

      this.IsRefreshingDistinctValues = true;

      DataGridItemPropertyBase dataGridItemProperty = this.ItemProperties[ fieldName ];

      if( ( dataGridItemProperty == null ) || ( !dataGridItemProperty.CalculateDistinctValues ) )
      {
        this.IsRefreshingDistinctValues = false;
        return;
      }

      this.RefreshDistinctValuesForField( dataGridItemProperty );

      // Reset flags
      this.IsRefreshingDistinctValues = false;
    }
    internal IList GetAutoFilterValues( string fieldName )
    {
      Debug.Assert( !string.IsNullOrEmpty( fieldName ), "fieldName can't be null" );

      if( fieldName == null )
        throw new ArgumentNullException( "dataGridItemProperty" );

      IList autoFilterValues;

      if( !m_autoFilterValues.TryGetValue( fieldName, out autoFilterValues ) )
      {
        ObservableHashList hashList = new ObservableHashList();
        autoFilterValues = hashList;
        m_autoFilterValues.InternalAdd( fieldName, hashList );

        // Notify the DetailDescription that it must listen to 
        // AutoFilterValues CollectionChanged for a specific
        // field name and autoFilterValues in order to raise
        // the AutoFilterValuesChanged properly
        if( m_parentDetailDescription != null )
          m_parentDetailDescription.RegisterAutoFilterValuesChangedEvent( fieldName, hashList );
      }

      return autoFilterValues;
    }
    internal static void RemoveUnusedDistinctValues( IComparer sortComparer, HashSet<object> currentValues, ObservableHashList cachedValues, object convertNullTo )
    {
      bool needsResort = false;
      List<int> itemsToDelete = new List<int>();
      int cachedValuesCount = cachedValues.Count;

      // Find no more existing values
      for( int i = 0; i < cachedValuesCount; i++ )
      {
        object cachedValue = cachedValues[ i ];

        if( cachedValue == convertNullTo )
        {
          cachedValue = null;
        }

        if( currentValues.Remove( cachedValue ) )
        {
          // remaining items will only be newly added ones
        }
        else
        {
          // Item is not currently in column, will be deleted
          itemsToDelete.Add( i );
        }
      }

      // Remove unused items
      int count = itemsToDelete.Count;

      for( int i = count - 1; i >= 0; i-- )
      {
        cachedValues.RemoveAt( itemsToDelete[ i ] );
      }

      // Every item not removed from the current values are new values, we add them to columnDistinctValues
      needsResort = ( currentValues.Count > 0 );

      foreach( object key in currentValues )
      {
        if( key == null )
        {
          cachedValues.Add( convertNullTo );
        }
        else
        {
          cachedValues.Add( key );
        }
      }

      if( needsResort )
        cachedValues.Sort( sortComparer );
    }
 public ObservableHashListDebugView( ObservableHashList hashlist )
 {
   if( hashlist == null )
   {
     throw new ArgumentNullException( "hashlist" );
   }
   m_hashList = hashlist;
 }
 public DeferOperationNotifications( ObservableHashList list )
 {
   m_innerList = list;
   m_innerList.m_deferOperationCount++;
 }
 public DeferOperationNotifications(ObservableHashList list)
 {
     m_innerList = list;
     m_innerList.m_deferOperationCount++;
 }