在WP7 Facebook OAUTH浏览器控件上,“不允许”和“允许”按钮始终在屏幕外

时间:2011-06-07 22:29:54

标签: windows-phone-7 facebook-c#-sdk

我使用OAUTH和网络浏览器控件开发了一个使用Facebook C# SDK的WP7客户端。

一切正常,除了在请求用户接受/拒绝我要求的访问权限的页面上,“不允许”和“允许”按钮不在浏览器屏幕的底部,并且用户必须向下滚动才能点击它们并不明显。

我尝试过使用所有不同的display modes(触摸,wap,页面,弹出窗口),而“page”是唯一一个在同一页面上显示按钮的页面,但字体很小。我也为浏览器控件尝试了不同的大小。

SDK中的示例具有相同的行为。

有没有人找到解决办法?

2 个答案:

答案 0 :(得分:1)

我找到的解决方案是使用Javascript来更改元素的CSS属性:

private void FacebookLoginBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
        // check for when this approve page has been navigated to
        if (FacebookLoginBrowser.Source.AbsolutePath == "/connect/uiserver.php")
        {
            showBrowser();
            // do the script injection on the LoadCompleted event - doing it here will appear to work when you have a fast connection, but almost certainly fails over 3G because the elements aren't ready in time to be modified
            FacebookLoginBrowser.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(FacebookLoginBrowser_LoadCompleted);
        }
        // etc ...
}

        void FacebookLoginBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
    FacebookLoginBrowser.LoadCompleted -= FacebookLoginBrowser_LoadCompleted;
    // Facebook will likely change this and break our code soon, so make sure you  anticipates this
    try
    {
        FacebookLoginBrowser.InvokeScript("eval", "document.getElementById('platform_dialog_bottom_bar').style.position = 'relative';document.getElementById('platform_dialog_bottom_bar').style.top = '-60px';");
    }
    catch
    {
        // TODO: display instruction to scroll down if we ever end up here
    }
}

我希望有所帮助。如果您遇到问题,请随时与我联系

答案 1 :(得分:0)

我没试过这个,但是你可以使用WebBrowser控件的Scale(SizeF)方法来改变页面的缩放级别吗?