Example #1
0
        /// <summary>
        /// 销毁
        /// </summary>

        protected override void OnDestroy()
        {
            UnregisterReceiver(_screenReciever);
            ScreenReceiver.ScreenLocked = false;
            _orientationListener        = null;
            if (Game != null)
            {
                Game.Dispose();
            }
            Game = null;
            base.OnDestroy();
        }
Example #2
0
        /// <summary>
        /// OnCreate called when the activity is launched from cold or after the app
        /// has been killed due to a higher priority app needing the memory
        /// </summary>
        /// <param name="savedInstanceState"></param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            IntentFilter filter = new IntentFilter();

            filter.AddAction(Intent.ActionScreenOn);
            filter.AddAction(Intent.ActionScreenOff);
            filter.AddAction(Intent.ActionUserPresent);

            _screenReciever = new ScreenReceiver();
            RegisterReceiver(_screenReciever, filter);

            _orientationListener = new OrientationListener(this);
            Game.Activity        = this;
        }