/// <summary> /// Constructor for MTElementC ontainer. /// </summary> /// <param name="createFrom">The FrameworkElement this container is going to store touches for and manipulate.</param> public MTSmoothContainer(FrameworkElement createFrom, Panel cont, ElementProperties props) : base(createFrom, cont, props) { this.ScaleFilter.Reset(1.0f, 1.0f); this.Delay = 100; this.DampingDelay = 1200; }
/// <summary> /// Constructor for MTElementContainer. /// </summary> /// <param name="createFrom">The FrameworkElement this container is going to store touches for and manipulate.</param> public MTContainer(FrameworkElement createFrom, Panel topCont, ElementProperties props) { if (createFrom == null) { throw new ArgumentNullException("createFrom must not be null"); } WorkingObject = createFrom; handler = ElementHandler.GetHandler(this.WorkingObject, this.TopContainer); ElementDef = props; this.TopContainer = topCont; }
/// <summary> /// Constructor for MTElementContainer. /// </summary> /// <param name="createFrom">The FrameworkElement this container is going to store touches for and manipulate.</param> public MTDirectContainer(FrameworkElement createFrom, Panel cont, ElementProperties props) : base(createFrom, cont, props) { }
/// <summary> /// Constructor for MTElementContainer. /// </summary> /// <param name="createFrom">The FrameworkElement this container is going to store touches for and manipulate.</param> public MTContainer(FrameworkElement createFrom, Panel topCont, ElementProperties props) { if (createFrom == null) throw new ArgumentNullException("createFrom must not be null"); WorkingObject = createFrom; handler = ElementHandler.GetHandler(this.WorkingObject, this.TopContainer); ElementDef = props; this.TopContainer = topCont; }
/// <summary> /// Creates a new video and adds it as a touch managed object to the MTElementDictionary withing the framework. /// Randomly positions and rotates the photo within the screen area. /// </summary> /// <param name="filePath">Full path to the image.</param> void AddVideo(string filePath) { VideoControl p = new VideoControl(); System.Windows.Shapes.Rectangle i = p.SetVideo(filePath); ElementProperties prop = new ElementProperties(); prop.ElementSupport.AddSupportForAll(); MTContainer cont = new MTSmoothContainer(p, canvas1, prop); framework.RegisterElement(cont); canvas1.Children.Add(p); cont.MaxX = (int)(this.screen_width); cont.MaxY = (int)(this.screen_height); cont.MinX = (int)(this.screen_width / 10); cont.MinY = (int)(this.screen_height / 10); }
void AddFeed(string url) { ElementProperties prop = new ElementProperties(); prop.ElementSupport.AddSupportForAll(); RssList r = new RssList(); r.Read(url); MTContainer cont = new MTSmoothContainer(r, canvas1, prop); framework.RegisterElement(cont); canvas1.Children.Add(r); cont.MaxX = (int)(this.screen_width); cont.MaxY = (int)(this.screen_height); cont.MinX = (int)(this.screen_width / 10); cont.MinY = (int)(this.screen_height / 10); }
/// <summary> /// Creates a new photo and adds it as a touch managed object to the MTElementDictionary withing the framework. /// Randomly positions and rotates the photo within the screen area. /// </summary> /// <param name="filePath">Full path to the image.</param> void AddPhoto(string filePath) { BitmapImage bi = new BitmapImage(new Uri(filePath)); Photo p = new Photo(); System.Windows.Controls.Image i = p.SetPicture(filePath); RenderOptions.SetBitmapScalingMode(i, BitmapScalingMode.HighQuality); ElementProperties prop = new ElementProperties(); prop.ElementSupport.AddSupportForAll(); MTContainer cont = new MTSmoothContainer(p, canvas1, prop); framework.RegisterElement(cont); canvas1.Children.Add(p); cont.MaxX = (int)(this.screen_width); cont.MaxY = (int)(this.screen_height); cont.MinX = (int)(this.screen_width / 10); cont.MinY = (int)(this.screen_height / 10); }
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); smartAreaCont = new MTSmoothContainer(smartArea, MainElement, prop); framework.RegisterElement(smartAreaCont); smartArea.Tag = _ip; smartAreaCont.userIP = _ip; MainElement.Children.Add(smartArea); smartArea.setInit(MainElement, window, framework, smartAreaCont, _ip, angle); smartAreaCont.SetPosition(pt.X, pt.Y, angle, 1.0); SingleToneTrans.getInstance().addToArea(smartArea); SingleToneTrans.getInstance().addToCont(smartAreaCont); _smartArea = smartArea; }
void addControl() { //Center Menu ElementProperties prop_c = new ElementProperties(); prop_c.ElementSupport.AddSupport(TouchFramework.TouchAction.Tap); CenterMenuCont = new MTSmoothContainer(center_menu, MainElement, prop_c); CenterMenuCont.SetPosition((float)MainElement.ActualWidth / 2, (float)MainElement.ActualHeight / 2, 0, 1.0); framework.RegisterElement(CenterMenuCont); center_menu.setInit(MainElement, window, framework, CenterMenuCont, 0); MainElement.Children.Add(center_menu); //SmartPhoneCont ElementProperties prop2 = new ElementProperties(); prop2.ElementSupport.AddSupportForAll(); smartPhoneCont = new MTSmoothContainer(smartPhone_img, MainElement, prop2); framework.RegisterElement(smartPhoneCont); //createSmartArea(); }
public IMTContainer RegisterElement(FrameworkElement control, bool supportAllTouches, TouchAction[] touchActions) { var prop = new ElementProperties(); if (!supportAllTouches) { foreach (var touchAction in touchActions) { prop.ElementSupport.AddSupport(touchAction); } } else { prop.ElementSupport.AddSupportForAll(); } var cont = new MTSmoothContainerRev(control, Canvas, prop); Framework.RegisterElement(cont); return cont; }