windows phone 7 - How to navigate to a login page instead of MainPage -
i'm in sticky position. have published app , have been receiving crash reports. of invalidoperationexception
. 19 frames in stacktrace shows internal functions , hence im not able figure out function raised it. lot of debugging, think invalidoperation exception caused way redirect navigation login page.
the basic operation this. if user has set password, navigates password page else mainpage. code follows
app() { // usual code rootframe.navigating += new navigatingcanceleventhandler(rootframe_navigating); } void rootframe_navigating(object sender, navigatingcanceleventargs e) { if (e.uri.tostring().contains("/rootpage.xaml") != true) return; cyclemanager pcycman = cyclemanager.instance; e.cancel = true; rootframe.dispatcher.begininvoke(delegate { if (pcycman.getpasswordenabled()) rootframe.navigate(new uri("/passwordpage.xaml", urikind.relative)); else rootframe.navigate(new uri("/mainpage.xaml", urikind.relative)); }); }
the rootpage mentioned above defined in <app>
tag in wmappmanifest.xml
<tasks> <defaulttask name="_default" navigationpage="rootpage.xaml" /> </tasks>
when debugged above codes, found same call stack stacktrace. tell me if correct method of navigating page other mainpage? have included stacktrace below
"frame image function offset 0 coredll.dll xxx_raiseexception 19 1 mscoree3_7.dll 436488 2 mscoree3_7.dll 386545 3 mscoree3_7.dll 540936 4 transitionstub 0 5 system.windows.navigation.navigationservice.navigate 1580 6 system.windows.controls.frame.navigate 80 7 .__c__displayclass5._application_activated_b__3 136 8 mscoree3_7.dll 429164 9 mscoree3_7.dll 185803 10 mscoree3_7.dll 84423 11 system.reflection.runtimemethodinfo.internalinvoke 112 12 system.reflection.runtimemethodinfo.internalinvoke 1564 13 system.reflection.methodbase.invoke 104 14 system.delegate.dynamicinvokeone 564 15 system.multicastdelegate.dynamicinvokeimpl 84 16 system.windows.threading.dispatcheroperation.invoke 80 17 system.windows.threading.dispatcher.dispatch 404 18 system.windows.threading.dispatcher.oninvoke 56 19 system.windows.hosting.callbackcookie.invoke 84"
thanks patience in reading such long question.
to control navigation can achieve this.
get urimapper app.xaml resources, , assign root frame
urimapper mapper = resources["mapper"] urimapper; rootframe.urimapper = mapper;
and update mapper appropriate
if (ispasswordsaved) mapper.urimappings[0].mappeduri = new uri("/passwordpage.xaml?method=urimapper", urikind.relative); else mapper.urimappings[0].mappeduri = new uri("/mainpage.xaml?method=urimapper", urikind.relative);
Comments
Post a Comment