I have this click event in my main window to open a new window
private void Button_Click(object sender, RoutedEventArgs e)
{
cm = new CanalesMain();
cm.Show();
cm.Canales.setValues();
}
My cm variable is defined as a member class in my main window because I need to load/refresh the setValues() method every 5 minutes (there's a TimeSpan and a EventHandler for that)
The thing is, in my "refresh data" method I have this if statement to ask if the cm variable is loaded and is not null (I mean, if the window was ever opened or if is opened, ask if isn't closed)
if (cm!=null && cm.IsLoaded)
{
cm.Canales.setValues();
}
Is this the correct or best way to ask if my window is open?