void InitializeThreads() { if (!IsEnabled || theDebugger.ProcessState != DebuggerProcessState.Paused) { Collection.Clear(); return; } var debugger = theDebugger.Debugger; var threadsInColl = new HashSet <DnThread>(Collection.Select(a => a.Thread)); var allThreads = new HashSet <DnThread>(debugger.Processes.SelectMany(p => p.Threads)); foreach (var thread in allThreads) { if (threadsInColl.Contains(thread)) { continue; } var vm = new ThreadVM(thread, threadContext); Collection.Add(vm); } for (int i = Collection.Count - 1; i >= 0; i--) { if (!allThreads.Contains(Collection[i].Thread)) { Collection.RemoveAt(i); } } foreach (var vm in Collection) { vm.IsCurrent = stackFrameService.SelectedThread == vm.Thread; vm.UpdateFields(); } }
void InitializeThreads() { if (!IsEnabled || DebugManager.Instance.ProcessState != DebuggerProcessState.Stopped) { Collection.Clear(); return; } var debugger = DebugManager.Instance.Debugger; var threadsInColl = new HashSet<DnThread>(Collection.Select(a => a.Thread)); var allThreads = new HashSet<DnThread>(debugger.Processes.SelectMany(p => p.Threads)); foreach (var thread in allThreads) { if (threadsInColl.Contains(thread)) continue; var vm = new ThreadVM(thread); Collection.Add(vm); } for (int i = Collection.Count - 1; i >= 0; i--) { if (!allThreads.Contains(Collection[i].Thread)) Collection.RemoveAt(i); } foreach (var vm in Collection) { vm.IsCurrent = StackFrameManager.Instance.SelectedThread == vm.Thread; vm.UpdateFields(); } }