/// <summary> /// Handle the Key Event /// </summary> /// <param name="name"></param> void Instance_KeyPress(string name) { Debug.WriteLine("KeyPress " + name); if (name == "ClientInfo") { if (this.infoScreen == null) { #if !DEBUG // Make our window not topmost so that we can see the info screen if (!_screenSaver) { Topmost = false; } #endif this.infoScreen = new InfoScreen(); this.infoScreen.Closed += InfoScreen_Closed; this.infoScreen.Show(); } else { this.infoScreen.Close(); #if !DEBUG // Bring the window back to Topmost if we need to if (!_screenSaver) { Topmost = true; } #endif } } else if (name == "ScreenSaver") { Debug.WriteLine("Closing due to ScreenSaver key press"); if (!_screenSaver) { return; } System.Windows.Application.Current.Shutdown(); } }
/// <summary> /// InfoScreen Closed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InfoScreen_Closed(object sender, EventArgs e) { this.infoScreen.Closed -= InfoScreen_Closed; this.infoScreen = null; }