blob: be5c61e6e9716ce3197787b60b55e5f0f1477831 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.SimulateTouch.UI.Native;
using System.Security.Cryptography;
namespace Tango.SimulateTouch.UI
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private Line ProxyLine;
public MainWindow()
{
InitializeComponent();
WindowState = WindowState.Maximized;
TouchInjector.InitializeTouchInjection();
this.TouchDown += MainWindow_TouchDown;
this.TouchMove += MainWindow_TouchMove;
this.TouchUp += MainWindow_TouchUp;
}
private void MainWindow_TouchUp(object sender, TouchEventArgs e)
{
System.Windows.Input.TouchPoint oPos = e.GetTouchPoint(this);
this.ProxyLine.X2 = oPos.Position.X;
this.ProxyLine.Y2 = oPos.Position.Y;
this.GdRootZm.Children.Add(this.ProxyLine);
Console.WriteLine("TouchID " + e.TouchDevice.Id + " TouchUp " + oPos.Position.X + " " + oPos.Position.Y);
TouchUpTextBlock.Text = "TOUCH UP";
}
private void MainWindow_TouchMove(object sender, TouchEventArgs e)
{
System.Windows.Input.TouchPoint oPos = e.GetTouchPoint(this);
Console.WriteLine("TouchID " + e.TouchDevice.Id + " TouchMove " + oPos.Position.X + " " + oPos.Position.Y);
}
private void MainWindow_TouchDown(object sender, TouchEventArgs e)
{
System.Windows.Input.TouchPoint oPos = e.GetTouchPoint(this);
Line oLine = new Line();
oLine.Stroke = new SolidColorBrush(Colors.Red);
oLine.StrokeThickness = 2;
oLine.X1 = oPos.Position.X;
oLine.Y1 = oPos.Position.Y;
this.ProxyLine = oLine;
Console.WriteLine("TouchID " + e.TouchDevice.Id + " TouchDown " + oPos.Position.X + " " + oPos.Position.Y);
messageTextBlock.Text = "TOUCH Down";
}
private void OnButtonLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// Point targetLoc = messageTextBlock.PointToScreen(new Point(0, 0));
// HwndSource source = (HwndSource)HwndSource.FromVisual(messageTextBlock);
// IntPtr hWnd = source.Handle;
Console.WriteLine("OnButtonLeftButtonDown");
TouchSimulate ts = new TouchSimulate();
}
}
}
|