public override void Perform() { //There will be at most 5 Windows. And It can't remove the first Window. if (WindowList.Count > 5 || (IsRemove && WindowList.Count > 1)) { //The new Window already got created and shown. NewWindow.Close(); //Select removed Window from 1 to Count-1. RemoveIndex = RemoveIndex % (WindowList.Count - 1) + 1; Window removeWindow = WindowList[RemoveIndex]; //Close the window before removing it. removeWindow.Close(); WindowList.Remove(removeWindow); } else { WindowList.Add(NewWindow); } }
public void Close() { _window.Close(); }