Beispiel #1
0
        public AnimatedButton()
        {
            IsHasGaze      = true;
            IsMouseEnabled = true;
            // Behaviors.SetIsGazeAware(this, true);
            // Behaviors.SetIsActivatable(this, true);
            // Behaviors.SetGazeAwareDelayTime(this, 200);
            // Behaviors.SetGazeAwareMode(this, Tobii.Interaction.Framework.GazeAwareMode.Normal);
            // Behaviors.SetIsTentativeFocusEnabled(this, true);

            Behaviors.SetIsGazeAware(this, true);
            Behaviors.AddHasGazeChangedHandler(this, OnHasGazeChanged);

            _progress = new CircularProgressBar()
            {
                StrokeThickness     = 5,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Visibility          = Visibility.Hidden
            };

            _animation            = new DoubleAnimation();
            _animation.From       = 0;
            _animation.To         = 100;
            _animation.Duration   = TimeSpan.FromSeconds(3);
            _animation.Completed += new EventHandler((sender, e) => {
                _progress.Visibility = Visibility.Hidden;
                OnClick();
            });
            Storyboard.SetTarget(_animation, _progress);
            Storyboard.SetTargetProperty(_animation, new PropertyPath(CircularProgressBar.PercentageProperty));

            _sb = new Storyboard();
            _sb.Children.Add(_animation);
        }