/// <summary> /// 事件:键盘即将按下按钮 /// </summary> private void window_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.SystemKey == Key.LeftAlt || e.SystemKey == Key.RightAlt) { MainWindow.altDown = true; } else if (e.SystemKey == Key.F4 && MainWindow.altDown) { this.world.GetMainRender().Shutdown(); } else if (e.SystemKey == Key.Enter && MainWindow.altDown && this.IsKeyAltWindowSizeEnabled) { if (Director.IsFullScreen) { Director.IsFullScreen = !Director.IsFullScreen; this.WindowScreenTransform(); } else { Director.IsFullScreen = !Director.IsFullScreen; this.FullScreenTransform(); } } SemaphoreDispatcher.Activate($"System_Key_{e.Key}"); }
/// <summary> /// 提供精灵按钮鼠标移入时的处理函数 /// </summary> /// <param name="sender">触发者</param> /// <param name="e">鼠标参数</param> public void MouseEnterHandler(object sender, MouseEventArgs e) { if (this.Enable) { this.IsMouseOver = true; SemaphoreDispatcher.Activate($"System_Button_Over_{this.Id}"); if (this.DisplayBinding != null && this.ImageMouseOver != null) { BitmapImage myBitmapImage = this.ImageMouseOver.SpriteBitmapImage; //this.ImageNormal.DisplayBinding = null; //this.ImageMouseOn.DisplayBinding = null; //this.ImageMouseOver.DisplayBinding = this.DisplayBinding; this.DisplayBinding.Width = myBitmapImage.PixelWidth; this.DisplayBinding.Height = myBitmapImage.PixelHeight; this.DisplayBinding.Source = myBitmapImage; } } }
/// <summary> /// 事件:窗体关闭 /// </summary> private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (!ViewPageManager.IsAtMainStage()) { SplashPage.LoadingExitFlag = true; Director.CollapseWorld(); return; } if (SemaphoreDispatcher.CountBinding("System_PreviewShutdown") > 0) { e.Cancel = true; SemaphoreDispatcher.Activate("System_PreviewShutdown"); } else { Director.CollapseWorld(); } }