Example #1
0
        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();
        }
Example #2
0
        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
            {
            }
        }
Example #3
0
 public static void DomainComputers(String ip, String domain, String username, String password)
 {
     if (String.IsNullOrEmpty(username))
     {
         using (DomainComputers dc = new DomainComputers(ip))
         {
             dc.Query();
             dc.Print();
         }
     }
     else
     {
         using (DomainComputers dc = new DomainComputers(ip, username, password))
         {
             dc.Query();
             dc.Print();
         }
     }
 }
Example #4
0
 bool CanExecuteShowStartupApps(object param)
 {
     return(DomainComputers?.Any(x => x.IsSelected) ?? false);
 }