public void TabClosed() { Configuration.WebMediaPortalHosting.Port = Int32.Parse(txtPort.Text); Configuration.WebMediaPortalHosting.EnableTLS = cbHTTPS.IsChecked.GetValueOrDefault(false); Configuration.WebMediaPortalHosting.PortTLS = Int32.Parse(txtHTTPSPort.Text); Configuration.WebMediaPortalHosting.Save(); // restart if (UacServiceHelper.IsAdmin()) { Task.Factory.StartNew(() => { try { var wsh = new WindowsServiceHandler("MPExtended WebMediaPortal"); wsh.Execute(ServiceCommand.Restart); } catch (Exception ex) { Log.Warn("Failed to restart WebMediaPortal hosting process", ex); } }); } else { UacServiceHelper.RunUacServiceHandler("/command:webmphosting /action:restart"); } }
public static void RestartService() { // restart the service if (!UacServiceHelper.IsAdmin()) { Log.Debug("Service: no admin rights, use UacServiceHandler"); UacServiceHelper.RestartService(); } else if (UacServiceHelper.IsAdmin()) { Log.Debug("Service: have admin rights, restart ourselves"); var handler = new WindowsServiceHandler(SERVICE_NAME); handler.Execute(ServiceCommand.Restart); } ShouldRestart = false; }