public static void UpdateTouch(int id, double x, double y) { if (!deviceDictionary.Keys.Contains(id)) { return; //AddTouch(id, x, y); } CustomTouchDevice device = deviceDictionary[id]; if (device != null) { device.OriginalPosition = new Point(x, y); device.ReportMove(); } }
public static void RemoveTouch(int id, double?x = null, double?y = null) { if (!deviceDictionary.Keys.Contains(id)) { return; } CustomTouchDevice device = deviceDictionary[id]; if (device != null) { if (x != null && y != null) { device.OriginalPosition = new Point(x.Value, y.Value); } device.ReportUp(); device.Deactivate(); device = null; } deviceDictionary.Remove(id); }
public static void AddTouch(int id, double x, double y) { CustomTouchDevice device = null; if (!deviceDictionary.Keys.Contains(id)) { device = new CustomTouchDevice(id); deviceDictionary.Add(id, device); } else { //device = deviceDictionary[id]; return; } if (device != null) { device.OriginalPosition = new Point(x, y); device.SetActiveSource(PresentationSource.FromVisual(_root)); device.Activate(); device.ReportDown(); } }