c# - navigation between page windows phone without reloading -
private void btn_friends_pressed(object sender, routedeventargs e) { navigationservice.navigate(new uri("/friends.xaml", urikind.relative)); }
when press button go friends page, loads many friends isolated storage.than press "back" button , go menu page, when press again button, have "operation not permitted on isolatedstoragefilestream." message. how can not reload page , keep in ram. like:
if (friends.page.isrunning==true) navigationservice.navigate("/friends.xaml"); else navigationservice.navigate(new uri("/friends.xaml", urikind.relative));
whenever navigate page, reloaded automatically. pages not kept in memory once you've navigated away them. if want store memory, , not read isolated storage each time, can create static
class contains static list
stores friends. once you've loaded friends, depending on type, can add list. whenever need access them, call static list
. example, in solution, create new class:
using ... //your using directives namespace myapp //your project namespace { public static class friendsstorage //rename `friendsstorage` whatever want { public static list<friends> listoffriends = new list<friends>(); //your list } }
to set it, can load information isolatedstorage , add list:
foreach(friend f in friends) friendsstorage.listoffriends.add(f);
whenever need query friends list can call this:
var friendlist = friendsstorage.listoffriends;
even if use above method, should try , fix error you're getting. can post isolated storage code?
Comments
Post a Comment