public FooApplication(IFoo foopage, HistoryScope<ApplicationState> fooscope) { // init state! this will be sent to server at every new web call. this.state = fooscope.state; FlashTitle(); // how do we know when we need to shut down? // if we go back in time we need to shut down // should we have a Dispose method? // can we await on scope? Native.document.title = state.title; Native.document.body.style.borderLeft = "1em red solid"; foopage.output.innerText = new { this.state.title }.ToString(); foopage.EnterData.WhenClicked( async delegate { this.reason = "foopage.EnterData.WhenClicked"; // what if server has gone away? var newscope = await this.DoEnterData(); newscope_data = newscope.state.data; // DataTable is not correctly stored in HistoryAPI yet newscope.state.data = null; // ready to transition to a new Native.window.history.pushState( newscope.state, async scope => { Console.WriteLine("at DoEnterData"); scope.state.data = newscope_data; newscope_data = null; // now what? // we get here either by a click or a reload #region do // we need a copy of childnodes! var oldpagenodes = Native.document.body.childNodes.ToArray(); var goopage = new Goo(); Native.document.body.Clear(); #endregion Native.document.body.appendChild( goopage.body.childNodes.ToArray() ); // should we automate this somehow? var gooapp = new GooApplication(goopage, scope); // we only use the data once? //scope.state.data = null; await scope; Native.document.body.Clear(); #region undo Native.document.body.appendChild( oldpagenodes ); // http://connect.microsoft.com/VisualStudio/feedback/details/534869/arrow-keys-stop-working-in-editor // are we sure the state has been restored? // show our intent to reload IStyleSheet.Default["title"].style.color = "red"; // wait for any animation, sound to complete, then wipe // what if we move in time during the delay? await Task.Delay(500); Native.document.location.reload(); #endregion } ); } ); //Native.document.body.style[await scope].borderLeft = "0.3em yellow solid"; fooscope.With( async delegate { await fooscope; // time to undo Native.document.body.style.borderLeft = "0.3em yellow solid"; } ); }
public FooApplication(IFoo foopage, HistoryScope <ApplicationState> fooscope) { // init state! this will be sent to server at every new web call. this.state = fooscope.state; FlashTitle(); // how do we know when we need to shut down? // if we go back in time we need to shut down // should we have a Dispose method? // can we await on scope? Native.document.title = state.title; Native.document.body.style.borderLeft = "1em red solid"; foopage.output.innerText = new { this.state.title }.ToString(); foopage.EnterData.WhenClicked( async delegate { this.reason = "foopage.EnterData.WhenClicked"; // what if server has gone away? var newscope = await this.DoEnterData(); newscope_data = newscope.state.data; // DataTable is not correctly stored in HistoryAPI yet newscope.state.data = null; // ready to transition to a new Native.window.history.pushState( newscope.state, async scope => { Console.WriteLine("at DoEnterData"); scope.state.data = newscope_data; newscope_data = null; // now what? // we get here either by a click or a reload #region do // we need a copy of childnodes! var oldpagenodes = Native.document.body.childNodes.ToArray(); var goopage = new Goo(); Native.document.body.Clear(); #endregion Native.document.body.appendChild( goopage.body.childNodes.ToArray() ); // should we automate this somehow? var gooapp = new GooApplication(goopage, scope); // we only use the data once? //scope.state.data = null; await scope; Native.document.body.Clear(); #region undo Native.document.body.appendChild( oldpagenodes ); // http://connect.microsoft.com/VisualStudio/feedback/details/534869/arrow-keys-stop-working-in-editor // are we sure the state has been restored? // show our intent to reload IStyleSheet.Default["title"].style.color = "red"; // wait for any animation, sound to complete, then wipe // what if we move in time during the delay? await Task.Delay(500); Native.document.location.reload(); #endregion } ); } ); //Native.document.body.style[await scope].borderLeft = "0.3em yellow solid"; fooscope.With( async delegate { await fooscope; // time to undo Native.document.body.style.borderLeft = "0.3em yellow solid"; } ); }