Пример #1
0
        protected override void OnExiting(object sender, EventArgs args)
        {
            // Beim Beenden der Applikation ggf. offene Client/Server-Verbindungen schließen.
            Client.Close();
            Server.CloseServer();

            // Settings speichern
            Settings.SaveSettings(Settings);

            base.OnExiting(sender, args);
        }
Пример #2
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private void OnSuspending(object sender, SuspendingEventArgs e)
        {
            if (Game != null)
            {
                Settings.SaveSettings(Game.Settings);
            }

            var deferral = e.SuspendingOperation.GetDeferral();

            //TODO: Save application state and stop any background activity
            deferral.Complete();
        }