Esempio n. 1
0
        public void Toggle()
        {
            if (isOpened)
            {
                currentMenuWindow.CloseWindow();
                return;
            }

            isOpened = true;
            currentMenuWindow.OpenWindow();
            this.IsOpenedChanged?.Invoke();
        }
        public static void RegisterMenuWindow(BaseUserControlWithWindow menuWindow)
        {
            currentMenuWindow?.CloseWindow();
            currentMenuWindow = menuWindow;

            menuWindow.EventWindowClosing += CloseHandler;
            menuWindow.EventWindowClosed  += CloseHandler;

            void CloseHandler()
            {
                menuWindow.EventWindowClosing -= CloseHandler;
                menuWindow.EventWindowClosed  -= CloseHandler;

                if (ReferenceEquals(currentMenuWindow, menuWindow))
                {
                    currentMenuWindow = null;
                    isOpened          = false;
                    MenuInstance.IsOpenedChanged?.Invoke();
                }
            }
        }
Esempio n. 3
0
 public static void TryCloseCurrentMenu()
 {
     currentMenuWindow?.CloseWindow();
 }