Frame(System.Windows.Controls.Frame)导航事件仅触发一次

时间:2011-09-14 10:28:22

标签: c# .net wpf facebook facebook-c#-sdk

我正在使用Frame进行fb登录,当我进入登录页面时,事件会按预期触发,但在此之后,即使我登录并转发,我也不会再收到任何事件。

这是我的代码: XAML:

 <Frame x:Name="webFrame" Canvas.Left="12" Canvas.Top="72" Height="235" Width="542"
           Navigated="frame_Navigated" Navigating="frame_Navigating"
           >

C#:

 webFrame.Source = loginUrl; 

 private void frame_Navigated(object sender, NavigationEventArgs e)
    {
        FacebookOAuthResult result;
        if (FacebookOAuthResult.TryParse(e.Uri, out result))
        {
            if (result.IsSuccess)
            {
                var accesstoken = result.AccessToken;
            }
            else
            {
                var errorDescription = result.ErrorDescription;
                var errorReason = result.ErrorReason;
            }
        }
    }

    private void frame_Navigating(object sender, NavigatingCancelEventArgs e)
    {
        FacebookOAuthResult result;
        if (FacebookOAuthResult.TryParse(e.Uri, out result))
        {
            if (result.IsSuccess)
            {
                var accesstoken = result.AccessToken;
            }
            else
            {
                var errorDescription = result.ErrorDescription;
                var errorReason = result.ErrorReason;
            }
        }
    }

解决方案: WPF WebBrowser - detecting redirects?

0 个答案:

没有答案