예제 #1
0
        private void RunSwipe(PanUpdatedEventArgs e)
        {
            if (this.parentLayout.Padding.Top == this.MarginTop && DateTime.Now.Subtract(this.start).TotalSeconds > 1)
            {
                this.operation = PanOperation.Move;
            }

            if (this.AllowedOperation == PanOperation.Delete && this.parentLayout.Padding.Left <= this.MarginLeft + e.TotalX)
            {
                StoreFactory.HalProxy.RunOnUiThread(() => SetPadding(this, e.TotalX, 0));

                Debug.WriteLine("new padding1 " + this.parentLayout.Padding.Left);
            }
            else if (this.AllowedOperation == PanOperation.Move && this.parentLayout.Padding.Top <= this.MarginTop + e.TotalY)
            {
                Debug.WriteLine("new padding2 " + this.parentLayout.Padding.ToString());
                StoreFactory.HalProxy.RunOnUiThread(() => SetPadding(this, 0, e.TotalY));
            }
            else if (this.AllowedOperation == PanOperation.All && (this.parentLayout.Padding.Left <= this.MarginLeft + e.TotalX || this.parentLayout.Padding.Top <= this.MarginTop + e.TotalY))
            {
                Debug.WriteLine("new padding3 " + this.parentLayout.Padding.ToString());
                StoreFactory.HalProxy.RunOnUiThread(() => SetPadding(this, e.TotalX, e.TotalY));
            }

            Debug.WriteLine("Left margin = " + this.parentLayout.Padding.Left);
        }
예제 #2
0
        private void CancelDelete(PanUpdatedEventArgs e)
        {
            Debug.WriteLine("Cancelling delete");

            Debug.WriteLine("Restore color and margin to " + this.MarginLeft + " component : " + this.view.GetType().ToString());
            this.RestoreUi();
            this.operation = PanOperation.None;
        }
예제 #3
0
 public void RaisePanFinished(PanOperation oper, EventArgs e)
 {
     if (oper == PanOperation.Delete)
     {
         StoreFactory.HalProxy.RunOnUiThread(() => this.OnDeleteFinished?.Invoke(this.Line, null));
     }
     else
     {
         StoreFactory.HalProxy.RunOnUiThread(() => this.OnMoveFinished?.Invoke(this.Line, e));
     }
 }
예제 #4
0
        private void StartSwipe(PanUpdatedEventArgs e)
        {
            this.HandleTap(false);
            this.start     = DateTime.Now;
            this.operation = PanOperation.None;
            this.finished.Reset();
            Task.Run(new Action(() => CompleteSwipeAsync(this, 1000, e)));

            this.background           = this.view.BackgroundColor;
            this.view.BackgroundColor = Color.Orange;


            Debug.WriteLine("Starting swipe from container");
        }
예제 #5
0
        public void CompleteSwipe(PanUpdatedEventArgs e)
        {
            this.view.BackgroundColor = background;
            bool isBaseContainer = this.view is PanContainer;

            if (this.parentLayout.Padding.Left - this.MarginLeft > SwipeLength)
            {
                Debug.WriteLine("Going to delete");

                this.GetParentContainer()?.RaisePanFinished(PanOperation.Delete, e);
            }
            else if (this.parentLayout.Padding.Top - this.MarginTop > this.view.Height && this.operation == PanOperation.Move)
            {
                Debug.WriteLine("Going to move");

                this.GetParentContainer()?.RaisePanFinished(PanOperation.Move, new PanContainer.MoveEventArgs(e, (int)((this.parentLayout.Padding.Top - this.MarginTop) / this.view.Height)));
            }
            else
            {
                this.CancelDelete(e);
                this.operation = PanOperation.None;
            }
        }