• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TouchEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TouchEventArgs的典型用法代码示例。如果您正苦于以下问题:C# TouchEventArgs类的具体用法?C# TouchEventArgs怎么用?C# TouchEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TouchEventArgs类属于命名空间,在下文中一共展示了TouchEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BoxExRenderer_Touch

        float _ox, _oy; // 前回の絶対位置
        /// <summary>
        /// タッチイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BoxExRenderer_Touch(object sender, TouchEventArgs e)
        {
            var box = sender as Android.Views.View;
            var el = this.Element as BoxViewEx;
            switch (e.Event.Action)
            {
                case MotionEventActions.Down:
                    // 初期の相対値を保存
                    _gx = e.Event.GetX();
                    _gy = e.Event.GetY();
                    el.OnManipulationStarted(el, new ManipulationStartedRoutedEventArgs());
                    break;
                case MotionEventActions.Move:
                    // 移動距離を計算
                    float dx = e.Event.RawX - _ox;
                    float dy = e.Event.RawY - _oy;
                    // 移動
                    // TODO: 誤差で少しずれるが実用上問題ない
                    // setPos((int)box.Left + (int)dx, (int)box.Top + (int)dy);
                    // OnManipulationDelta(sender, new ManipulationDeltaRoutedEventArgs(sender, (int)dx, (int)dy));
                    // System.Diagnostics.Debug.WriteLine("move: Raw{0} {1} dx:{2} {3}", e.Event.RawX, e.Event.RawY, dx, dy);

                    // コールバック呼び出し
                    // TODO: delta 方式なのか誤差が大きい
                    el.OnManipulationDelta(el, new ManipulationDeltaRoutedEventArgs(sender, dx, dy));
                    break;
                case MotionEventActions.Up:
                    el.OnManipulationCompleted(el, new ManipulationCompletedRoutedEventArgs());
                    break;
            }
            // 現在の絶対位置を保存
            _ox = e.Event.RawX;
            _oy = e.Event.RawY;
        }
开发者ID:moonmile,项目名称:PazzleDrag,代码行数:40,代码来源:BoxExRenderer.cs


示例2: OnTouchImageView

        void OnTouchImageView(object sender, TouchEventArgs e)
        {
            string message;
            switch (e.Event.Action) {
            case MotionEventActions.Down:
            case MotionEventActions.Move:
                message = "Touch Begins";
                startX = e.Event.RawX;
                break;

            case MotionEventActions.Up:
            case MotionEventActions.Cancel:
                message = "Touch Ends";
                endX = e.Event.RawX;
                if (endX - startX > 20) {
                    image.SwipedRight ();
                } else if (endX - startX < -20) {
                    image.SwipedLeft ();
                }
                break;

            default:
                message = string.Empty;
                break;
            }
        }
开发者ID:rughvi,项目名称:imageswipe,代码行数:26,代码来源:MyImageRenderer.cs


示例3: HScrollViewTouch

        private void HScrollViewTouch(object sender, TouchEventArgs e)
        {
            e.Handled = false;

            switch (e.Event.Action)
            {
                case MotionEventActions.Move:
                    _deltaXResetTimer.Stop();
                    _deltaX = _scrollView.ScrollX - _prevScrollX;
                    _prevScrollX = _scrollView.ScrollX;

                    UpdateSelectedIndex();

                    _deltaXResetTimer.Start();
                    break;

                case MotionEventActions.Down:
                    _motionDown = true;
                    _scrollStopTimer.Stop();
                    break;

                case MotionEventActions.Up:
                    _motionDown = false;
                    SnapScroll();
                    _scrollStopTimer.Start();
                    break;
            }
        }
开发者ID:imgen,项目名称:XamarinForms.SwippableBottomTabView,代码行数:28,代码来源:CarouselLayoutRenderer.cs


示例4: HandleButtonButtonAction

        static void HandleButtonButtonAction(object sender, TouchEventArgs e)
        {
            //if (e.TouchEvent == TouchEventType.Down)
            {
                var dialog = new Dialog();
                Label label = new Label();
                label.X = 10.0f;
                label.Y = 50.0f;
                label.Text = "Test Dialog";

                Button button = new Button();
                button.Text = "Hidding Dialog...";
                button.TextColor = new UIColor(1.0f, 0.0f, 0.0f, 1.0f);
                button.SetPosition(5.0f, 5.0f);

                button.ButtonAction += (s, ea) =>
                {
                    dialog.Hide();
                };

                dialog.AddChildLast(button);
                dialog.AddChildLast(label);

                dialog.Show();
            }
        }
开发者ID:yutanaka,项目名称:PSSuite_RD,代码行数:26,代码来源:AppMain.cs


示例5: Touched

 protected override void Touched(UUID entity, TouchEventArgs args)
 {
     switch (_control.State.GetState(args.AvatarName, args.AvatarID)) {
         case Impl.Module.Control.NothingSelected:
             _control.State.SetState(SandboxControl.DeleteSelected, args.AvatarName, args.AvatarID);
             Button.SetVisualState(1, _control.ToggleGlow);
             break;
         case SandboxControl.RouterSelected:
             _control.Record.RemoveNode(_control.State.GetSelectedEntity(args.AvatarName, args.AvatarID).ID, GetParameters(args.AvatarID));
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.EPSelected:
             _control.Record.RemoveNode(_control.State.GetSelectedEntity(args.AvatarName, args.AvatarID).ID, GetParameters(args.AvatarID));
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.LinkSelected:
             _control.Record.RemoveLink(_control.State.GetSelectedEntity(args.AvatarName, args.AvatarID).ID, GetParameters(args.AvatarID));
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.VisualiseAlgorithmSelected:
             _control.RemoveNode(_control.State.GetSelectedEntity(args.AvatarName, args.AvatarID).ID, GetParameters(args.AvatarID));
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.DeleteSelected:
             _control.State.ResetState(args.AvatarName, args.AvatarID);
             break;
         case SandboxControl.DisplayTableSelected:
             //DO nothing
             break;
     }
 }
开发者ID:JohnMcCaffery,项目名称:RoutingIsland,代码行数:31,代码来源:Delete.cs


示例6: closeDialog

 private void closeDialog(object sender, TouchEventArgs e)
 {
     FadeOutEffect fadeOutEffect = new FadeOutEffect(
             this, 500, FadeOutEffectInterpolator.Linear);
     fadeOutEffect.Start();
     this.Hide(fadeOutEffect);
 }
开发者ID:khiraiwa,项目名称:psm-avi_movie_player,代码行数:7,代码来源:ErrorDialog.cs


示例7: touchesBeganHandler

 private void touchesBeganHandler(object sender, TouchEventArgs e)
 {
     foreach (var point in e.Touches)
     {
         spawnPrefabAt(point.Position);
     }
 }
开发者ID:RabitBox,项目名称:FlickBattler,代码行数:7,代码来源:Spawner.cs


示例8: ChangeToStatusScene

 public void ChangeToStatusScene(object sender, TouchEventArgs e)
 {
     Sounds.PlayOk();
     Scenes.characterStatusScene.UpdateValue();
     Scenes.characterStatusScene.ScrollPanel_1_Skills.UpdateSkills();
     UISystem.SetScene(Scenes.characterStatusScene);
 }
开发者ID:noradium,项目名称:Black-Rins-ambition,代码行数:7,代码来源:SceneTitle.cs


示例9: HandleStartButtonTouchEventReceived

 void HandleStartButtonTouchEventReceived(object sender, TouchEventArgs e)
 {
     Console.WriteLine( selectedLevel );
     this.RootWidget.Dispose();
     UISystem.SetScene( new LoadingScene( selectedLevel ) );
     //			Director.Instance.ReplaceScene( new GameScene( selectedLevel ) );
 }
开发者ID:phoenixperry,项目名称:crystallography,代码行数:7,代码来源:LevelSelectScene.cs


示例10: OnInterceptTouchEvent

		public override bool OnInterceptTouchEvent (MotionEvent ev)
		{
			TouchEventArgs eventArgs = new TouchEventArgs (true, ev);
			HandleGenericMotion (this, eventArgs);

			return base.OnInterceptTouchEvent(ev);
		}
开发者ID:ChandrakanthBCK,项目名称:customer-success-samples,代码行数:7,代码来源:TabbedPageCustomRenderer.cs


示例11: touchesEndedHandler

 private void touchesEndedHandler(object sender, TouchEventArgs e)
 {
     foreach (var touch in e.Touches)
     {
         ITouch _touch;
         if (!ftlTouches.TryGetValue(touch.Id, out _touch)) return;
     }
 }
开发者ID:drt-ftl,项目名称:Totem_TwoWay,代码行数:8,代码来源:EnterCommands.cs


示例12: UpdateInput

 private void UpdateInput(object sender, TouchEventArgs e)
 {
     TouchPoint tmp = e.TouchPoint;
     if (tmp.IsTagRecognized)
     {
         SendUpdate.doSend(tmp);
     }
 }
开发者ID:bcaf,项目名称:bcaf,代码行数:8,代码来源:Form1.cs


示例13: MapControl_Touch

        void MapControl_Touch(object sender, TouchEventArgs args)
        {
            if (_map.Lock) return;

            var x = (int)args.Event.RawX;
            var y = (int)args.Event.RawY;

            switch (args.Event.Action)
            {
            case MotionEventActions.Down:
                _previousMap = null;
                _mode = Drag;
                break;
            case MotionEventActions.Up:
                _previousMap = null;
                _mode = None;
                _map.ViewChanged (true);
                break;
            case MotionEventActions.Pointer2Down:
                _previousMap = null;
                _oldDist = Spacing(args.Event);
                MidPoint(_currentMid, args.Event);
                _previousMid = _currentMid;
                _mode = Zoom;
                break;
            case MotionEventActions.Pointer2Up:
                _previousMap = null;
                _previousMid = null;
                _mode = Drag;
                _map.ViewChanged (true);
                break;
            case MotionEventActions.Move:
                switch (_mode)
                {
                case Drag:
                    _currentMap = new PointF (x, y);
                    if (_previousMap != null) {
                        _map.Viewport.Transform (_currentMap.X, _currentMap.Y, _previousMap.X, _previousMap.Y);
                        RefreshGraphics ();
                    }
                    _previousMap = _currentMap;                    
                    break;
                case Zoom:
                    if (args.Event.PointerCount < 2) return;

                    var newDist = Spacing (args.Event);
                    var scale = newDist / _oldDist;

                    _oldDist = Spacing (args.Event);
                    _previousMid = new PointF (_currentMid.X, _currentMid.Y);
                    MidPoint (_currentMid, args.Event);
                    _map.Viewport.Transform(_currentMid.X, _currentMid.Y, _previousMid.X, _previousMid.Y, scale);
                    RefreshGraphics ();
                    break;
                }
                break;
            }
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:58,代码来源:MapControl.cs


示例14: HandleTouch

        /// <summary>
        /// Handles the touch.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Android.Views.View.TouchEventArgs"/> instance containing the event data.</param>
        void HandleTouch (object sender, TouchEventArgs e)
        {
            var element = (ExtendedEntry)this.Element;
            switch (e.Event.Action)
            {
                case MotionEventActions.Down:
                    this.downX = e.Event.GetX();
                    this.downY = e.Event.GetY();
                    return;
                case MotionEventActions.Up:
                case MotionEventActions.Cancel:
                case MotionEventActions.Move:
                    this.upX = e.Event.GetX();
                    this.upY = e.Event.GetY();

                    float deltaX = this.downX - this.upX;
                    float deltaY = this.downY - this.upY;

                        // swipe horizontal?
                    if(Math.Abs(deltaX) > Math.Abs(deltaY))
                    {
                        if(Math.Abs(deltaX) > MinDistance)
                        {
                            if (deltaX < 0)
                            {
                                element.OnRightSwipe(this, EventArgs.Empty); 
                                return;
                            }

                            if (deltaX > 0)
                            {
                                element.OnLeftSwipe(this, EventArgs.Empty); 
                                return;
                            }
                        }
                        else 
                        {
                            Android.Util.Log.Info("ExtendedEntry", "Horizontal Swipe was only " + Math.Abs(deltaX) + " long, need at least " + MinDistance);
                            return; // We don't consume the event
                        }
                    }
                    // swipe vertical?
//                    else 
//                    {
//                        if(Math.abs(deltaY) > MIN_DISTANCE){
//                            // top or down
//                            if(deltaY < 0) { this.onDownSwipe(); return true; }
//                            if(deltaY > 0) { this.onUpSwipe(); return true; }
//                        }
//                        else {
//                            Log.i(logTag, "Vertical Swipe was only " + Math.abs(deltaX) + " long, need at least " + MIN_DISTANCE);
//                            return false; // We don't consume the event
//                        }
//                    }

                    return;
            }
        }
开发者ID:riadus,项目名称:Xamarin-Forms-Labs,代码行数:63,代码来源:ExtendedEntryRenderer.cs


示例15: setSkillDefault

 public void setSkillDefault(object sender, TouchEventArgs e)
 {
     if(CheckBox_0.Checked){
         Global.setSkill = SkillID.Default;
         CheckBox_1.Checked = false;
         CheckBox_2.Checked = false;
         CheckBox_3.Checked = false;
     }
 }
开发者ID:noradium,项目名称:Black-Rins-ambition,代码行数:9,代码来源:PanelSkills.cs


示例16: Move

 public void Move(Object sender, TouchEventArgs e)
 {
     if (e.TouchPoint.IsFingerRecognized)
     {
         pressedPoints[e.TouchPoint.Id] = new Point((int)e.TouchPoint.CenterX, (int)e.TouchPoint.CenterY);
         foreach (EGameMode id in Enum.GetValues(typeof(EGameMode)))
             screenParts[id].Move(e.TouchPoint);
     }
 }
开发者ID:poksme,项目名称:TetriClimber,代码行数:9,代码来源:TouchInput.cs


示例17: HandleTestResultItemTouchEventReceived

 private void HandleTestResultItemTouchEventReceived(object sender, TouchEventArgs e)
 {
     TestResultItem item = sender as TestResultItem;
     if(item != null) {
         if(e.TouchEvents.PrimaryTouchEvent.Type == TouchEventType.Up) {
             OnTestResultItemPressed(item);
         }
     }
 }
开发者ID:garyjohnson,项目名称:vitaUnit,代码行数:9,代码来源:TestPage.cs


示例18: touchBeganHandler

    private void touchBeganHandler(object sender, TouchEventArgs e)
    {
		print ("handling");
        foreach (var point in e.Touches)
        {
            spawnPrefabAt(point.Position);
			print ("sending");
        }
    }
开发者ID:krishnaarjun,项目名称:projectarrow,代码行数:9,代码来源:InputExample.cs


示例19: touchesMovedHandler

 private void touchesMovedHandler(object sender, TouchEventArgs e)
 {
     foreach (var touch in e.Touches)
     {
         if (!touch.Properties.ContainsKey("Angle")) return;
         ITouch testTouch;
         updateTouch(touch);
     }
 }
开发者ID:drt-ftl,项目名称:Totem_TwoWay,代码行数:9,代码来源:EnterCommands.cs


示例20: OnTouchUp

        protected override void OnTouchUp(TouchEventArgs args)
        {
            base.OnTouchUp(args);

            if (IsPressed && ClickMode == ClickMode.Release)
                RaiseEvent(new RoutedEventArgs(ClickEvent));

            IsPressed = false;
        }
开发者ID:cg123,项目名称:xenko,代码行数:9,代码来源:ButtonBase.cs



注:本文中的TouchEventArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TouchPoint类代码示例发布时间:2022-05-24
下一篇:
C# TouchCoordSys类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap