コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: kewinj/BoxesInBoxes
        private void OnMouseWheel(object sender, MouseWheelEventArgs e)
        {
            double deltaZoom = e.Delta / 600d;

            _zoom += deltaZoom;
            if (_zoom <= 0.1)
            {
                _zoom = 0.1;
            }
            if (_zoom > 50)
            {
                _zoom = 50;
            }

            ZoomAnimationX.To       = _zoom;
            ZoomAnimationY.To       = _zoom;
            ZoomCenterAnimationX.To = Corkboard.Width / 2;
            ZoomCenterAnimationY.To = Corkboard.Height / 2;
            ZoomStoryboard.Begin();
        }
コード例 #2
0
 /// <summary>
 /// Handles the PropertyChanged event of the Cell control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
 private void Cell_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "State" &&
         !PreferencesManager.Instance.RenderPreferences.DisableAnimation &&
         ActionQueue.Count < AnimationQueueLimit &&
         Cell.State != ECellState.Free)
     {
         // Animate state changes
         Opacity = 0;
         ActionQueue.Enqueue(() =>
         {
             UpdateBrushes();
             OpacityStoryboard.Begin();
             ZoomStoryboard.Begin();
         });
     }
     else
     {
         // Simple render update
         UpdateBrushes();
     }
 }