Example #1
0
 private int[] DoSort(int columnIndex, bool descending)
 {
     if ((columnIndex < 0) || (columnIndex >= this.Columns.Count))
     {
         throw new ArgumentOutOfRangeException("columnIndex");
     }
     IResultNodeComparer comparer = ((this._options & MmcListViewOptions.UseCustomSorting) == MmcListViewOptions.None) ? new DefaultComparer() : this._sorter;
     if (comparer == null)
     {
         throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ListViewDoSortNoComparer));
     }
     comparer.SetColumnIndex(columnIndex);
     ResultNode[] array = this.ResultNodes.ToArray();
     this._states |= ListViewStates.SortingInProgress;
     Array.Sort(array, comparer);
     this._states &= ~ListViewStates.SortingInProgress;
     int[] numArray = new int[array.Length];
     for (int i = 0; i < array.Length; i++)
     {
         numArray[i] = array[i].Id;
     }
     if (descending)
     {
         Array.Reverse(array);
     }
     this.ResultNodes.Replace(array);
     return numArray;
 }
Example #2
0
 private void HandleSelectionChange(int[] scopeNodeIds, int[] resultNodeIds, IRequestStatus requestStatus)
 {
     this._selectedNodes.Clear();
     foreach (ScopeNode node in base.ScopeNode.Children)
     {
         if (Array.IndexOf<int>(scopeNodeIds, node.Id) != -1)
         {
             this._selectedNodes.Add(node);
         }
     }
     foreach (int num in resultNodeIds)
     {
         ResultNode item = this._resultNodes.GetNode(num);
         if (item == null)
         {
             TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Verbose, 12, "A selected ResultNode with id {0} in list view {1} appears to have been removed.", new object[] { num, base.ViewInstanceId });
         }
         else
         {
             this._selectedNodes.Add(item);
         }
     }
     this._states |= ListViewStates.SnapInProcessingSelectionChange;
     SyncStatus status = new SyncStatus(requestStatus);
     this.OnSelectionChanged(status);
     this._states &= ~ListViewStates.SnapInProcessingSelectionChange;
 }