public static void Reset() { lock (StaticCriticalSection) { Instances.Clear(); InitQueue.Clear(); } }
static async Task InitDispatcherLoopAsync() { while (!QtVsToolsPackage.Instance.Zombied) { while (InitQueue.IsEmpty) { await Task.Delay(100); } if (InitQueue.TryDequeue(out QtProjectTracker tracker)) { if (InitStatus == null) { await QtVsToolsPackage.Instance.JoinableTaskFactory .SwitchToMainThreadAsync(); tracker.BeginInitStatus(); await TaskScheduler.Default; } else { await QtVsToolsPackage.Instance.JoinableTaskFactory .SwitchToMainThreadAsync(); tracker.UpdateInitStatus(0); await TaskScheduler.Default; } await tracker.InitializeAsync(); } if (InitStatus != null && (InitQueue.IsEmpty || InitStatus.UserCancellation.IsCancellationRequested)) { if (InitStatus.UserCancellation.IsCancellationRequested) { InitQueue.Clear(); } tracker.EndInitStatus(); } } }