public void OnSwipe(SwipeEventArgs args)
 {
     if(Swipe!=null)
     {
         Swipe(this, args);
     }
 }
        private void CanvasGallery_Swipe(object sender, SwipeEventArgs args)
        {
            args.Handled = true;

            System.Windows.Point position = args.GetTouchPoint(this.canvasGallery).Position;
            this.DoSwipe(position);
        }
Exemplo n.º 3
0
 void kinectService_SwipeDetected(object sender, SwipeEventArgs e)
 {
     if (e.Direction == SwipeDirection.Left)
     {
         this.GoToNextPage();
     }
     else if (e.Direction == SwipeDirection.Right)
     {
         this.GoToPreviousPage();
     }
 }
Exemplo n.º 4
0
    private void FireSwipeFunction()
    {
        Debug.Log("SWIPE");

        Vector2 diff = end_pos - start_pos;

        GameObject hitObject = GetHit(start_pos);
        Directions dir;

        if (Mathf.Abs(diff.x) > Mathf.Abs(diff.y))
        {
            if (diff.x > 0)
            {
                Debug.Log("Right");
                dir = Directions.RIGHT;
            }
            else
            {
                Debug.Log("Left");
                dir = Directions.LEFT;
            }
        }
        else
        {
            if (diff.y > 0)
            {
                Debug.Log("up");
                dir = Directions.UP;
            }

            else
            {
                Debug.Log("down");
                dir = Directions.DOWN;
            }
        }

        SwipeEventArgs args = new SwipeEventArgs(start_pos, diff, dir, hitObject);

        if (OnSwipe != null)
        {
            OnSwipe(this, args);
        }

        if (hitObject != null)
        {
            ISwiped iSwipe = hitObject.GetComponent <ISwiped>();
            if (iSwipe != null)
            {
                iSwipe.OnSwipe(args);
            }
        }
    }
Exemplo n.º 5
0
        /// <summary>
        /// [内部メソッド]
        /// 「スワイプ」イベントを実行する
        /// </summary>
        /// <param name="touchPoint">接触点</param>
        private void executeSwipeEvent(TouchPoint touchPoint)
        {
            // 基準点と接触点の距離を取得する
            int distance = touchPoint.GetDistanceFrom(this.baseTouchPoint);

            // 基準点と接触点の角度を計算する
            int angle = Calculator.CalculateAngle(this.baseTouchPoint.X, this.baseTouchPoint.Y, touchPoint.X, touchPoint.Y);

            // 角度からスワイプの方向を決定する
            SwipeDirection direction = Calculator.AngleToDirection(angle);

            // 「スワイプ」イベントハンドラを実行する
            var swipeData = new SwipeData(this.baseTouchPoint, touchPoint, angle, distance, direction);
            var seArgs    = new SwipeEventArgs(swipeData, this.orbit);

            OnSwipe(touchPoint, seArgs);
        }
Exemplo n.º 6
0
    public void OnSwipe(SwipeEventArgs args)
    {
        Vector3 move_dir = Vector3.zero;

        /*
         * switch (args.Direction)
         * {
         *  case Directions.UP:move_dir.y = 1; break;
         *  case Directions.DOWN: move_dir.y = -1;  break;
         *  case Directions.LEFT: move_dir.x = -1;  break;
         *  case Directions.RIGHT: move_dir.x = 1;  break;
         *
         * }*/
        move_dir = args.RawDirection.normalized;

        TargetPosition = TargetPosition + (move_dir * 5);
    }
        private void Swipe(object source, SwipeEventArgs e)
        {
            if (Math.Abs(e.DeltaX) <= Math.Abs(e.DeltaY))
            {
                // vertical scroll; not interested
                return;
            }

            // horizontal scroll
            if (e.DeltaX > 0)
            {
                this.vm.LoadPreviousMonth();
            }
            else
            {
                this.vm.LoadNextMonth();
            }
        }
Exemplo n.º 8
0
    private void OnSwipe()
    {
        if (!checkForSwipe)
        {
            return;
        }

        checkForSwipe = false;

        // Create swipe event args
        SwipeEventArgs swipeEventArgs = new SwipeEventArgs();

        // Set swipe direction for event args
        swipeEventArgs.direction = CalculateSwipeDirection();

        if (SwipeEvent != null)
        {
            SwipeEvent(this, swipeEventArgs);
        }
    }
Exemplo n.º 9
0
        private void Image_Swipe(IView sender, SwipeEventArgs eventArgs)
        {
            var a = EventManager.Instance.GetDetails();

            if (a?.Images != null)
            {
                switch (eventArgs.Direction)
                {
                case GestureDirection.ToLeft:
                    if (_incrimentPath < a.Images.Count())
                    {
                        _incrimentPath++;
                    }
                    break;

                case GestureDirection.ToRight when _incrimentPath > 0:
                    _incrimentPath--;
                    break;

                case GestureDirection.ToRight:
                    _incrimentPath = a.Images.Count() - 1;
                    break;
                }

                if (a.Images?.ElementAtOrDefault(_incrimentPath)?.Path != null)
                {
                    a.ImagePathView = a.Images.ElementAtOrDefault(_incrimentPath)?.Path;
                }
                else
                {
                    _incrimentPath = 0;
                }

                a.ImagePathView = a.Images.ElementAtOrDefault(_incrimentPath)?.Path;
            }

            ThreadPool.QueueUserWorkItem(_ =>
            {
                (sender as IImage)?.SetImageFromUrl(a.ImagePathView);
            });
        }
Exemplo n.º 10
0
    void gem_Swiped(object sender, SwipeEventArgs e)
    {
        if (waitRelease)
        {
            return;
        }
        var      gemCell   = sender as GemCell;
        GridCell otherCell = null;

        if (e.swipedDown())
        {
            otherCell = PuzzlePresentation.GetGridCellAtPos(gemCell.GridCell.BoardX, gemCell.GridCell.BoardY + 1);
        }
        if (e.swipedUp())
        {
            otherCell = PuzzlePresentation.GetGridCellAtPos(gemCell.GridCell.BoardX, gemCell.GridCell.BoardY - 1);
        }
        if (e.swipedLeft())
        {
            otherCell = PuzzlePresentation.GetGridCellAtPos(gemCell.GridCell.BoardX - 1, gemCell.GridCell.BoardY);
        }
        if (e.swipedRight())
        {
            otherCell = PuzzlePresentation.GetGridCellAtPos(gemCell.GridCell.BoardX + 1, gemCell.GridCell.BoardY);
        }

        if (otherCell == null)
        {
            return;
        }
        var otherGemCell = otherCell.GemCell;

        if (AreGemCellsAdjacent(gemCell, otherGemCell))
        {
            gemCell.StopAllCoroutines();
            otherGemCell.StopAllCoroutines();
            RaiseSwappedEvent(gemCell, otherGemCell);
            selectedGemCell = null;
        }
        waitRelease = true;
    }
Exemplo n.º 11
0
    public void OnSwipe(object sender, SwipeEventArgs args)
    {
        Directions dir = args.directions;

        if (dir == Directions.LEFT)
        {
            currentammo--;
            if (currentammo < 0)
            {
                currentammo = 2;
            }
        }
        else if (dir == Directions.RIGHT)
        {
            currentammo++;
            if (currentammo > 2)
            {
                currentammo = 0;
            }
        }
    }
Exemplo n.º 12
0
    private void FireSwipeEvent()
    {
        Vector2    diff = endPoint - startPoint;
        Directions dir;

        if (diff.x > 0)
        {
            dir = Directions.RIGHT;
        }
        else
        {
            dir = Directions.LEFT;
        }

        SwipeEventArgs args = new SwipeEventArgs(startPoint, diff, dir);

        if (OnSwipe != null)
        {
            OnSwipe(this, args);
        }

        isTouching = true;
    }
Exemplo n.º 13
0
        private void Image_OnSwiped(object sender, SwipeEventArgs e)
        {
            var imageCoupon = (MR.Gestures.Image)sender;
            var _coupon     = couponList.couponList.FirstOrDefault(c => c.ImageStream == imageCoupon.Source);

            if (e.Direction == Direction.Right)
            {
                Debug.WriteLine("ADDING - " + _coupon.ImageUrl);
                //savedCoupons.Add(_coupon);
                azure.AddToBackpack(_coupon, user);
            }
            else if (e.Direction == Direction.Left)
            {
                Debug.WriteLine("DELETING - " + _coupon.ImageUrl);
            }
            couponList.couponList.Remove(_coupon);

            foreach (var c in couponList.couponList)
            {
                Debug.WriteLine("CHECKING - " + c.ImageUrl);
            }
            listView.ItemsSource = null;
            listView.ItemsSource = couponList.couponList;
        }
Exemplo n.º 14
0
 protected virtual void OnSwiped(SwipeEventArgs e)
 {
     Debug.WriteLine("Swiped " + e.Direction);
     //AddText(PanInfo("Swiped " + e.Direction, e));
 }
Exemplo n.º 15
0
 void OnSwipeCancelled(object sender, SwipeEventArgs e)
 {
     Console.WriteLine("Swipe cancelled.\n");
 }
Exemplo n.º 16
0
 private static void TriggerSwipeEvent(SwipeEventArgs args)
 {
     if (SwipeEvent != null)
     {
         SwipeEvent(null, args);
     }
 }
Exemplo n.º 17
0
        /// <summary>
        /// Handles the Swipe event of the csPayWithCard control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="SwipeEventArgs"/> instance containing the event data.</param>
        protected void csPayWithCard_Swipe(object sender, SwipeEventArgs e)
        {
            using (var rockContext = new RockContext())
            {
                try
                {
                    var swipeInfo = e.PaymentInfo;
                    var person    = Customer;

                    if (person == null)
                    {
                        person = new PersonAliasService(rockContext).GetPerson(GetAttributeValue("GuestCustomer").AsGuid());

                        if (person == null)
                        {
                            nbSwipeErrors.Text = "No guest customer configured. Transaction not processed.";
                            return;
                        }
                    }

                    //
                    // Get the gateway to use.
                    //
                    FinancialGateway financialGateway = null;
                    GatewayComponent gateway          = null;
                    Guid?            gatewayGuid      = GetAttributeValue("CreditCardGateway").AsGuidOrNull();
                    if (gatewayGuid.HasValue)
                    {
                        financialGateway = new FinancialGatewayService(rockContext).Get(gatewayGuid.Value);

                        if (financialGateway != null)
                        {
                            financialGateway.LoadAttributes(rockContext);
                        }

                        gateway = financialGateway.GetGatewayComponent();
                    }

                    if (gateway == null)
                    {
                        nbSwipeErrors.Text = "Invalid gateway provided. Please provide a gateway. Transaction not processed.";
                        return;
                    }

                    swipeInfo.Amount = Cart.Total;

                    //
                    // Process the transaction.
                    //
                    string errorMessage = string.Empty;
                    var    transaction  = gateway.Charge(financialGateway, swipeInfo, out errorMessage);

                    if (transaction == null)
                    {
                        nbSwipeErrors.Text = String.Format("An error occurred while process this transaction. Message: {0}", errorMessage);
                        return;
                    }

                    //
                    // Set some common information about the transaction.
                    //
                    transaction.AuthorizedPersonAliasId = person.PrimaryAliasId;
                    transaction.TransactionDateTime     = RockDateTime.Now;
                    transaction.FinancialGatewayId      = financialGateway.Id;
                    transaction.TransactionTypeValueId  = DefinedValueCache.Get(GetAttributeValue("TransactionType")).Id;
                    transaction.SourceTypeValueId       = DefinedValueCache.Get(GetAttributeValue("Source")).Id;
                    transaction.Summary = swipeInfo.Comment1;

                    //
                    // Ensure we have payment details.
                    //
                    if (transaction.FinancialPaymentDetail == null)
                    {
                        transaction.FinancialPaymentDetail = new FinancialPaymentDetail();
                    }
                    transaction.FinancialPaymentDetail.SetFromPaymentInfo(swipeInfo, gateway, rockContext);

                    //
                    // Setup the transaction details to credit the correct account.
                    //
                    GetTransactionDetails(rockContext).ForEach(d => transaction.TransactionDetails.Add(d));

                    var batchService = new FinancialBatchService(rockContext);

                    //
                    // Get the batch
                    //
                    var batch = batchService.Get(
                        GetAttributeValue("BatchNamePrefix"),
                        swipeInfo.CurrencyTypeValue,
                        swipeInfo.CreditCardTypeValue,
                        transaction.TransactionDateTime.Value,
                        financialGateway.GetBatchTimeOffset());

                    var batchChanges = new History.HistoryChangeList();

                    if (batch.Id == 0)
                    {
                        batchChanges.AddChange(History.HistoryVerb.Add, History.HistoryChangeType.Record, "Batch");
                        History.EvaluateChange(batchChanges, "Batch Name", string.Empty, batch.Name);
                        History.EvaluateChange(batchChanges, "Status", null, batch.Status);
                        History.EvaluateChange(batchChanges, "Start Date/Time", null, batch.BatchStartDateTime);
                        History.EvaluateChange(batchChanges, "End Date/Time", null, batch.BatchEndDateTime);
                    }

                    //
                    // Update the control amount.
                    //
                    decimal newControlAmount = batch.ControlAmount + transaction.TotalAmount;
                    History.EvaluateChange(batchChanges, "Control Amount", batch.ControlAmount.FormatAsCurrency(), newControlAmount.FormatAsCurrency());
                    batch.ControlAmount = newControlAmount;

                    //
                    // Add the transaction to the batch.
                    //
                    transaction.BatchId = batch.Id;
                    batch.Transactions.Add(transaction);

                    //
                    // Generate the receipt.
                    //
                    int receiptId;
                    using (var rockContext2 = new RockContext())
                    {
                        var receipt = GenerateReceipt(rockContext2);
                        receiptId = receipt.Id;
                    }

                    //
                    // Update each transaction detail to reference the receipt.
                    //
                    foreach (var transactionDetail in transaction.TransactionDetails)
                    {
                        transactionDetail.EntityTypeId = EntityTypeCache.Get(typeof(InteractionComponent)).Id;
                        transactionDetail.EntityId     = receiptId;
                    }

                    rockContext.WrapTransaction(() =>
                    {
                        rockContext.SaveChanges();

                        HistoryService.SaveChanges(
                            rockContext,
                            typeof(FinancialBatch),
                            Rock.SystemGuid.Category.HISTORY_FINANCIAL_BATCH.AsGuid(),
                            batch.Id,
                            batchChanges
                            );
                    });

                    ShowReceiptPanel();
                }
                catch (Exception ex)
                {
                    nbSwipeErrors.Text = String.Format("An error occurred while process this transaction. Message: {0}", ex.Message);
                }
            }
        }
 private void StackLayout_OnSwiped(object sender, SwipeEventArgs e)
 {
     picker = DependencyService.Get<IPictureTaker>();
     App.LatestPhotographer = _callingPageIdentification;
     picker.SnapPic();
 }
Exemplo n.º 19
0
 void DemoCardView_DidSwipeRight(object sender, SwipeEventArgs e)
 {
     Console.WriteLine("Right");
 }
Exemplo n.º 20
0
 protected virtual void OnSwiped(SwipeEventArgs e)
 {
     AddText("Swiped " + e.Direction + " " + GetElementName(e) + " with " + e.NumberOfTouches + " fingers");
 }
Exemplo n.º 21
0
    private void OnSwipeEvent(object sender, SwipeEventArgs e)
    {
        Turn(e.direction);

        DoTurnTween();
    }
Exemplo n.º 22
0
 void OnFrameSwiped(object sender, SwipeEventArgs e) => DisplayAlert("Swiped", $"You swiped {e.Direction}.", "OK");
Exemplo n.º 23
0
    private void InvokeSwipeCommitted(Vector2 direction)
    {
        var handler = SwipeCommitted;
        if (handler == null) {
            return;
        }

        var e = new SwipeEventArgs(direction, symbolChain);
        SwipeCommitted(this, e);
    }
Exemplo n.º 24
0
 private void DemoCardView_DidSwipeLeft(object sender, SwipeEventArgs e)
 {
     Console.WriteLine("Left");
 }
Exemplo n.º 25
0
    // Update is called once per frame
    void Update()
    {
        var device = SteamVR_Controller.Input((int)trackedObj.index);

        // Touch down, possible chance for a swipe
        if ((int)trackedObj.index != -1 && device.GetTouchDown(Valve.VR.EVRButtonId.k_EButton_Axis0))
        {
            trackingSwipe = true;
            // Record start time and position
            mStartPosition = new Vector2(device.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis0).x,
                                         device.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis0).y);
            mSwipeStartTime = Time.time;
        }
        // Touch up , possible chance for a swipe
        else if (device.GetTouchUp(Valve.VR.EVRButtonId.k_EButton_Axis0))
        {
            trackingSwipe = false;
            trackingSwipe = true;
            checkSwipe    = true;
            //Debug.Log("Tracking Finish");
        }
        else if (trackingSwipe)
        {
            endPosition = new Vector2(device.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis0).x,
                                      device.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis0).y);
        }

        if (checkSwipe)
        {
            checkSwipe = false;

            float   deltaTime   = Time.time - mSwipeStartTime;
            Vector2 swipeVector = endPosition - mStartPosition;

            float velocity = swipeVector.magnitude / deltaTime;

            if (velocity > mMinVelocity &&
                swipeVector.magnitude > mMinSwipeDist)
            {
                swipeVector.Normalize();

                float angleOfSwipe = Vector2.Dot(swipeVector, mXAxis);
                angleOfSwipe = Mathf.Acos(angleOfSwipe) * Mathf.Rad2Deg;

                SwipeEventArgs eventArgs = new SwipeEventArgs();
                eventArgs.velocity  = velocity;
                eventArgs.magnitude = swipeVector.magnitude;
                eventArgs.angle     = angleOfSwipe;

                if (angleOfSwipe < mAngleRange)
                {
                    SwipedRight(this, new SwipeEventArgs());
                }
                else if ((180.0f - angleOfSwipe) < mAngleRange)
                {
                    SwipedLeft(this, new SwipeEventArgs());
                }
                else
                {
                    angleOfSwipe = Vector2.Dot(swipeVector, mYAxis);
                    angleOfSwipe = Mathf.Acos(angleOfSwipe) * Mathf.Rad2Deg;
                    if (angleOfSwipe < mAngleRange)
                    {
                        //SwipedUp(this, new SwipeEventArgs());
                    }
                    else if ((180.0f - angleOfSwipe) < mAngleRange)
                    {
                        //SwipedDown(this, new SwipeEventArgs());
                    }
                }
            }
        }
    }
Exemplo n.º 26
0
 private void OnSwipeEvent(object sender, SwipeEventArgs e)
 {
     canSelect = false;
 }
Exemplo n.º 27
0
	void gem_Swiped(object sender, SwipeEventArgs e)
	{
		if (waitRelease)
			return;
		var gemCell = sender as GemCell;
		GridCell otherCell = null;
		if (e.swipedDown())
			otherCell = PuzzlePresentation.GetGridCellAtPos(gemCell.GridCell.BoardX, gemCell.GridCell.BoardY + 1);
		if (e.swipedUp())
			otherCell = PuzzlePresentation.GetGridCellAtPos(gemCell.GridCell.BoardX, gemCell.GridCell.BoardY - 1);
		if (e.swipedLeft())
			otherCell = PuzzlePresentation.GetGridCellAtPos(gemCell.GridCell.BoardX - 1, gemCell.GridCell.BoardY);
		if (e.swipedRight())
			otherCell = PuzzlePresentation.GetGridCellAtPos(gemCell.GridCell.BoardX + 1, gemCell.GridCell.BoardY);
		
		if (otherCell == null)
			return;
		var otherGemCell = otherCell.GemCell;
		if (AreGemCellsAdjacent(gemCell, otherGemCell))
		{
			gemCell.StopAllCoroutines();
			otherGemCell.StopAllCoroutines();
			RaiseSwappedEvent(gemCell, otherGemCell);
			selectedGemCell = null;
		}
		waitRelease = true;
	}
Exemplo n.º 28
0
	private void OnSwipeProgress (object sender, SwipeEventArgs e) {
		switch (e.State) {
			case SwipeState.Started:
				break;
			case SwipeState.Moved:
				break;
			case SwipeState.SwipeLeft:
				if (canShowNextArt) ShowNextGraffiti();
				break;
			case SwipeState.SwipeRight:
				ShowPreviousGraffiti();
				break;
			case SwipeState.Ended:
				break;
		}
	}
Exemplo n.º 29
0
 void OnSwipe(object sender, SwipeEventArgs e)
 {
     Console.WriteLine("View swiped.\n");
 }
Exemplo n.º 30
0
 private void OnSwipeCommitted(object sender, SwipeEventArgs e)
 {
     guiManager.ClearSymbols();
     var target = entityManager.FindTargetable(e.SymbolChain);
     if (target == null) {
         InvokePlayerMiss();
         return;
     }
     entityManager.DeactivateTargetable(target);
     InvokePlayerHit(target);
 }
		protected virtual void OnSwiped(SwipeEventArgs e)
		{
			AddText("Swiped " + e.Direction + " " + GetElementName(e) + " with " + e.NumberOfTouches + " fingers");
		}
Exemplo n.º 32
0
 private void OnSwipeCancelled(object sender, SwipeEventArgs e)
 {
     Console.WriteLine("Swipe cancelled.");
 }
 protected virtual void OnSwiped(SwipeEventArgs e)
 {
     AddText(PanInfo("Swiped " + e.Direction, e));
 }
Exemplo n.º 34
0
	private void OnSwipeProgress (object sender, SwipeEventArgs e) {
		switch (e.State) {
			case SwipeState.Started:
				break;
			case SwipeState.Moved:
				break;
			case SwipeState.SwipeLeft:
				StartCoroutine(ShowNextArtwork());
				break;
			case SwipeState.SwipeRight:
				StartCoroutine(ShowPreviousArtwork());
				break;
			case SwipeState.Ended:
				break;
		}
	}
Exemplo n.º 35
0
 public void OnSwipe(SwipeEventArgs args) {
     if(args.IsBottomEdge && allowFlyoutPanel) {
         flyoutPanel1.ShowPopup();
     }
 }
Exemplo n.º 36
0
    public void OnSwipe(SwipeEventArgs swipeEventArgs)
    {
        Vector3 moveDir = swipeEventArgs.RawDirection.normalized;

        targetPos = targetPos + (moveDir * 5f);
    }
 protected virtual void OnSwipeRight(object sender, SwipeEventArgs e)
 {
     Switch();
 }
Exemplo n.º 38
0
 private void OnSwipe(object sender, SwipeEventArgs e)
 {
     Console.WriteLine("View swiped.");
 }