private void ControlTouch(object sender, TouchEventArgs args) { if (_appEmergency != null) { if (args.Event.Action == MotionEventActions.Down) { _appEmergency.DoStarted(); _startX = args.Event.GetX() / Resources.DisplayMetrics.Density; _startY = args.Event.GetY() / Resources.DisplayMetrics.Density; Console.WriteLine("Start coordinates => {0}, {1}", _startX, _startY); } else if (args.Event.Action == MotionEventActions.Move) { var x = (args.Event.GetX() / Resources.DisplayMetrics.Density); var y = (args.Event.GetY() / Resources.DisplayMetrics.Density); var deltaX = x - _startX; var deltaY = y - _startY; Console.WriteLine("Coordinates => {0}, {1} ---- Delta => {2}, {3}", x, y, deltaX, deltaY); _appEmergency.DoRunning(deltaX, deltaY); } else if (args.Event.Action == MotionEventActions.Up) { _appEmergency.DoCompleted(); _startX = 0; _startY = 0; } } }
public override void TouchesBegan(NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); if (_appEmergency != null) { _appEmergency.DoStarted(); } }