private void RestartService(string serviceName) { CMDHelper cmd = CMDHelper.GetInstance(); cmd.OnErrorDataReceived += (obj, e) => { throw (new Exception(e.Data)); }; cmd.SendCommand($"sc stop {serviceName}"); cmd.SendCommand($"sc start {serviceName}"); }