public void BringToFront(string name) { if (!this.ActiveGUIs.Any(gui => gui.Name.Equals(name, StringComparison.OrdinalIgnoreCase))) { return; } GUIData toFront = this.ActiveGUIs.First(g => g.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); foreach (GUIData gui in this.ActiveGUIs) { if (toFront.Equals(gui) || gui.m_AlwaysOnTop) { continue; } //gui.ZIndex = gui.DefaultSortingOrder; } GUIData[] found = this.ActiveGUIs .Where(data => data.m_AlwaysOpen == false) .ToArray(); if (found.Any()) { //toFront.ZIndex = found.Max(data => data.DefaultSortingOrder) + 1; } }
public bool Add(GUIData gui) { this.Initialise(); if (this.GUIs.Contains(gui)) { return(false); } gui.GUIManager = this; //gui.Close(); this.SetupManagedComponents(gui); this.GUIs.Add(gui); return(true); }
public bool RemoveActiveGUI(string name) { if (this.ActiveGUIs.Any(data => data.Name.Equals(name, StringComparison.OrdinalIgnoreCase)) == false) { return(false); } GUIData toClose = this.ActiveGUIs.First(data => data.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); if (toClose.m_AlwaysOpen) { return(false); } toClose.Close(); return(this.ActiveGUIs.Remove(toClose)); }
public void CloseGUI(string activeName) { if (this.ActiveGUIs.Any(data => data.Name.Equals(activeName, StringComparison.OrdinalIgnoreCase)) == false) { return; } GUIData toClose = this.ActiveGUIs .First(gui => gui.Name.Equals(activeName, StringComparison.OrdinalIgnoreCase)); if (toClose.m_AlwaysOpen) { return; } toClose.Close(); this.ActiveGUIs.Remove(toClose); }
public GUIData OpenGUI(string name, bool bringToFront = false) { if (this.ActiveGUIs.Any(widget => widget.Name.Equals(name, StringComparison.OrdinalIgnoreCase))) { GUIData openGUI = this.ActiveGUIs.First(ui => ui.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); if (bringToFront) { this.BringToFront(openGUI.Name); } return(openGUI); } GUIData toOpen = this.GUIs.FirstOrDefault(gui => gui.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); if (toOpen is null) { return(null); } if (toOpen.m_ClosesOthers) { List <GUIData> activeCopy = new List <GUIData>(this.ActiveGUIs); foreach (GUIData widget in activeCopy) { this.CloseGUI(widget.Name); } } toOpen.Display(); this.ActiveGUIs.Add(toOpen); if (bringToFront) { this.BringToFront(toOpen.Name); } return(toOpen); }
public bool Destroy(string key) { GUIData gui = this.GUIs.FirstOrDefault(data => data.Name.Equals(key, StringComparison.OrdinalIgnoreCase)); return(!(gui is null) && this.GUIs.Remove(gui)); }