Example #1
0
        private void onDragDelta(object sender, DragDeltaGestureEventArgs e)
        {
            if (disableTopLevelGesture || !isDraggingListBox)
            {
                return;
            }
            bool   flag1            = e.GetPosition((UIElement)this.listbox).Y > dragStartY;
            bool   flag2            = itemsPanel.ScrollOwner.VerticalOffset < 10.0 / 100;
            double verticalOffset   = itemsPanel.ScrollOwner.VerticalOffset;
            double scrollableHeight = itemsPanel.ScrollOwner.ScrollableHeight;

            if (!this.isAddingItemViaDragTop && flag2 && flag1)
            {
                Debug.WriteLine("drag");
                e.Handled = true;
                isAddingItemViaDragTop = true;
                //Debug.WriteLine("before: " + itemsPanel.Children.Count());
                App.Current.ListItems.StartNode.Add();
                //Debug.WriteLine("after: "+itemsPanel.Children.Count());
                //    enableAllChildrenGesture(false);
                //    newItem = this.addItem("new item");
                //    //newItem.setText("pull to add list");

                //    itemList.Remove(newItem);
                //    itemList.Insert(0, newItem);

                //    moveItemToIdxPosition(newItem, 0);
                //    TransformUtil.setScaleY((FrameworkElement)newItem, lastDraggedYDist);
                //    TransformUtil.setScaleX((FrameworkElement)newItem, 0.9);
                //    TransformUtil.setTranslateX((FrameworkElement)newItem, 20.0);
                //    //TransformUtil.setRotateX((FrameworkElement)this.newItem, -90.0);
                //    itemGrid.Height = (double)(itemGrid.Children.Count - 1) * itemHeight;
            }
            else
            {
                if (!isAddingItemViaDragTop || itemsPanel.Children.Count == 0)
                {
                    return;
                }
                e.Handled = true;
                //Debug.WriteLine("another: " + itemsPanel.Children.Count());
                //Debug.WriteLine("lastDraggedYDist:{0} VerticalChange:{1}", lastDraggedYDist, e.VerticalChange);
                double num1 = Math.Min((lastDraggedYDist + e.VerticalChange) / itemHeight, 1.0);
                //    //Debug.WriteLine(num1);
                lastDraggedYDist += e.VerticalChange;
                TransformUtil.setScaleY((FrameworkElement)itemsPanel.Children[0], num1);
                TransformUtil.setScaleX((FrameworkElement)itemsPanel.Children[0], 0.9 + num1 / 10);
                TransformUtil.setTranslateX((FrameworkElement)itemsPanel.Children[0], 20.0 - (num1 * 20));
                //TransformUtil.setRotateX((FrameworkElement)this.newItem, num1 * 90.0 - 90.0);

                //    double num2 = TransformUtil.getScaleY((FrameworkElement)newItem) * itemHeight;
                //    itemGrid.Height = Math.Max((double)(itemGrid.Children.Count - 1) * itemHeight + num2, 0.0);

                //    for (int index = indexOfItem(newItem) + 1; index < itemList.Count; ++index)
                //        TransformUtil.setTranslateY((FrameworkElement)itemList[index], idxToPosition(index - 1) + num2);
            }
        }
Example #2
0
        private void GestureListener_DragDelta(object sender, DragDeltaGestureEventArgs e)
        {
            var position = e.GetPosition(this.DateViewOnPage);

            if (position.X > 0 && position.Y > 0 &&
                position.X < this.DateViewOnPage.ActualWidth &&
                position.Y < this.DateViewOnPage.ActualHeight &&
                App.ViewModelData.SelectedDateData != null &&
                App.ViewModelData.SelectedDateData.Entries.Count > 1)
            {
                return;
            }

            if (e.Direction == System.Windows.Controls.Orientation.Horizontal && e.HorizontalChange > 0)
            {
                double offset = _contentPanel.GetHorizontalOffset().Value + e.HorizontalChange;
                if (offset > Constant.DISTANCE_DRAG_DELTA_2_OPEN && !_isMenuOpen)
                {
                    OpenSettings();
                }
                else if (offset > Constant.DISTANCE_DRAG_DELTA_2_OPEN && _isMenuOpen)
                {
                }
                else
                {
                    _contentPanel.SetHorizontalOffset(offset);
                }
            }
            else if (e.Direction == System.Windows.Controls.Orientation.Horizontal && e.HorizontalChange < 0)
            {
                double offset = _contentPanel.GetHorizontalOffset().Value + e.HorizontalChange;
                if (offset < Constant.DISTANCE_DRAG_DELTA_2_CLOSE && _isMenuOpen)
                {
                    CloseSettings();
                }
                else if (offset < Constant.DISTANCE_DRAG_DELTA_2_CLOSE && !_isMenuOpen)
                {
                }
                else
                {
                    _contentPanel.SetHorizontalOffset(offset);
                }
            }
        }
Example #3
0
        private void onDragDelta(object sender, DragDeltaGestureEventArgs e)
        {
            if (_disableTopLevelGesture || !_isDraggingListBox)
            {
                return;
            }
            bool   flag1            = e.GetPosition(listbox).Y > _dragStartY;
            bool   flag2            = _scrollViewer.VerticalOffset < 10.0 / itemGrid.Height;
            double verticalOffset   = _scrollViewer.VerticalOffset;
            double scrollableHeight = _scrollViewer.ScrollableHeight;

            if (!_isAddingItemViaDragTop && flag2 && flag1)
            {
                e.Handled = true;
                _isAddingItemViaDragTop = true;
                EnableAllChildrenGesture(false);
                _newItem = AddItem("new item");

                TransformUtil.setScaleX(_newItem, 0.9);
                TransformUtil.setTranslateX(_newItem, 20.0);
            }
            else
            {
                if (!_isAddingItemViaDragTop)
                {
                    return;
                }
                e.Handled = true;

                double num1 = Math.Min((_lastDraggedYDist + e.VerticalChange) / _itemHeight, 1.0);

                _lastDraggedYDist += e.VerticalChange;
                TransformUtil.SetScaleY(_newItem, num1);
                TransformUtil.setScaleX(_newItem, 0.9 + num1 / 10);
                TransformUtil.setTranslateX(_newItem, 20.0 - (num1 * 20));

                UpdateItemGrid(0);
            }
        }