Beispiel #1
0
        private static void launchApp()
        {
            var settings = ToastSettings.LoadDefault();
              _app = new ToastApp(settings);

              _app.Events.RestartRequested += onRestart;
              _app.Start();
        }
Beispiel #2
0
        private static void onRestart(object sender, EventArgs e)
        {
            // executes this code in a foreground thread to prevent the app from
              // terminating when _app.Stop() because this event *will* be invoked
              // from a background thread... thus calling _app.Stop() will results
              // in app termination
              var thread = new Thread(() =>
              {
            _app.Events.RestartRequested -= onRestart;
            _app.Stop();
            _app.Dispose();
            _app = null;

            launchApp();
              });

              thread.IsBackground = false;
              thread.Start();
        }