Example #1
0
        public async void OnDragCompleted(IDrop target)
        {
            if (target == CurrentDropBox)
            {
                onswap = false;
            }
            if (TargetType != target.GetType())
            {
                return;
            }

            Constants.CurrentCategoryOrder.Remove(int.Parse(this.ClassId));
            Constants.CurrentCategoryOrder.Insert(target.position, int.Parse(this.ClassId));

            if (target.DraggableChildren.Count > 0 && onswap)
            {
                target.DraggableChildren[0].OnDragCompleted(CurrentDropBox);
                CurrentDropBox.OnDraggableDropped(target.DraggableChildren[0]);
                target.DraggableChildren[0].CurrentDropBox = CurrentDropBox;
                onswap = false;
            }
            CurrentTarget  = target;
            CurrentDropBox = target;
            this.Scale     = 1;
            this.Opacity   = 1;

            FontSize = 10;

            var view = target as View;

            if (view != null)
            {
                var bounds = view.Bounds;
                await this.LayoutTo(bounds, 0, Easing.CubicIn);

                CurrentBounds = bounds;
                //System.Diagnostics.Debug.WriteLine("{0} current bounds: {1}", Text, CurrentBounds);
            }
            Status     = DragState.Completed;
            TapEnabled = false;

            if (DraggedCommand != null && DraggedCommand.CanExecute(new string[] { ((DropBox)target).Date.ToString("D"), WorkoutId.ToString() }))
            {
                DraggedCommand.Execute(new string[] { ((DropBox)target).Date.ToString("d"), WorkoutId.ToString() });
            }
        }
Example #2
0
        public async void OnDragAborted()
        {
            onswap       = false;
            Status       = DragState.Aborted;
            this.Scale   = 1;
            this.Opacity = 1;
            FontSize     = 14;
            await this.LayoutTo(CurrentBounds, 100, Easing.CubicIn);

            OnDragCompleted(CurrentTarget);

            if (DraggedCommand != null && DraggedCommand.CanExecute(new string[] { "-", WorkoutId.ToString() }))
            {
                DraggedCommand.Execute(new string[] { "-", WorkoutId.ToString() });
            }

            TapEnabled = true;
        }