public static void Back() { int lastIndex = getLastIndex(); if (lastIndex < 0) { // Error popping empty window stack DebugOnly.Print("ERROR: Window stack is empty!"); } else { // Remove last window from the stack windowStack.RemoveAt(lastIndex); // Show previous window if (lastIndex - 1 >= 0) { ManageableWindow manageable = windowStack[lastIndex - 1] as ManageableWindow; Glide.MainWindow = manageable.Window; notifyChanged(manageable); } else { DebugOnly.Print("ERROR: Window stack has only one element!"); } } }
private static void notifyChanged(ManageableWindow manageable) { if (WindowChanged != null) { WindowChanged(manageable.Id); } }
internal static void Push(ManageableWindow manageable) { int lastIndex = getLastIndex(); if (lastIndex >= 0) { ManageableWindow currentWindow = windowStack[lastIndex] as ManageableWindow; currentWindow.Window.TriggerCloseEvent(null); // If the current window is not persistent replace it if (!currentWindow.Persistent) { windowStack.RemoveAt(lastIndex); } } // Add window to stack windowStack.Add(manageable); // Show window Glide.MainWindow = manageable.Window; // Notify event notifyChanged(manageable); }