【问题标题】:Emulators Providing Different Results提供不同结果的仿真器
【发布时间】:2013-03-29 21:32:31
【问题描述】:

我正在 Windows Phone 上开发一个应用程序,版本 7.1 设置为我的目标版本。我遇到的问题是我的页面中的一个列表视图拒绝显示。

我已经调试以确保列表被解析为其中的内容。当我使用 Windows 8 模拟器时,该应用程序也运行良好。但是,在应用程序的其他页面中填充其他列表视图时使用的相同技术在所有模拟器上都可以正常工作,该模拟器来自这个不显示的单个页面。

我什至尝试设置绑定堆栈面板的颜色以查看它是否会显示,它会显示但没有任何内容。 我真的很困惑,我的代码非常完美。我想知道是否有人在使用 windows phone 模拟器之前遇到过这个问题?

private void countdownClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
    {
        HtmlDocument doc = new HtmlDocument();            
        if (e.Error != null)
        {
            //MessageBox.Show(e.Error.InnerException.Message + "\n Ensure You Have A Working Internet Connection");                
            return;
        }
        doc.LoadHtml(e.Result);
        String noCountdown = "<div><span>Sorry no buses are expected within 30 minutes of this stop.  Please try again later or go to www.tfl.gov.uk</span></div>";

        if (e.Result.Contains(noCountdown))
        {
            //No Buses Expected;
            return;
        }
        else
        {
            HtmlNode stopCountdownNode;
            try
            {
                stopCountdownNode = doc.DocumentNode.SelectSingleNode("//*[contains(@id, 'stopBoard')]").SelectSingleNode("tbody");
            }
            catch (Exception)
            {
                MessageBox.Show("Error Responce From Server");
                return;
            }

            if (stopCountdownNode != null)
            {
                HtmlNodeCollection countdownNodeList = stopCountdownNode.SelectNodes("tr");
                CountDownListBox.ItemsSource = GetCountdownList(countdownNodeList);
            } 
        }
    }

    private ObservableCollection<BusCountdown> GetCountdownList(HtmlNodeCollection countdownNodeList)
    {
        ObservableCollection<BusCountdown> countdownList = new ObservableCollection<BusCountdown>();
        foreach (HtmlNode countDown in countdownNodeList)
        {
            String busName = HttpUtility.HtmlDecode(countDown.SelectSingleNode("*[contains(@class, 'resRoute')]").InnerHtml);
            String busDestination = HttpUtility.HtmlDecode(countDown.SelectSingleNode("*[contains(@class, 'resDir')]").InnerHtml);
            String countDownTime = HttpUtility.HtmlDecode(countDown.SelectSingleNode("*[contains(@class, 'resDue')]").InnerHtml);
            countdownList.Add(new BusCountdown(busName, busDestination, countDownTime));       
        }                                                    
        return countdownList;
    }

    public string GetRandomSlash()
    {
        Random r = new Random();
        String slash = "";
        int rand = r.Next(1, 20);
        for (int i = 0; i < rand; i++)
        {
            slash += "/";
        }
        return slash;
    }

【问题讨论】:

    标签: windows-phone-7 listview data-binding windows-phone-7-emulator windows-phone-8-emulator


    【解决方案1】:

    尝试设置用于绑定到公共的类访问说明符并试一试。让我知道它是否有效。

    例如:

    public class Bindingclass
    {
    public string Name{get;set;}
    }
    

    【讨论】:

    • 所有绑定属性都已经公开,否则它们将无法工作。
    • 属性默认是公开的。如果不是,它不会在任何地方工作......你已经在一个类中定义了属性,对吗?将该课程设为公开...\
    • 哦,是的,Max 现在可以工作了。你是对的,我以前的所有课程都有公共 rfix,除了这个。为什么?我不知道大声笑。谢谢
    【解决方案2】:
    1. 尝试使用 Expression Blend,同时删除之前的解决方案文件并构建新的解决方案
    2. 同时为所有页面正确设置 build action 属性。
    3. 将您的 SDK 更新到 7.8 版本。您将获得多种模拟器选择 - Emulator 7.1 (256 MB)、Emulator 7.1 (512 MB)、Emulator 7.8 (256 MB)、Emulator 7.8 (512 MB)。在所有这些版本上测试它并检查每种模拟器类型的输出。

    我希望其中至少一项可以帮助您让事情顺利进行。让我们知道。

    【讨论】:

    • 我正在使用 windows 8 sdk 不能再高了,它在所有模拟器上都可以正常工作,只是一页在 win 7.1 模拟器上不起作用。有趣的是,在同一个 7.1 模拟器上的上一页使用了相同的显示技术,并且运行良好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-01
    • 2020-08-20
    相关资源
    最近更新 更多