private void startMode_button_Click(object sender, System.EventArgs e) { String scInfo; String wmiStartMode = ""; switch (this.modeComboBox.SelectedItem.ToString()) { case "Automatic": wmiStartMode = "Auto"; break; case "Manual": wmiStartMode = "Manual"; break; case "Disabled": wmiStartMode = "Disabled"; break; } if (ServiceChange.ChangeServiceStartMode(ref currentService, wmiStartMode, out scInfo)) { textBox.Text = "Service start mode updated successfully."; } else { textBox.Text = scInfo; } }
private void startName_button_Click(object sender, System.EventArgs e) { ServiceProcessInstaller svcProcInst = new ServiceProcessInstaller(); textBox.Text = "Displaying service installer dialog..."; if (ServiceChange.GetServiceAccount(ref svcProcInst)) { textBox.Text = "Changing the service account is not currently implemented in this application."; } else { textBox.Text = "No change made to service account."; } String scInfo; if (ServiceChange.QueryService(ref currentService, out scInfo)) { textBox.Text += Environment.NewLine + scInfo; } }
private void query_button_Click(object sender, System.EventArgs e) { textBox.Text = "Querying service configuration..."; String scInfo; currentService.DisplayName = "TelNet"; if (ServiceChange.QueryService(ref currentService, out scInfo)) { textBox.Text = scInfo; this.startName_button.Enabled = true; this.startMode_button.Enabled = true; this.modeLabel.Visible = true; this.modeComboBox.Visible = true; } else { textBox.Text = "Could not read configuration information for service."; } }