예제 #1
0
        private void _primaryBtn_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            var acrossLimit = false;
            if (_mode == ManipulatingMode.Up)
            {
                var transform = _secondaryUpBtn.RenderTransform as CompositeTransform;
                acrossLimit = (transform.TranslateY > TRANSLATE_LIMIT && transform.TranslateY <= TRANSLATE_LIMIT / 4);

                var sb = MakeTranslateStory(_secondaryUpBtn, transform.TranslateY, acrossLimit ? TRANSLATE_LIMIT : 0, TimeSpan.FromSeconds(0.3), false);
                sb.Begin();

                if (transform.ScaleX < 1)
                {
                    var sb2 = MakeScaleStory(_secondaryUpBtn, transform.ScaleX, acrossLimit ? 1 : 0, TimeSpan.FromSeconds(0.3));
                    sb2.Completed += ((e1, e2) =>
                      {
                          //if (acrossLimit) _secondaryUpBtn_Click(null, null);
                      });
                    sb2.Begin();
                    if (acrossLimit) _secondaryUpBtn_Click(null, null);
                }
            }
            else if (_mode == ManipulatingMode.Left)
            {
                var transform = _secondaryLeftBtn.RenderTransform as CompositeTransform;
                acrossLimit = (transform.TranslateX > TRANSLATE_LIMIT && transform.TranslateX <= TRANSLATE_LIMIT / 4);

                var sb = MakeTranslateStory(_secondaryLeftBtn, transform.TranslateX, acrossLimit ? TRANSLATE_LIMIT : 0, TimeSpan.FromSeconds(0.3), true);
                sb.Begin();
                if (transform.ScaleX < 1)
                {
                    var sb2 = MakeScaleStory(_secondaryLeftBtn, transform.ScaleX, acrossLimit ? 1 : 0, TimeSpan.FromSeconds(0.3));
                    sb2.Completed += ((e1, e2) =>
                    {
                        
                    });
                    sb2.Begin();
                    if (acrossLimit) _secondaryLeftBtn_Click(null, null);
                }
            }
            var opacity = _maskBorder.Opacity;
            if (opacity < 1)
            {
                var sb1 = MakeOpacityStory(_maskBorder, opacity, acrossLimit ? 1 : 0, TimeSpan.FromSeconds(0.3));
                sb1.Begin();
            }
            _mode = ManipulatingMode.None;

        }
예제 #2
0
        private void _primaryBtn_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (_mode == ManipulatingMode.None)
            {
                if (e.Cumulative.Translation.Y < -10) _mode = ManipulatingMode.Up;
                else if (e.Cumulative.Translation.X < -10) _mode = ManipulatingMode.Left;
            }

            if (_mode == ManipulatingMode.Up)
            {
                var transform = _secondaryUpBtn.RenderTransform as CompositeTransform;
                var resultY = (transform.TranslateY + e.Delta.Translation.Y) * 1.02;
                if (resultY > TRANSLATE_LIMIT && resultY < 0) transform.TranslateY = resultY;

                HandleScale(transform, transform.TranslateY);
            }
            else if (_mode == ManipulatingMode.Left)
            {
                var transform = _secondaryLeftBtn.RenderTransform as CompositeTransform;
                var resultX = (transform.TranslateX + e.Delta.Translation.X) * 1.02;
                if (resultX > TRANSLATE_LIMIT && resultX < 0) transform.TranslateX = resultX;

                HandleScale(transform, transform.TranslateX);
            }
        }