Best way to track multiple windows in C# WinForms.
For instance, i have an ApplicationContext
thats used to manage my application and i have a method thats used to open new windows.
public void CreateWindow(RosterItem Roster)
{
//Check if it is already active, if so, Focus.
MessageWindow MessageWindow = new MessageWindow();
MessageWindow.SetContext(Roster);
MessageWindow.Initialize();
}
That being said, I need to check to see if the window is already open and if it is the make it focused, otherwise create a new window and Focus it.
Taking into consideration Cross Thread.
Q: What is the best way to accomplish this.