private void ListViewContextsItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (!_sortingContexts) { _sortingContexts = true; _contextListSorter.SortLastColumn(); // try to reselect the previously selected context if (_reselectContextId != UserSettings.InvalidContextId) { StackHashStatus status = this.DataContext as StackHashStatus; if (status != null) { foreach (StackHashContextStatus contextStatus in status.ContextStatusCollection) { if (contextStatus.ContextId == _reselectContextId) { listViewContexts.SelectedItem = contextStatus; break; } } } } _sortingContexts = false; } }
private void ListViewTasksItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (!_sortingTasks) { _sortingTasks = true; _taskListSorter.SortLastColumn(); _sortingTasks = false; } }
void ListViewScripts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (!_sortingScripts) { _sortingScripts = true; if ((_clientLogic.ScriptData != null) && (_reselectScriptName != null)) { foreach (StackHashScriptFileData script in _clientLogic.ScriptData) { if (script.Name == _reselectScriptName) { listViewScripts.SelectedItem = script; break; } } } _listViewSorter.SortLastColumn(); _sortingScripts = false; } }
void clientLogic_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (this.Dispatcher.CheckAccess()) { ClientLogic clientLogic = this.DataContext as ClientLogic; if ((e.PropertyName == "CurrentView") && (clientLogic.CurrentView == ClientLogicView.EventDetail)) { _listViewCabsSorter.SortLastColumn(); _listViewEventInfosSorter.SortLastColumn(); DisplayCab selectedCab = listViewCabs.SelectedItem as DisplayCab; if (selectedCab != null) { clientLogic.CurrentCab = selectedCab; } } } else { this.Dispatcher.BeginInvoke(new Action <object, PropertyChangedEventArgs>(clientLogic_PropertyChanged), sender, e); } }