private void Rectangle_Mousedown(object sender, RoutedEventArgs e) { fCancelMapLoading = true; string name = Convert.ToString(e.Source.GetType().GetProperty("Name").GetValue(e.Source, null)); Console.WriteLine("Detected mouse event on " + name + "!"); using (TerrainWindow tw = new TerrainWindow(name)) { tw.Run(30.0, 60.0); } }