private void threadIdListView_ColumnClick(object sender, ColumnClickEventArgs e) { _suppressEvents = true; // Create the sorting objects the first time they are required. if (_threadIdSorter == null) { // Create a delegate for comparing the IDs of the ThreadObjects that // correspond to two ListViewItems. ListViewSorter.RowComparer idComparer = delegate(ListViewItem x, ListViewItem y) { // The ListViewItem tags are ThreadObjects. int xint = ((ThreadObject)x.Tag).Id; int yint = ((ThreadObject)y.Tag).Id; return(xint - yint); }; _threadIdSorter = new ListViewSorter(threadIdListView); _threadIdSorter.CustomComparers[threadIdCol] = idComparer; _threadIdSorter.CustomComparers[threadCheckCol] = _checkComparer; _threadIdSorter.Sort(e.Column); } _suppressEvents = false; }
private void threadNameListView_ColumnClick(object sender, ColumnClickEventArgs e) { _suppressEvents = true; // Create the sorting objects the first time they are required. if (_threadNameSorter == null) { _threadNameSorter = new ListViewSorter(threadNameListView); _threadNameSorter.CustomComparers[threadNameCheckCol] = _checkComparer; _threadNameSorter.Sort(e.Column); } _suppressEvents = false; }
private void loggerListView_ColumnClick(object sender, ColumnClickEventArgs e) { _suppressEvents = true; // Create the sorter object the first time it is required. if (_loggerSorter == null) { _loggerSorter = new ListViewSorter(loggerListView); _loggerSorter.CustomComparers[loggerCheckCol] = _checkComparer; _loggerSorter.Sort(e.Column); } _suppressEvents = false; }
public ServerListEditor(List <RemoteServer> remoteServers) { InitializeComponent(); _inputServers = remoteServers; foreach (RemoteServer originalObject in _inputServers) { // The user's edits will be kept in the editable objects (keys of _newToOld) // until he clicks OK, then the properties of each editableObject will be // copied to the corresponding originalObject. SavedServer editableObject = originalObject.MakeSavedServer(); _newToOld[editableObject] = originalObject; AddServerItem(editableObject); } _sorter = new ListViewSorter(listView1); _sorter.Sort(colDispName.Index); }