void btnReg_Click(object sender, RoutedEventArgs e) { wnd = new RegistryWnd(); wnd.Closing += wnd_Closing; wnd.ShowDialog(); }