public void setInit(Canvas _main, Window target, FrameworkControl fw, SmartArea s) { main = _main; window = target; framework = fw; _sArea = s; }
private void BeginInvokeRemove(SmartArea s, string _ip) { if (s.Dispatcher.CheckAccess()) removeSmartArea(_ip); else s.Dispatcher.BeginInvoke(new removeSmartAreaDelegate(removeSmartArea), _ip); }
private void BeginInvokeCreate(SmartArea s, string _ip, PointF pt, double angle) { if (s.Dispatcher.CheckAccess()) createSmartArea(_ip, pt, angle); else s.Dispatcher.BeginInvoke(new createSmartAreaDelegate(createSmartArea), _ip, pt, angle); }
public override void TouchUp(PointF p) { //Console.WriteLine("touchUp"); SmartArea s = Source as SmartArea; if (s == null) { return; } s.grid1_TouchUp(p); base.TouchUp(p); }
public override void Drag(float x, float y) { //Console.WriteLine("Drag"); SmartArea s = Source as SmartArea; if (s == null) { return; } s.grid1_TouchMove(x, y); base.Drag(x, y); }
public override void Tap(PointF p) { //Console.WriteLine("Tab"); SmartArea s = Source as SmartArea; if (s == null) { return; } RoutedEventArgs e = new RoutedEventArgs(); e.RoutedEvent = Button.ClickEvent; System.Windows.Point coordinates1 = s.bt1.TransformToAncestor(s).Transform(new System.Windows.Point(0, 0)); System.Windows.Point coordinates2 = s.bt2.TransformToAncestor(s).Transform(new System.Windows.Point(0, 0)); System.Windows.Point coordinates3 = s.bt3.TransformToAncestor(s).Transform(new System.Windows.Point(0, 0)); System.Windows.Point coordinates4 = s.bt4.TransformToAncestor(s).Transform(new System.Windows.Point(0, 0)); Rectangle r1 = new Rectangle((int)coordinates1.X, (int)coordinates1.Y, (int)s.bt1.Width, (int)s.bt1.Height); Rectangle r2 = new Rectangle((int)coordinates2.X, (int)coordinates2.Y, (int)s.bt2.Width, (int)s.bt2.Height); Rectangle r3 = new Rectangle((int)coordinates3.X, (int)coordinates3.Y, (int)s.bt3.Width, (int)s.bt3.Height); Rectangle r4 = new Rectangle((int)coordinates4.X, (int)coordinates4.Y, (int)s.bt4.Width, (int)s.bt4.Height); PointIn ptIn = new PointIn(); if (ptIn.pointInRect(r1, p, s.gridRotateTrans.Angle)) { s.bt1.RaiseEvent(e); } else if (ptIn.pointInRect(r2, p, s.gridRotateTrans.Angle)) { s.bt2.RaiseEvent(e); } else if (ptIn.pointInRect(r3, p, s.gridRotateTrans.Angle)) { s.bt3.RaiseEvent(e); } else if (ptIn.pointInRect(r4, p, s.gridRotateTrans.Angle)) { s.bt4.RaiseEvent(e); } base.Tap(p); }
private void BeginInvokeCont(SmartArea s, string _ip, float offsetX, float offsetY, double angle) { if (s.Dispatcher.CheckAccess()) findContainer(_ip, offsetX, offsetY, angle); else s.Dispatcher.BeginInvoke(new MTContDelegate(findContainer), _ip, offsetX, offsetY, angle); }
public void createSmartArea(string _ip, PointF pt, double angle) { //Init SmartArea Control SmartArea smartArea = new SmartArea(); ElementProperties prop = new ElementProperties(); prop.ElementSupport.AddSupport(TouchFramework.TouchAction.Drag); prop.ElementSupport.AddSupport(TouchFramework.TouchAction.Tap); MTSmoothContainer smartAreaCont = new MTSmoothContainer(smartArea, main, prop); framework.RegisterElement(smartAreaCont); smartArea.Tag = _ip; smartAreaCont.userIP = _ip; main.Children.Add(smartArea); smartArea.setInit(main, window, framework, smartAreaCont, _ip, angle); smartAreaCont.SetPosition(pt.X, pt.Y, angle, 1.0); SingleToneTrans.getInstance().addToArea(smartArea); SingleToneTrans.getInstance().addToCont(smartAreaCont); }