public void EnumServices() { // Get the list of available services and // load the list view control with the information try { fUpdatingUI = true; this.sbInfo.Text = "Lendo lista de serviço, aguarde"; this.sbInfo.Refresh(); this.lvServices.Items.Clear(); if (!(mcolSvcs == null)) { mcolSvcs = new Hashtable(); } frmPC frmpc = new frmPC(); string computador; computador = frmpc.teste(); if (computador == "") { frmpc.computador = "."; } //svcs = new ServiceController[]; ServiceController[] svcs = ServiceController.GetServices(computador); foreach(ServiceController svc in svcs) { //if (svc.DisplayName == "Recognition MDI (Digitalizacao Custodia) - Gerador de Agrupamentos") //{ ViewItem = this.lvServices.Items.Add(svc.DisplayName); ViewItem.SubItems.Add(svc.Status.ToString()); ViewItem.SubItems.Add(svc.ServiceType.ToString()); //mcolSvcs.Add(svc, svc.DisplayName); mcolSvcs.Add(svc.DisplayName, svc); //Next svc++; //} } } catch (Exception exp) { MessageBox.Show(exp.Message, exp.Source, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.sbInfo.Text = "Lendo"; fUpdatingUI = false; } }
private void menuItem1_Click(object sender, EventArgs e) { frmPC frmpc = new frmPC(); frmpc.ShowDialog(this); frmpc.Dispose(); }