Exemple #1
0
 private void BtnContinue_Click(object sender, EventArgs e)
 {
     try
     {
         m_service.Continue();
     }
     catch (Exception exc)
     {
         ShowError("Unable to continue service.", exc.Message);
     }
     finally
     {
         UpdateServiceControls();
         ListServices.Focus();
     }
 }
Exemple #2
0
 private void BtnConnect_Click(object sender, EventArgs e)
 {
     try
     {
         OpenSelectedService(null);
         ListServices.Items.Clear();
         if (sender == BtnConnect)
         {
             m_manager.Connect(string.IsNullOrEmpty(BoxCompName.Text) ? null : BoxCompName.Text);
             m_manager.GetServices(out IEnumService services);
             while (true)
             {
                 services.Next(out string name, out string display);
                 if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(display))
                 {
                     break;
                 }
                 ListServices.Items.Add(new ServiceItem(name, display));
             }
             if (ListServices.Items.Count > 0)
             {
                 ListServices.SetSelected(0, true);
             }
             m_connected = true;
         }
         else
         {
             m_manager.Disconnect();
             m_connected = false;
             UpdateServiceControls();
         }
         UpdateServiceInfo();
     }
     catch (Exception exc)
     {
         ShowError($"Unable to connect SCM on computer {BoxCompName.Text}.", exc.Message);
     }
     finally
     {
         UpdateConnectButtons();
         UpdateServiceInfo();
         UpdateServiceControls();
         ListServices.Focus();
     }
 }