private async void SetStartTypeButton_Click(object sender, RoutedEventArgs e) { if (StartTypeCombo.SelectedIndex == -1) { return; } var service = ServiceName.Text; int startType = 0; switch (StartTypeCombo.SelectedIndex) { case 0: // auto startType = (int)ServiceStartType.SERVICE_START_AUTO; break; case 1: startType = (int)ServiceStartType.SERVICE_START_BOOT; break; case 2: startType = (int)ServiceStartType.SERVICE_START_DEMAND; break; case 3: startType = (int)ServiceStartType.SERVICE_START_SYSTEM; break; case 4: startType = (int)ServiceStartType.SERVICE_DISABLED; break; } await base.RunAPIInBackground(() => { _ntServiceBridge.SetStartMode(service, startType); }); }