private void ClippyCanvas_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            Random rnd          = new Random();
            int    animationInt = rnd.Next(0, 38);

            ClippyAnimations animation = _clippyAnimations[animationInt];

            clippyItem.StartAnimation(animation);
        }
Exemple #2
0
        /// <summary>
        /// Start a specific animation
        /// </summary>
        /// <param name="animationType"></param>
        public void StartAnimation(ClippyAnimations animationType, bool byPassCurrentAnimation = false)
        {
            System.Windows.Application.Current.MainWindow.Dispatcher.Invoke(new Action(() =>
            {
                if (!IsAnimating || byPassCurrentAnimation)
                {
                    IsAnimating = true;

                    clippedImage.BeginAnimation(Canvas.LeftProperty, Animations[animationType.ToString()].Item1);
                    clippedImage.BeginAnimation(Canvas.TopProperty, Animations[animationType.ToString()].Item2);
                }
            }), DispatcherPriority.Send);
        }
Exemple #3
0
        private void cmdTestAnimation_Click(object sender, RoutedEventArgs e)
        {
            ClippyAnimations animation = (ClippyAnimations)Enum.Parse(typeof(ClippyAnimations), (sender as MenuItem).Header.ToString());

            _clippy.StartAnimation(animation, true);
        }
Exemple #4
0
 /// <summary>
 /// Start a specific animation
 /// </summary>
 /// <param name="animationType"></param>
 public void StartAnimation(ClippyAnimations animationType, bool byPassCurrentAnimation = false)
 {
     clippedImage.BeginAnimation(Canvas.LeftProperty, Animations[animationType.ToString()].Item1);
     clippedImage.BeginAnimation(Canvas.TopProperty, Animations[animationType.ToString()].Item2);
 }