void win_Closed(object sender, EventArgs e) { Window win = sender as Window; if (win != null) { DMXCommander.Controls.DMXCommandControl dmx = win.Content as DMXCommander.Controls.DMXCommandControl; if (dmx != null) { dmx.Dispose(); } } }
private void EditDMX_Click(object sender, RoutedEventArgs e) { string DMXFile = System.IO.Path.Combine(Locations.ArtemisCopyPath, "dat", "DMXcommands.xml"); EditorWindow.Show(null, DMXFile); Window win = new Window(); win.Title = "DMX Commander"; try { DMXCommander.Controls.DMXCommandControl DMX = new DMXCommander.Controls.DMXCommandControl(); win.Closed += new EventHandler(win_Closed); DMX.LoadFile(DMXFile); win.Content = DMX; win.Show(); } catch { } }