/// <summary> /// Подсветка выбранного запуска в меню /// </summary> private void HighlightSelectedRun() { var menuItems = TestingRunMenuItem.Items.OfType <MenuItem>(); TestRunEntity selectedEntity = _selectedRunFolder; foreach (var item in from item in menuItems let header = item.Header.ToString() where string.Compare(selectedEntity.ToString(), header, StringComparison.CurrentCultureIgnoreCase) == 0 select item) { item.Background = UiUtils.DefaulHighlightBrush; break; } }
private void ConfigureFileSystemWatcher() { var newTestWatcher = new FileSystemWatcher(ApplicationConfigReader.Instance.Viva64Logs) { NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName }; newTestWatcher.Created += (sender, args) => { if (args.ChangeType != WatcherChangeTypes.Created) { return; } var newDirName = args.Name; string machineName; DateTime testingDateTime; AnalyzerUtilities.ExtractLaunchPartyComponents(newDirName, out machineName, out testingDateTime); var newRunEntity = new TestRunEntity { MachineName = machineName, RunningDateTime = testingDateTime, TestRunDirectory = args.FullPath }; RunInUiSynchronizationContext(() => { var newItem = new MenuItem { Header = newRunEntity.ToString() }; TestingRunMenuItem.Items.Insert(0, newItem); HighlightFirstMenuItem(); UiUtils.SetMenuItemsEnabled(TestingRunMenuItem, false); }); _selectedRunFolder = newRunEntity.TestRunDirectory; }; newTestWatcher.EnableRaisingEvents = true; }