windows-phone-7 - WP7 Facebook OAUTH浏览器控件上的“Don't允许”和“Allow”按钮始终在屏幕外

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

我已经开发了使用Facebook C# SDK,使用OAUTH和Web浏览器控件的WP7客户端。

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

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

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

有没有人找到解决方法?

最佳答案

我发现的解决方案是使用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
    }
}

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

关于windows-phone-7 - WP7 Facebook OAUTH浏览器控件上的“Don't允许”和“Allow”按钮始终在屏幕外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6272366/

相关文章:

c# - 将图像分割成几 block silverlight Windows Phone

silverlight - 数据绑定(bind)和 INotifyPropertyChanged 不起作用

silverlight - Windows Phone 7 入门

windows-phone-7 - Windows Phone 的单元测试状态

c# - 使用 Graph API 发布到 Facebook 页面 - 返回 ID 但不显示

C# Facebook SDK 动态数据转换

c# - 如何在 C# 中找到 Windows Phone7 应用程序的应用程序 contentIdentifier?

facebook 注销 API - 为什么下一步?

facebook-c#-sdk - Facebook 网络表单应用程序获取 app_data 查询字符串

c# - 哪个 Facebook C# SDK?官方(github)还是非官方(codeplex)?