c# - The remote procedure call failed -
this first post, please easy on me :)
i doing a tutorial facebook sdk, , trying login facebook service windows phone xaml application. works fine when follow steps of tutorial, , hit login button log in, when trying automate this, error.
the code uses webauthenticationbroker, calling webauthenticationbroker.authenticateandcontinue(loginurl);
when try put code inside loaded event
private void page_loaded(object sender, routedeventargs e) { if (this.fbhelper.accesstoken == null) { webauthenticationbroker.authenticateandcontinue(loginurl); //throws error } else { getuserinfo(); } }
i following error:
the remote procedure call failed. (exception hresult: 0x800706be)
i think problem page not ready yet perform logic, don't know should put code?
it seems broker can called once window activated. i've tried should work when done this:
public mainpage() { this.initializecomponent(); window.current.activated += current_activated; } private void current_activated(object sender, windows.ui.core.windowactivatedeventargs e) { window.current.activated -= current_activated; debug.writeline("activated"); webauthenticationbroker.authenticateandcontinue(new uri("https://google.com")); }
of course needs improvements, should work. remember activeted event may called number of reasons, example after dialog shown.
Comments
Post a Comment