Ejemplo n.º 1
0
 private void OnBatchCompleted(object sender, CompositionBatchCompletedEventArgs args)
 {
     _visual.Dispose();
     _brush.Dispose();
     _visual = null;
     _brush  = null;
 }
Ejemplo n.º 2
0
        private void Batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            // Start the second part of the animations

            // Get offset/size of new active scenario button
            var activeScenarioNum = _scenarios.IndexOf(_currentScenario);
            var buttonWidth       = (float)ProgressIndicatorStackPanel.Children[activeScenarioNum].RenderSize.Width;
            var buttonOffset      = ProgressIndicatorStackPanel.Children[activeScenarioNum].GetOffset(ProgressIndicatorStackPanel);
            var offsetDeltaX      = Math.Abs(buttonOffset.X - _activeScenarioVisualIndicator.Offset.X);

            CompositionAnimationGroup animationGroup = _compositor.CreateAnimationGroup();

            // Animate line size
            ScalarKeyFrameAnimation sizeShrinkAnimation = _compositor.CreateScalarKeyFrameAnimation();

            sizeShrinkAnimation.Duration = ConfigurationConstants.NavAnimationDuration;
            sizeShrinkAnimation.InsertKeyFrame(0.0f, _activeScenarioVisualIndicator.Size.X);
            sizeShrinkAnimation.InsertKeyFrame(1.0f, buttonWidth);
            sizeShrinkAnimation.Target = "Size.X";
            animationGroup.Add(sizeShrinkAnimation);

            if (buttonOffset.X > _activeScenarioVisualIndicator.Offset.X)
            {
                // Animate line to new offset
                ScalarKeyFrameAnimation offsetAnimation = _compositor.CreateScalarKeyFrameAnimation();
                offsetAnimation.InsertKeyFrame(0.0f, _activeScenarioVisualIndicator.Offset.X);
                offsetAnimation.InsertKeyFrame(1.0f, buttonOffset.X);
                offsetAnimation.Duration = ConfigurationConstants.NavAnimationDuration;
                offsetAnimation.Target   = "Offset.X";
                animationGroup.Add(offsetAnimation);
            }

            _activeScenarioVisualIndicator.StartAnimationGroup(animationGroup);
        }
Ejemplo n.º 3
0
        private void FlipBatchAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            _animationActive = false;

            if (_secondButton == null)
            {
                return;
            }

            if (_secondButton.Tag.ToString() != _firstButton.Tag.ToString())
            {
                GazeInput.SetInteraction(buttonMatrix, Interaction.Disabled);
                _flashTimer.Start();
            }
            else
            {
                //Do Match confirmation animation

                PulseButton(_firstButton);
                PulseButton(_secondButton);


                _firstButton  = null;
                _secondButton = null;
                _remaining   -= 2;

                CheckGameCompletion();
            }
        }
Ejemplo n.º 4
0
        private void ScopeBatch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            // Scope batch completion event has fired, hide the destination sprite and cleanup the batch
            _destinationSprite.IsVisible = false;

            CleanupScopeBatch();
        }
Ejemplo n.º 5
0
        private void FirstslideBatchAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            string[] parms = (sender as CompositionScopedBatch).Comment.Split(',');

            int  start     = int.Parse(parms[0]);
            int  end       = int.Parse(parms[1]);
            int  delta     = int.Parse(parms[2]);
            int  increment = int.Parse(parms[3]);
            bool change    = bool.Parse(parms[4]);

            var compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content).Compositor;

            _addAdjacentBatchAnimation            = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
            _addAdjacentBatchAnimation.Completed += AddAdjacentBatchAnimation_Completed;
            _addAdjacentBatchAnimation.Comment    = start + "," + end + "," + delta + "," + increment;

            for (int i = 0; i < _boardSize; i++)
            {
                change = AddAdjacent(start, end, delta) || change;
                start += increment;
                end   += increment;
            }

            _addAdjacentBatchAnimation.Comment = _addAdjacentBatchAnimation.Comment + "," + change;
            _addAdjacentBatchAnimation.End();

            if (change)
            {
                OnPropertyChanged("Score");
            }
        }
Ejemplo n.º 6
0
        /// <summary>

        /// Cleans up after the slide animation has ended

        /// </summary>

        private void SlideAnimationCompleted(object sender, CompositionBatchCompletedEventArgs args)

        {
            if (!firstRun)

            {
                foreach (var childVisual in _containerForVisuals.Children)

                {
                    _containerForVisuals.Children.Remove(childVisual);

                    break; // we only need to remove the first child
                }
            }

            else

            {
                firstRun = false;
            }



            // notify interested parties

            ColorSlideTransitionCompleted(this, EventArgs.Empty);
        }
        private void ScopeBatch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            _animationCompleted = true;
            Complete(false);

            CleanupScopeBatch();
        }
Ejemplo n.º 8
0
 private void ReverseFlipBatchAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
 {
     _firstButton.Content    = null;
     _secondButton.Content   = null;
     _firstButton            = null;
     _secondButton           = null;
     _reverseAnimationActive = false;
 }
 private void EndCrossFade(object sender, CompositionBatchCompletedEventArgs args)
 {
     // If the sprite is still valid, remove the loading sprite from the children collection
     if (_sprite != null && _sprite.Children.Count > 0)
     {
         _sprite.Children.RemoveAll();
     }
 }
Ejemplo n.º 10
0
        private void OnAnimationCompleted(object sender, CompositionBatchCompletedEventArgs args)
        {
            ResetElementAnimationProperties(_prevIndicator, 0);
            ResetElementAnimationProperties(_nextIndicator, 1);

            _prevIndicator = null;
            _nextIndicator = null;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Cleans up after the bloom animation has ended
        /// </summary>
        private void BloomAnimationCompleted(object sender, CompositionBatchCompletedEventArgs args)
        {
            // reset the container for subsequent use
            _containerForVisuals.Children.RemoveAll();

            // notify interested parties
            ColorBloomTransitionCompleted(this, EventArgs.Empty);
        }
Ejemplo n.º 12
0
        private void Animation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            IsFlipped = !IsFlipped;

            // we want the CaptionTile invisible once flipped over
            if (IsFlipped)
            {
                CaptionTile.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
        }
Ejemplo n.º 13
0
        private void Animation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            IsFlipped = !IsFlipped;

            // we want the CaptionTile invisible once flipped over
            if(IsFlipped)
                CaptionTile.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

            
        }
Ejemplo n.º 14
0
        private void ScopedBatch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            CompositionScopedBatch batch = sender as CompositionScopedBatch;

            Action action = _dictionary[batch.Comment];

            _dictionary.Remove(batch.Comment);

            action();
        }
        private void Transition_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            //
            // Previous transition is now completed, so start a new transition.
            //

            _transitionPlaying = TransitionKind.None;

            NextTransition();
        }
Ejemplo n.º 16
0
 private void SlideBatchAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
 {
     CheckCompletionAsync();
     if (!_gameOver)
     {
         _animationActive = false;
         GazeInput.SetInteraction(GameGrid, Interaction.Enabled);
         GazeInput.DwellFeedbackProgressBrush = new SolidColorBrush(Colors.White);
     }
 }
Ejemplo n.º 17
0
        private void Batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            // Now that the animations are complete, dispose of the custom Splash Screen visuals
            ElementCompositionPreview.SetElementChildVisual(this, null);

            if (_splashSurface != null)
            {
                _splashSurface.Dispose();
                _splashSurface = null;
            }
        }
Ejemplo n.º 18
0
        private void Batch_CrossFadeCompleted(object sender, CompositionBatchCompletedEventArgs args)
        {
            BackgroundImage.Brush = BackgroundImage.SurfaceBrush;

            // Dispose the image
            ((CompositionDrawingSurface)_previousSurfaceBrush.Surface).Dispose();
            _previousSurfaceBrush.Surface = null;

            // Clear out the batch
            _crossFadeBatch = null;
        }
Ejemplo n.º 19
0
        private void ExitAnimBatch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            CompositionScopedBatch sourceBatch = sender as CompositionScopedBatch;
            DeviceContainer        container   = _containers.FirstOrDefault((a) => a.AnimBatch == sourceBatch);

            if (container == null)
            {
                throw new Exception("Exit scoped batch completed for unknown container");
            }

            RemoveContainer(container);
        }
Ejemplo n.º 20
0
        private void ResetBatchAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            List <Button> listButtons = GetButtonList();

            for (int i = 0; i < _boardRows * _boardColumns; i += 2)
            {
                listButtons[i].Content     = null;
                listButtons[i + 1].Content = null;
            }
            ApplyPerspective();
            AdjustFontSizes();
        }
Ejemplo n.º 21
0
        private void EnterAnimBatch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            CompositionScopedBatch sourceBatch = sender as CompositionScopedBatch;
            DeviceContainer        container   = _containers.FirstOrDefault((a) => a.AnimBatch == sourceBatch);

            if (container == null)
            {
                throw new Exception("Enter scoped batch completed for unknown container");
            }

            container.DeviceElement.SetValue(Canvas.ZIndexProperty, 101);

            container.State = ContainerState.Normal;
        }
Ejemplo n.º 22
0
        private void RotationAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            Debug.Assert(_rotateAnimating);
            _rotateAnimating = false;

#if false
            Debug.Assert(_desiredRotationInDegrees - _frame.RotationAngleInDegrees < 0.001f,
                         "Ensure within epsilon of expected value");
#else
            var angleInDegrees = _frame.RotationAngle * 360.0f / TWO_PI;
            Debug.Assert(_desiredRotationInDegrees - angleInDegrees < 0.001f,
                         "Ensure within epsilon of expected value");
#endif

            StartNewRotationAnimation();
        }
        private void FlipBatchAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            _animationActive = false;

            if (_secondButton == null)
            {
                return;
            }

            if (_secondButton.Tag.ToString() != _firstButton.Tag.ToString())
            {
                GazeInput.SetInteraction(buttonMatrix, Interaction.Disabled);
                _flashTimer.Start();
            }
            else
            {
                //Do Match confirmation animation

                //Flip button visual
                var btn1Visual  = ElementCompositionPreview.GetElementVisual(_firstButton);
                var btn2Visual  = ElementCompositionPreview.GetElementVisual(_secondButton);
                var compositor  = btn1Visual.Compositor;
                var springSpeed = 50;

                GazeInput.SetInteraction(_firstButton, Interaction.Disabled);
                GazeInput.SetInteraction(_secondButton, Interaction.Disabled);

                btn1Visual.CenterPoint = new System.Numerics.Vector3((float)_firstButton.ActualWidth / 2, (float)_firstButton.ActualHeight / 2, 0f);
                btn2Visual.CenterPoint = new System.Numerics.Vector3((float)_secondButton.ActualWidth / 2, (float)_secondButton.ActualHeight / 2, 0f);

                var scaleAnimation = compositor.CreateSpringVector3Animation();
                scaleAnimation.InitialValue = new System.Numerics.Vector3(0.9f, 0.9f, 0f);
                scaleAnimation.FinalValue   = new System.Numerics.Vector3(1.0f, 1.0f, 0f);

                scaleAnimation.DampingRatio = 0.4f;
                scaleAnimation.Period       = TimeSpan.FromMilliseconds(springSpeed);

                btn1Visual.StartAnimation(nameof(btn1Visual.Scale), scaleAnimation);
                btn2Visual.StartAnimation(nameof(btn2Visual.Scale), scaleAnimation);

                _firstButton  = null;
                _secondButton = null;
                _remaining   -= 2;

                CheckGameCompletion();
            }
        }
Ejemplo n.º 24
0
        private async void _batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            int crumbNum = int.Parse((sender as CompositionScopedBatch).Comment);

            _animationIsRunning = false;

            if ((_curRow == _numRows - 1) && (_curCol == _numCols - 1))
            {
                string message;
                string congratsMessage = "";

                //_mazeRunnerVisual.Opacity = 0;

                _isMazeSolved = true;
                //_curButton.Content = _mazeComplete;

                HideMazeRunnerVisual(crumbNum);

                await Task.Delay(500 + (500 * crumbNum));

                if (_usedSolver)
                {
                    message = $"With a little help you have solved the maze!";
                }
                else
                {
                    congratsMessage = "Congratualtions!!";
                    message         = $"You have solved the maze!";
                }
                GazeInput.DwellFeedbackProgressBrush = _borderBrush;

                DialogText.Text   = message;
                CongratsText.Text = congratsMessage;

                if (_numRows >= 6)
                {
                    BoardSizeText.Text = _numRows.ToString();
                    IncreaseBoardSizePanel.Visibility = Visibility.Visible;
                }
                else
                {
                    IncreaseBoardSizePanel.Visibility = Visibility.Collapsed;
                }

                DialogGrid.Visibility = Visibility.Visible;
            }
        }
Ejemplo n.º 25
0
        private void Batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            // 1. Remove event handler from storyboard
            CompositionScopedBatch target = sender as CompositionScopedBatch;

            if (target != null)
            {
                target.Completed -= Batch_Completed;
                target.Dispose();

                _currentGroup?.Dispose();

                // 1.1 If this is the most recent storyboard, allow us to interact with content
                if (target == _currentBatch)
                {
                    RestoreContentPresenterInteractivity(_newPresenter);
                    _newPresenter.IsHitTestVisible = true;
                }
            }
            else
            {
                // if no target, we've manually called this. Make it work.
                _newPresenter.IsHitTestVisible = true;
                RestoreContentPresenterInteractivity(_newPresenter);
            }

            _currentBatch = null;
            _currentGroup = null;

            // Remove the "old" content (i.e. the thing we've animated out) from the VisualTree
            ContentPresenter presenter;

            lock (_presenters)
                presenter = _presenters.Dequeue();

            _clientArea.Children.Remove(presenter);
            presenter.Content = null;
            if (presenter == _oldPresenter)
            {
                _oldPresenter = null;
            }

            presenter = null;
        }
Ejemplo n.º 26
0
        private void SlideBatchAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            string[] parms = (sender as CompositionScopedBatch).Comment.Split(',');

            bool change = bool.Parse(parms[0]);
            bool wasNewTileGenerated = false;

            if (change)
            {
                wasNewTileGenerated = GenerateNextTile();
            }

            if ((!wasNewTileGenerated) && IsBoardFull())
            {
                GameOver = true;
                OnPropertyChanged("GameOver");
            }

            _busyAnimating = false;
        }
Ejemplo n.º 27
0
        private void AddAdjacentBatchAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            string[] parms = (sender as CompositionScopedBatch).Comment.Split(',');

            int  start     = int.Parse(parms[0]);
            int  end       = int.Parse(parms[1]);
            int  delta     = int.Parse(parms[2]);
            int  increment = int.Parse(parms[3]);
            bool change    = bool.Parse(parms[4]);

            for (int i = 0; i < _boardSize; i++)
            {
                change = SlideRowOrCol(start, end, delta) || change;
                start += increment;
                end   += increment;
            }

            _slideBatchAnimation.Comment = change.ToString();
            _slideBatchAnimation.End();

            var frame    = (Frame)Window.Current.Content;
            var mainPage = (MainPage)frame.Content;
        }
        private void ScopeBatch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            _animationCompleted = true;
            Complete(false);

            CleanupScopeBatch();
        }
        private void Batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            _batch.Completed -= Batch_Completed;

            SetHoursAndMinutes();
        }
Ejemplo n.º 30
0
 private void Batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
 {
     _compositionCompleted = true;
     _batch.Completed     -= Batch_Completed;
     HandleCompleted();
 }
Ejemplo n.º 31
0
 private void Batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
 {
     // Now that the animations are complete, dispose of the custom Splash Screen visuals
     ElementCompositionPreview.SetElementChildVisual(this, null);
 }
        private void Batch_CrossFadeCompleted(object sender, CompositionBatchCompletedEventArgs args)
        {
            BackgroundImage.Brush = BackgroundImage.SurfaceBrush;

            // Dispose the image
            ((CompositionDrawingSurface)_previousSurfaceBrush.Surface).Dispose();
            _previousSurfaceBrush.Surface = null;

            // Clear out the batch
            _crossFadeBatch = null;
        }
 /// <summary>
 /// Called when all animations in the scoped batch are completed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The <see cref="Windows.UI.Composition.CompositionBatchCompletedEventArgs" /> instance containing the event data.</param>
 private static void Batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
 {
     // Now that the animations are complete, dispose of the custom Splash Screen visuals
     ElementCompositionPreview.SetElementChildVisual(currentPage, null);
 }
        private void ScopeBatch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            // Scope batch completion event has fired, hide the destination sprite and cleanup the batch
            _destinationSprite.IsVisible = false;

            CleanupScopeBatch();
        }
Ejemplo n.º 35
0
 private void _animationBatch_Completed(object sender, CompositionBatchCompletedEventArgs args)
 {
     Completed?.Invoke(this, new EventArgs());
 }
Ejemplo n.º 36
0
 private void EndCrossFade(object sender, CompositionBatchCompletedEventArgs args)
 {
     // If the sprite is still valid, remove the loading sprite from the children collection
     if (_sprite != null && _sprite.Children.Count > 0)
     {
         _sprite.Children.RemoveAll();
     }
 }
        /// <summary>
        /// Cleans up after the slide animation has ended
        /// </summary>
        private void SlideAnimationCompleted(object sender, CompositionBatchCompletedEventArgs args)
        {
            if (!firstRun)
            {
                foreach (var childVisual in _containerForVisuals.Children)
                {
                    _containerForVisuals.Children.Remove(childVisual);
                    break; // we only need to remove the first child
                }
            }
            else
            {
                firstRun = false;
            }

            // notify interested parties
            ColorSlideTransitionCompleted(this, EventArgs.Empty);
        }
        private void Batch_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            _batch.Completed -= Batch_Completed;

            SetHoursAndMinutes();
        }
Ejemplo n.º 39
0
 private void Foreground_BatchCompleted(object sender, CompositionBatchCompletedEventArgs args)
 {
     ForegroundToggle.IsEnabled = true;
 }
Ejemplo n.º 40
0
        private void Transition_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            //
            // Previous transition is now completed, so start a new transition.
            //

            _transitionPlaying = TransitionKind.None;

            NextTransition();
        }
Ejemplo n.º 41
0
        private void RotationAnimation_Completed(object sender, CompositionBatchCompletedEventArgs args)
        {
            Debug.Assert(_rotateAnimating);
            _rotateAnimating = false;

#if false
            Debug.Assert(_desiredRotationInDegrees - _frame.RotationAngleInDegrees < 0.001f,
                "Ensure within epsilon of expected value");
#else
            var angleInDegrees = _frame.RotationAngle * 360.0f / TWO_PI;
            Debug.Assert(_desiredRotationInDegrees - angleInDegrees < 0.001f,
                "Ensure within epsilon of expected value");
#endif

            StartNewRotationAnimation();
        }
Ejemplo n.º 42
0
 private void Foreground_BatchCompleted(object sender, CompositionBatchCompletedEventArgs args)
 {
     ForegroundToggle.IsEnabled = true;
 }
Ejemplo n.º 43
0
 // Defines what happens when a batch is completed
 public void OnBatchCompleted(object sender, CompositionBatchCompletedEventArgs args)
 {
     _target2.IsVisible = true;
 }