Пример #1
0
 private void StopService_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     try
     {
         ManageService ms = new ManageService();
         string serviceName = ms.GetServiceName(servicesHost);
         ms.StopService(serviceName);
     }
     catch (Exception ex)
     {
         ModernDialog.ShowMessage(ex.Message, "消息", MessageBoxButton.OK);
     }
 }
Пример #2
0
 private void StopService_CanExecute(object sender, CanExecuteRoutedEventArgs e)
 {
     ManageService ms = new ManageService();
     e.CanExecute = ms.ServiceIsExisted(ms.GetServiceName(servicesHost)) && ms.GetServiceStatus(ms.GetServiceName(servicesHost)) == ServiceControllerStatus.Running;
 }
Пример #3
0
 private void UnInstalService_CanExecute(object sender, CanExecuteRoutedEventArgs e)
 {
     ManageService ms = new ManageService();
     e.CanExecute = ms.ServiceIsExisted(ms.GetServiceName(servicesHost));
 }