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(); } } }
public static void TryCloseCurrentMenu() { currentMenuWindow?.CloseWindow(); }