protected override void OnStart(AppHost host) { ImageBinder imgBinder = host.LoadImageAndBind("../Data/imgs/favorites32.png"); for (int i = 0; i < 100; ++i) { //share 1 img binder with multiple img boxes var imgBox = new CustomWidgets.ImageBox( imgBinder.Width, imgBinder.Height); imgBox.ImageBinder = imgBinder; imgBox.SetLocation(i * 32, 20); imgBox.MouseDown += (s, e) => { //test start animation int nsteps = 40; UIPlatform.RegisterTimerTask(20, timer => { imgBox.SetLocation(imgBox.Left, imgBox.Top + 10); nsteps--; if (nsteps <= 0) { timer.Remove(); } }); }; host.AddChild(imgBox); } }
protected override void OnStartDemo(SampleViewport viewport) { ImageBinder imgBinder = viewport.GetImageBinder2("../../Data/imgs/favorites32.png"); for (int i = 0; i < 100; ++i) { //share 1 img binder with multiple img boxes var imgBox = new CustomWidgets.ImageBox( imgBinder.Image.Width, imgBinder.Image.Height); imgBox.ImageBinder = imgBinder; imgBox.SetLocation(i * 32, 20); imgBox.MouseDown += (s, e) => { //test start animation int nsteps = 40; UIPlatform.RegisterTimerTask(20, timer => { imgBox.SetLocation(imgBox.Left, imgBox.Top + 10); nsteps--; if (nsteps <= 0) { timer.Remove(); } }); }; viewport.AddContent(imgBox); } }
protected override void OnStartDemo(SampleViewport viewport) { ImageBinder imgBinder = viewport.GetImageBinder2("../../Data/imgs/favorites32.png"); for (int i = 0; i < 100; ++i) { //share 1 img binder with multiple img boxes var imgBox = new CustomWidgets.ImageBox(imgBinder.Image.Width, imgBinder.Image.Height); imgBox.ImageBinder = imgBinder; imgBox.SetLocation(i * 10, i * 10); viewport.AddContent(imgBox); } }