private async Task AddTestModuleAsync() { var result = await Messenger.Default.SendAsync(new OpenTestModuleMessage()); if (!result.Success) { return; } if (testAssemblies.Any(x => x.Path.Equals(result.Result))) { MessageBox.Show($"Selected assembly `{result.Result}` is already loaded.", "Guinunit", MessageBoxButton.OK, MessageBoxImage.Warning); return; } using (CursorHelper.UseWait()) { var node = TestManager.LoadModule(result.Result); var testCaseLookup = new Dictionary <string, TestCase>(); var task = RunTaskAsync(() => new TestCase(node.SelectSingleNode("./test-suite"), testCaseLookup)); var watcher = new FileSystemWatcher { Path = Path.GetDirectoryName(result.Result), Filter = Path.GetFileName(result.Result), NotifyFilter = NotifyFilters.LastWrite, EnableRaisingEvents = true }; watcher.Changed += (_, __) => MessageBox.Show("TODO: Reload!"); var filter = TestManager.CreateFilter(node); testAssemblies.Add(new TestModule(result.Result, filter, testCaseLookup, null)); TotalCount = totalCount + Convert.ToInt32(node.Attributes?.GetNamedItem("testcasecount").Value ?? "0"); TestCases.Add(await task); } }