コード例 #1
0
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="source">Relação da coleção de origem dos dados.</param>
 /// <param name="comparer">Comparador que será utilizado para ordenar os itens.</param>
 public SortableObservableCollection(IObservableCollection <T> source, IComparer <T> comparer)
 {
     source.Require("source").NotNull();
     comparer.Require("comparer").NotNull();
     _source   = source;
     _comparer = comparer;
     _comparerPropertiesContainer = comparer as IPropertiesContainer;
     _source.CollectionChanged   += SourceCollectionChanged;
     _indexes = new BaseObservableCollection <int>();
     for (var i = 0; i < _source.Count; i++)
     {
         _indexes.Add(i);
     }
     foreach (var i in _source)
     {
         RegisterItem(i);
     }
     CalculateIndexes();
 }
コード例 #2
0
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="owner"></param>
 public ReentracyMonitor(BaseObservableCollection <T> owner)
 {
     _owner = owner;
     lock (_owner._reentrancyThreads)
         _owner._reentrancyThreads.Add(System.Threading.Thread.CurrentThread);
 }