ServiceController myService = new ServiceController(); myService.ServiceName = "ImapiService"; string svcStatus = myService.Status.ToString(); if (svcStatus == "Running"){ myService.Stop(); myService.Refresh(); } string svcStatu = myService.Status.ToString(); if (svcStatu == "Stopped"){ myService.Start(); myService.Refresh(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)