本文整理汇总了C#中System.Windows.Input.TouchEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TouchEventArgs类的具体用法?C# TouchEventArgs怎么用?C# TouchEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TouchEventArgs类属于System.Windows.Input命名空间,在下文中一共展示了TouchEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleTouch
private void HandleTouch(TouchEventArgs e)
{
var visual = GetTouchVisual(e.TouchDevice.Id);
var point = e.GetTouchPoint(this.fingerCanvas).Position;
visual.SetValue(Canvas.LeftProperty, point.X);
visual.SetValue(Canvas.TopProperty, point.Y);
}
示例2: Button_TouchDown
private void Button_TouchDown(object sender, TouchEventArgs e)
{
e.Handled = true;
// e.RoutedEvent.RoutingStrategy = RoutingStrategy.Direct;
Config.WriteXml(App.config, "config.xml");
this.NavigationService.GoBack();
}
示例3: MotionButton_TouchEnter
private void MotionButton_TouchEnter(object sender, TouchEventArgs e)
{
StartTimer();
_lastTouchDevice = e.Device;
ScaleDown();
}
示例4: RecordTouchDown
private void RecordTouchDown(object sender, TouchEventArgs e)
{
_touchPoints++;
_recordRotation = true;
System.Windows.Input.TouchPoint touchPoint = e.GetTouchPoint(this);
System.Windows.Point point = touchPoint.Position;
_recordY = point.Y;
if (_touchPoints == 2)
{
if (!_isPlaying)
{
channel.PlaySample();
_isPlaying = true;
}
else
{
channel.StopSample();
_isPlaying = false;
}
_twoTouchLock = true;
}
if (_touchPoints == 1)
{
if (channel.IsPlaying())
channel.Pause();
}
}
示例5: OnMoreInfoImageTouched
private void OnMoreInfoImageTouched(object sender, TouchEventArgs e)
{
System.Windows.Controls.Image img = e.OriginalSource as System.Windows.Controls.Image;
if (img == null) return;
OpenWithTask.ShowDetail(img);
e.Handled = true;
}
示例6: LessonContainer_TouchDown
private async void LessonContainer_TouchDown(object sender, TouchEventArgs e)
{
// Forward touch events to container
//FrameworkElement control = sender as FrameworkElement;
//control.CaptureTouch(e.TouchDevice);
if (LayerStackDC.CurrentState.FingerInkingEnabled)
{
LessonContainer.IsContentManipulationEnabled = false;
return;
}
// Saves current touch information
//touchDevices.Add(e.TouchDevice);
touchOrigin = e.GetTouchPoint(LessonContainer).Position;
// Disable manipulation/drawing
//LessonContainer.IsContentManipulationEnabled = false;
LayerStackDC.ContainerTouchDown();
// If touch-and-hold (within 10px radius circle, over 500ms)
if (await TouchHelper.TouchHold(e, LessonContainer, 500, 10))
{
// Opens RadialMenu
LessonContainer.IsContentManipulationEnabled = false;
LayerStackDC.OpenRadialMenu(LayerStackDC.Viewport.GetViewport(),
e.GetTouchPoint(LessonContainer).Position, RadialMenuState.Levels.Main);
// Un-forward touch events to container
//control.ReleaseAllTouchCaptures();
}
}
示例7: ButtonPin_TouchUp
private void ButtonPin_TouchUp(object sender, TouchEventArgs e)
{
// TagRemovedBehavior = TagRemovedBehavior.Persist;
ButtonPin.Visibility = Visibility.Hidden;
isPinned = true;
PinButtonClicked(this, e);
}
示例8: OnTouchDown
protected override void OnTouchDown(TouchEventArgs e)
{
this.CaptureTouch(e.TouchDevice);
card.CardControler.TouchDownCard(this,e);
e.Handled = true;
base.OnTouchDown(e);
}
示例9: ScrollViewer_PreviewTouchUp
/// <summary>
/// Handles the PreviewTouchUp event of the ScrollViewer control.
/// </summary>
/// <param name="sender">Event source</param>
/// <param name="e">Event argument</param>
private void ScrollViewer_PreviewTouchUp(object sender, TouchEventArgs e)
{
try
{
var touchEnd = e.GetTouchPoint(this);
var scrollviewer = sender as ScrollViewer;
double distance = touchEnd.Position.Y - this.touchStartForScrollViewer.Position.Y;
if (Math.Abs(distance) > ThresholdDistanceForSwipe)
{
if (distance > 0)
{
if (scrollviewer != null)
{
scrollviewer.PageUp();
}
}
else
{
if (scrollviewer != null)
{
scrollviewer.PageDown();
}
}
}
e.Handled = true;
}
catch
{
// Do nothing.
}
}
示例10: touchDown
/// <summary>
/// Event triggered when the NoteBubbleGenerator is touch.
/// Generates a new NoteBubble according to the MostNeeded algorithm.
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">TouchEventArgs</param>
public void touchDown(object sender, TouchEventArgs e)
{
if (GlobalVariables.MaxMelodyBubbles > MelodyBubbleVMs.Count)
{
List<MelodyBubble> bubblesList = new List<MelodyBubble>();
foreach (MelodyBubbleViewModel nbvm in MelodyBubbleVMs)
bubblesList.Add(nbvm.MelodyBubble);
MelodyBubble newBubble = MelodyBubbleGenerator.CreateMelodyBubble(bubblesList);
MelodyBubbleViewModel mbVM = new MelodyBubbleViewModel(newBubble, SessionVM.Bubbles, SessionVM);
MelodyBubbleVMs.Add(mbVM);
SessionVM.Bubbles.Items.Add(mbVM.SVItem);
}
else
{
MelodyBubbleViewModel toRemove = MelodyBubbleVMs.First();
MelodyBubbleVMs.Remove(toRemove);
SessionVM.Bubbles.Items.Remove(toRemove.SVItem);
List<MelodyBubble> bubblesList = new List<MelodyBubble>();
foreach (MelodyBubbleViewModel nbvm in MelodyBubbleVMs)
bubblesList.Add(nbvm.MelodyBubble);
MelodyBubble newBubble = MelodyBubbleGenerator.CreateMelodyBubble(bubblesList);
MelodyBubbleViewModel mbVM = new MelodyBubbleViewModel(newBubble, SessionVM.Bubbles, SessionVM);
MelodyBubbleVMs.Add(mbVM);
SessionVM.Bubbles.Items.Add(mbVM.SVItem);
}
String effect = "pop" + (new Random()).Next(1, 5).ToString();
AudioController.PlaySoundWithString(effect);
}
示例11: OnTouchUp
protected override void OnTouchUp(TouchEventArgs e)
{
_currentAngle = _currentAngle + _angle;
//Pass the message up
base.OnTouchUp(e);
}
示例12: UcPhotoContactTap
private void UcPhotoContactTap(object sender, TouchEventArgs e)
{
if (Feature is PhotoFeature)
{
var pf = (PhotoFeature) Feature;
var fe = new FloatingElement
{
Document = new Document {FileType = FileTypes.image, Location = pf.ImageUrl},
OpacityDragging = 0.5,
OpacityNormal = 1.0,
CanMove = true,
CanRotate = true,
CanScale = true,
StartOrientation = e.Device.GetOrientation(Application.Current.MainWindow) + 90,
Background = Brushes.DarkOrange,
MaxSize = new Size(500, (500.0/pf.Width)*pf.Height),
StartPosition = e.TouchDevice.GetTouchPoint(Application.Current.MainWindow).Position,
StartSize = new Size(200, (200.0/pf.Width)*pf.Height),
MinSize = new Size(100, (100.0/pf.Width)*pf.Height),
ShowsActivationEffects = false,
RemoveOnEdge = true,
Contained = true,
Title = pf.Name,
Foreground = Brushes.White,
DockingStyle = DockingStyles.None,
};
AppStateSettings.Instance.FloatingItems.Add(fe);
//State.AddFloatingElement(new CoFile() { Location = pf.ImageUrl, Id = pf.Id, Name = pf.Name }, (pf.Width/2), (pf.Height/2));
}
}
示例13: OnPreviewTouchDown
protected override void OnPreviewTouchDown(TouchEventArgs e)
{
// Release any previous capture
this.ReleaseCurrentDevice();
// Capture the new touch
this.CaptureCurrentDevice(e);
}
示例14: OnTouchDown
} //
public void OnTouchDown(object xSender, TouchEventArgs e)
{
Canvas lCanvas = xSender as Canvas;
if (lCanvas == null) return;
TouchPoint lTouchPoint = e.GetTouchPoint(lCanvas);
if (lTouchPoint == null) return;
myTuple lTuple = _PointA;
if (lTuple != null)
{
if (lTuple.Item1 == e.TouchDevice.Id) return; // this was finger 1, not going to happen anyway as it cannot touchdown twice
Point lPointA = lTuple.Item2;
// store second finger; we don't care about its ID, so it could also be finger 3, 4 or 5 ...
Point lPointB = lTouchPoint.Position;
_PointB = new myTuple(e.TouchDevice.Id, lPointB);
RedrawRectangle(lPointA, lPointB);
return;
}
// first finger
DrawNewRectangle(lCanvas, lTouchPoint.Position, lTouchPoint.TouchDevice.Id);
return;
} //
示例15: OnTouchMove
private void OnTouchMove(object sender, TouchEventArgs e)
{
if (!_AlreadySwiped)
{
var touch = e.GetTouchPoint(_ParentControl);
//right now a swipe is 200 pixels
//Swipe Left
if (_TouchStart != null && touch.Position.X > (_TouchStart.Position.X + 200))
{
if (OnSwipeLeft != null)
OnSwipeLeft(sender, e);
_AlreadySwiped = true;
StartTimer();
}
//Swipe Right
if (_TouchStart != null && touch.Position.X < (_TouchStart.Position.X - 200))
{
if (OnSwipeRight != null)
OnSwipeRight(sender, e);
_AlreadySwiped = true;
StartTimer();
}
}
//e.Handled = true;
}