webbrowser control - Windows Phone 8 SDK - Issue with screen locking, and application starting over -


i have application webbrowser control in it. when navigate in control step away bit, come (after unlocking screen due inactivity), first/original page shows again. how can maintain state of browser?

define public property url in app.xaml.cs store url

public uri url { get; set; } 

on webbrowser_loadcompleted event: save webbrowser.source property contains current loaded url above url property of application class.

app app = application.current app;  app.url = webbrowser.source; 

on application_deactivated event (send app background), save current app's state isolatedstorage

isolatedstoragesettings settings = isolatedstoragesettings.applicationsettings; settings["url"] = url; settings.save(); 

on application_launching event (resume app), pull stored data back

isolatedstoragesettings settings = isolatedstoragesettings.applicationsettings; url currenturl; if (settings.trygetvalue("url", out currenturl))     url = (uri)settings["url"]; 

then restored url, can re-load last navigated page.

app app = application.current app; webbrowser.navigate(app.url); 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -