예제 #1
0
 public void GetServices(BO.Host host)
 {
     host.Services = new List <BO.Service>();
     try
     {
         ImpersonateUser iu = new ImpersonateUser();
         if (!(string.IsNullOrEmpty(host.Username) || string.IsNullOrEmpty(host.Password)))
         {
             iu.Impersonate(host.Domain, host.Username, AES.DecryptString(host.Password));
         }
         System.ServiceProcess.ServiceController[] sc = System.ServiceProcess.ServiceController.GetServices(host.Value);
         foreach (var s in sc)
         {
             host.Services.Add(new BO.Service
             {
                 Name   = s.DisplayName,
                 Value  = s.ServiceName,
                 Status = s.Status
             });
         }
         iu.Undo();
     }
     catch (Exception)
     {
         //OnLog(new BO.LogEventArgs(string.Format("Failed to Connect to Server: {0} [{1}]\r\n", host.Name, host.Value )));
     }
 }
예제 #2
0
        void MenuItem_Host_Edit(object sender, RoutedEventArgs e)
        {
            WndAddServer editHost = new WndAddServer();

            BO.Host host = (BO.Host)lbxHosts.SelectedItem;
            editHost.Host = host;
            editHost.ShowDialog();
            if (editHost.isValid)
            {
                Hosts.Profile[ActiveServers.Name][Hosts.Profile[ActiveServers.Name].IndexOf((BO.Host)lbxHosts.SelectedItem)] = editHost.Host;
            }
            lbxHosts.Items.Refresh();
            editHost.Reset();
            editHost.Close();
        }
예제 #3
0
 public void Reset()
 {
     this.Host            = new BO.Host();
     tbxPassword.Password = Password = string.Empty;
 }