/// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IDefaultPage page) { // Initialize MySprite1 var s = new MySprite1(); s.AttachSpriteTo(page.Content); // Send data from JavaScript to the server tier service.WebMethod2( "", list => { var ChannelContainer = page.Content; Action <string> ChannelSelected = channel => { page.Header.innerHTML = "JustinTV - " + channel; s.api_play_live(channel); }; Foo.ListElements(list, ChannelContainer, ChannelSelected); } ); }
/// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IDefaultPage page) { //new oak().ToBackground(page.PageContainer.style); // Initialize MySprite1 var m = new MySprite1(); //m.ToTransparentSprite(); m.ToHTMLElement().With( e => { e.style.position = IStyle.PositionEnum.absolute; e.style.left = "0"; e.style.top = "0"; e.setAttribute("width", "100%"); e.setAttribute("height", "100%"); } ); m.AttachSpriteTo(page.Content); @"Hello world".ToDocumentTitle(); new ApplicationWebService().WebMethod2( new XElement(@"Document", new object[] { new XElement(@"Data", new object[] { @"Hello world" } ), new XElement(@"Client", new object[] { @"Unchanged text" } ) } ), delegate(XElement doc) { doc.Element(@"Data").Value.ToDocumentTitle(); } ); }
/// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IDefaultPage page) { // Initialize MySprite1 var s = new MySprite1(); s.Ready += delegate { new IHTMLDiv { innerText = "Ready!" }.AttachTo(page.Content); }; s.VideoPlayerReady += delegate { new IHTMLDiv { innerText = "VideoPlayerReady!" }.AttachTo(page.Content); }; s.Inspecting += doc => { new IHTMLPre { innerText = doc.ToString() }.AttachTo(page.Content); }; new IHTMLButton("Load from textbox").AttachTo(page.Content).With( btn => { btn.onclick += delegate { s.LoadTargetContent(page.SWFAddress.value); }; } ); new IHTMLButton("LoadOdoSketch").AttachTo(page.Content).With( btn => { btn.onclick += delegate { s.LoadTargetContent(); }; } ); new IHTMLButton("Load youtube player").AttachTo(page.Content).With(btn => { btn.onclick += delegate { s.LoadTargetContent( "http://www.youtube.com/apiplayer?version=3" ); }; }); new IHTMLButton("loadVideoById").AttachTo(page.Content).With(btn => { btn.onclick += delegate { s.loadVideoById(); }; }); new IHTMLButton("load youtube swf").AttachTo(page.Content).With(btn => { btn.onclick += delegate { s.LoadTargetContent( "http://www.youtube.com/v/eK9lNtxH8-E?version=3" ); }; }); var LoadVideo2 = new IHTMLButton("load playlist swf").AttachTo(page.Content); LoadVideo2.onclick += delegate { s.LoadTargetContent( "http://www.youtube.com/p/642A6CB03EFE7893?hl=en_GB&fs=1" ); }; var playVideo = new IHTMLButton("playVideo").AttachTo(page.Content); playVideo.onclick += delegate { s.playVideo(); }; var Inspect = new IHTMLButton("Inspect").AttachTo(page.Content); Inspect.onclick += delegate { s.Inspect(); }; var Clean = new IHTMLButton("Clean").AttachTo(page.Content); Clean.onclick += delegate { s.Clean(); }; s.AttachSpriteTo(page.Content); @"Hello world".ToDocumentTitle(); // Send data from JavaScript to the server tier service.WebMethod2( @"A string from JavaScript.", value => value.ToDocumentTitle() ); }