Esempio n. 1
0
 /// <summary>
 /// Disconnect from Theater, enabling ConnectToTheater to be called again.
 /// </summary>
 public static void DestroyTheaterCommunicator()
 {
     if (Theater != null)
     {
         Theater.Disconnect();
         Theater.Dispose();
         Theater = null;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Stop all services and dispose of them. This should be called once before the game
        /// exits. It can be called repeatedly to destroy re-created resources.
        /// </summary>
        public static void StopAllServices()
        {
            try
            {
                Game.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Game = null;
            }

            try
            {
                Resources.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Resources = null;
            }

            StateManager = null;
            try
            {
                Echelon.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Echelon = null;
            }

            try
            {
                Theater.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Theater = null;
            }

            try
            {
                AudioManager.Dispose();
            }
            catch (Exception) { }
            finally
            {
                AudioManager = null;
            }

            try
            {
                MP3Player.Dispose();
            }
            catch (Exception) { }
            finally
            {
                MP3Player = null;
            }

            try
            {
                Logger.Close();
            }
            catch (Exception) { }
            finally
            {
                Logger = null;
            }
        }