private void CloseUnusedWindows() { if (keyboardInputSetupScreen != null) { keyboardInputSetupScreen.Close(); keyboardInputSetupScreen = null; } if (mouseInputSetupScreen != null) { mouseInputSetupScreen.Close(); mouseInputSetupScreen = null; } }
public void ShowInputCreationScreen(object sender, RoutedEventArgs e) { Instruction obj = ((FrameworkElement)sender).DataContext as Instruction; CloseUnusedWindows(); if (obj.instructionType == InstructionType.KEYBOARD) { keyboardInputSetupScreen = new KeyboardInputSetup(obj, this); keyboardInputSetupScreen.Show(); } else { mouseInputSetupScreen = new MouseInputSetup(obj, this); mouseInputSetupScreen.Show(); } }