public static void Shutdown()
 {
     if (UpdateServer.IsRunning)
     {
         UpdateServer.Stop();
     }
     Singleton.AllowClose = true;
     Application.Current.Shutdown();
 }
 private void buttonStop_Click(object sender, RoutedEventArgs e)
 {
     UpdateServer.Stop();
 }
 void UpdateServer_Started(object sender, EventArgs e)
 {
     UpdateServer.Started -= UpdateServer_Started;
     UpdateServer.Stopped += new EventHandler(UpdateServer_Stopped);
     UpdateServer.Stop();
 }
 private void buttonRestart_Click(object sender, RoutedEventArgs e)
 {
     restartWhenStopped = true;
     UpdateServer.Stop();
 }