Exemple #1
0
        /// <summary>
        /// Deregisters specified popup menu.
        /// </summary>
        /// <param name="menu">Popup menu.</param>
        public static void DeregisterPopupMenu(PopupMenu menu)
        {
            DebugEx.VerboseFormat("PopupMenuAreaScript.DeregisterPopupMenu(menu = {0})", menu);

            if (sInstance != null)
            {
                if (sInstance.mPopupMenus.Remove(menu))
                {
                    if (sInstance.mPopupMenus.Count == 0)
                    {
                        sInstance.enabled        = false;
                        sInstance.mAutoPopupItem = null;
                        sInstance.mTimer.Stop();

                        EscapeButtonListenerScript.RemoveHandler(sInstance);
                    }
                }
                else
                {
                    DebugEx.Error("Failed to deregister popup menu");
                }
            }
            else
            {
                DebugEx.Error("There is no PopupMenuAreaScript instance");
            }
        }
        /// <summary>
        /// Handler for destroy event.
        /// </summary>
        protected override void OnDestroy()
        {
            base.OnDestroy();

            DebugEx.Verbose("MainWindowScript.OnDestroy()");

#if HANDLE_ESCAPE_BUTTON
            EscapeButtonListenerScript.RemoveHandler(this);
#endif

            if (Global.mainWindowScript == this)
            {
                Global.mainWindowScript = null;
            }
            else
            {
                DebugEx.Fatal("Unexpected behaviour in MainWindowScript.OnDestroy()");
            }
        }
        /// <summary>
        /// Handler for destroy event.
        /// </summary>
        protected override void OnDestroy()
        {
            base.OnDestroy();

            DebugEx.Verbose("AboutDialogScript.OnDestroy()");

            if (state != WindowState.FullScreen)
            {
                Save(WINDOW_KEY);
            }

            EscapeButtonListenerScript.RemoveHandler(this);
            Translator.RemoveLanguageChangedListener(OnLanguageChanged);

            if (Global.aboutDialogScript == this)
            {
                Global.aboutDialogScript = null;
            }
            else
            {
                DebugEx.Fatal("Unexpected behaviour in AboutDialogScript.OnDestroy()");
            }
        }