Пример #1
0
        private void Grid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            e.Handled = true;

            var x = _rootVisual.Offset.X;

            _rootVisual.Offset = new Vector3((float)(x + e.Delta.Translation.X), 0f, 0f);

            //完成待办事项
            if (_rootVisual.Offset.X > 0)
            {
                if (_isToBeDeleted)
                {
                    return;
                }
                if (_rootVisual.Offset.X > 100)
                {
                    if (!_isToBeDone)
                    {
                        ShowGreenStory.Begin();
                        _isToBeDone    = true;
                        _isToBeDeleted = false;
                    }
                }
            }
            //删除待办事项
            else
            {
                if (_isToBeDone)
                {
                    return;
                }
                if (_rootVisual.Offset.X < -100)
                {
                    if (!_isToBeDeleted)
                    {
                        ShowRedStory.Begin();
                        _isToBeDone    = false;
                        _isToBeDeleted = true;
                    }
                }
            }
        }
Пример #2
0
 private void Grid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     //完成待办事项
     if (e.Delta.Translation.X > 0)
     {
         _tranTemplete.X += e.Delta.Translation.X;
         if (_isInDeleteMode)
         {
             return;
         }
         if (_tranTemplete.X > 100)
         {
             if (!_isToBeDone)
             {
                 ShowGreenStory.Begin();
                 _isToBeDone     = true;
                 _isInDeleteMode = false;
             }
         }
     }
     //删除待办事项
     else
     {
         _tranTemplete.X += e.Delta.Translation.X;
         if (_isToBeDone)
         {
             return;
         }
         if (_tranTemplete.X < -100)
         {
             if (!_isInDeleteMode)
             {
                 ShowRedStory.Begin();
                 _isToBeDone     = false;
                 _isInDeleteMode = true;
             }
         }
     }
 }