void ShowStartupAppsFromSelectedComputersExecute(object param) { var dataToShow = new List <NodeItem>(); var computers = DomainComputers?.Where(x => x.IsSelected).ToList(); foreach (var computer in computers) { // Add ping here also using (_registryEditor = new RegistryEditor(computer?.Name, LookupSource, StartRemoteRegistryServiceIfNeeded)) { Dictionary <string, string> apps = null; try { apps = _registryEditor.GetAllStartupAppsFromRegistry(SkippableSource); } catch { } var data = apps?.Select(x => new KeyValuePair <string, string>(x.Key, x.Value)).ToList(); string name = string.Empty; if (data == null) { name = $"{computer?.Name} / (Not available)"; } else if (!data.Any()) { name = $"{computer?.Name} / NO EXTRA APPS"; } else { name = $"{computer?.Name}"; } dataToShow.Add(new NodeItem { ComputerName = name, Data = new ObservableCollection <KeyValuePair <string, string> >(data ?? new List <KeyValuePair <string, string> >()) }); } } var window = new StartupAppsWindow(); var viewModel = new StartupAppsWindowViewModel(dataToShow); window.DataContext = viewModel; window.Show(); }
void UpdateString(object o, PropertyChangedEventArgs e) { if (DomainComputers != null) { var selectedData = DomainComputers.Where(x => x.IsSelected); ComboContent = string.Join(", ", selectedData.Select(x => x.Name)); } try { ShowStartupAppsFromSelectedComputers.NotifyCanExecuteChanged(); } catch { } }