Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在windows phone 8中的单个项目视图中创建列表框视图?使用来自url的异步JSON_C#_Json_Windows Phone 8_Listbox - Fatal编程技术网

C# 如何在windows phone 8中的单个项目视图中创建列表框视图?使用来自url的异步JSON

C# 如何在windows phone 8中的单个项目视图中创建列表框视图?使用来自url的异步JSON,c#,json,windows-phone-8,listbox,C#,Json,Windows Phone 8,Listbox,我想为Json表单和url创建一个列表框 我从URL获取Json数据。我已经解析了JSON数据。。 我的JSON数据在中包含一个产品基础流程,但我通过解析JSON数据 就这样,我学习了很多教程。。但我的JSON数据可能会生成非常量的信息,例如,我已经解析了有关网站的数据。。现在我想解析电影或产品的数据,但每次我需要更改数据时,我都希望它像自动更改一样,我已经在java上完成了这个应用程序,用于解析JSON,我使用了Hashmap。。但现在在Windows中,我得到了get,set,但它只适用于一

我想为Json表单和url创建一个列表框

我从URL获取Json数据。我已经解析了JSON数据。。 我的JSON数据在中包含一个产品基础流程,但我通过解析JSON数据

就这样,我学习了很多教程。。但我的JSON数据可能会生成非常量的信息,例如,我已经解析了有关网站的数据。。现在我想解析电影或产品的数据,但每次我需要更改数据时,我都希望它像自动更改一样,我已经在java上完成了这个应用程序,用于解析JSON,我使用了Hashmap。。但现在在Windows中,我得到了get,set,但它只适用于一种产品

还有一件事。。在Android中,我做了一个列表视图,如下所示

所以我想显示包含数据的图像。。我已经在Android上做过了,但我想在Windows上做

我想要一个列表框。。就像我点击任何项目表单列表框时的图像一样。。它应该显示,并且应该有一个列表或表格。。 在Android中,我将Listview改为singleitemview,在SingleItem视图中,我添加了一个表布局

我被这些案子缠住了

  • 在android中,对于一个类文件,我可以使用许多xml文件。。但是这里Xaml是主要的,它只有一个类文件

  • 当我在android中显示数据时,这是一项异步任务。。所以现在是关于旗帜的下一个是关于其他的。。我的意思是如果 关于产品第一次它的手机,然后个人电脑

    但是如果有任何方法告诉我,在windows中是不可能的

  • 为了在Android中解析JSON,我使用JSON数组和JSON对象以及Hashmap。。 但在windows中,我发现只有GET、set

    有没有办法这样建造?我不熟悉Windows Phone

    这是我的Json数据

    {
    "returnCode": "success",
    "SPData": {
        "result": [
            {
                "sdetails": [
                    {
                        "loffers": [
                            {
                                "id": "wKugoi00AOWi",
                                "price": "129.99",
                                "seller": "Google"
                            }
                        ],
                        "O_count": 1,
                        "name": "google.com",
                        "r_count": 1,
                        "sku": "68190",
                        "url": "http://www.google.com"
                    },
                    {
                        "loffers": [
                            {
                                "id": "wAOWi",
                                "price": "129.99",
                                "seller": "Yahoo"
                            },
                            {
                                "id": "wKuAOWi",
                                "price": "130.99",
                                "seller": "Yahoo"
                            },
                            {
                                "id": "wKuWi",
                                "price": "123.99",
                                "seller": "Yahoo"
                            }
                        ],
                        "offers_count": 3,
                        "name": "yahoo.com",
                        "r_count": 1,
                        "sku": "68190",
                        "url": "http://www.yahoo.com"
                    },
                    {
                        "loffers": [
                            {
                                "id": "7e8Wk",
                                "price": "99.99",
                                "seller": "amazon.com"
                            },
                            {
                                "id": "4XUaGAi",
                                "price": "129.99",
                                "seller": "amazon.com"
                            }
                        ],
                        "offers_count": 2,
                        "name": "amazon.com",
                        "recentoffers_count": 1,
                        "sku": "7829033",
                        "url": "http://www.amazon.com"
                    }
                ],
                "model": "AAA",
                "weight": "1258.64",
                "price_currency": "USD",
                "gtins": [
                    "008411"
                ],
                "mpn": "AAAAA",
                "amam3_help": "To view additional merchants for this product, please upgrade your plan.",
                "cat_id": "20780",
                "height": "40.64",
                "description": "Immersive action and endless unready to discover a... (visit site URLs for full description)",
                "name": "xyz",
                "features": {
                    "Wi-Fi Ready": "No",
                    "BD Live": "Yes",
                    "Coaxial Digital Audio Outputs": "1 [Connections that deliver audio signals to compatible A/V components in digital form. ]",
                    "Audio Outputs": "1 [Jacks that send audio signals to another A/V component. ]"
                },
                "length": "198.12",
                "created_at": 1364157755,
                "geo": [
                    "usa"
                ],
                "width": "358.14",
                "upc": "027242858411",
                "ean": "0027242858411",
                "category": "Blu-ray Players",
                "price": "139.99",
                "updated_at": 1390272838,
                "manufacturer": "Sony",
                "images_total": 1,
                "images": [
                    "http://cpcstrategy.com/wp-content/uploads/2013/06/Google-logo-retargeting.jpg"
                ],
                "brand": "Google",
                "aam3_id": "4FyI",
                "offers_total": 404
            }
        ],
        "total_results_count": 3,
        "results_count": 3,
        "code": "OK",
        "offset": 0
    }
    }
    
    因此,如果我遵循Get和set,功能可能总是不一样。。所以在那里我会得到错误。。 在安卓系统中,我通过这种方式进行解析

      JSONObject json_data = JSONfunctions.getJSONfromURL(url);
            JSONObject json_query = json_data.getJSONObject("query");           
            JSONArray json_result = json_query.getJSONArray("result");
            for (int i = 0; i < json_results.length(); i++) {
                HashMap<String, String> map = new HashMap<String, String>();
                JSONObject c = json_result.getJSONObject(i);
                .
                .
                JSONArray flag = c.getJSONArray("flag");
                for(int s=0;s<flag.length();s++)
                {
                    System.out.println("URL"+flag.getString(s));
                    map.put("flag", flag.getString(s));
                 }
                  .
                  .                                 
                  JSONArray json_result_site =c.getJSONArray("site");
                    for (int j = 0; j < c.length(); j++) {
                        if (j < json_result_site.length()) {
                            JSONObject s= json_result_site.getJSONObject(j);
                            map.put("url", s.optString("url"));
                            JSONArray json_latest = s.getJSONArray("latest");
                                for (int k = 0; k < json_latest.length(); k++) {
                                     JSONObject e = json_latest.getJSONObject(k);
                                      map.put("id", e.optString("id"));
                                      map.put("date", e.optString("date")); 
                                  }  
                            }
                           }
                     }
                arraylist.add(map);
            }
        }
    
    JSONObject json_data=JSONfunctions.getJSONfromURL(url);
    JSONObject json_query=json_data.getJSONObject(“查询”);
    JSONArray json_result=json_query.getJSONArray(“结果”);
    for(int i=0;i对于(int s=0;sWindows phone,通过使用数据行,您可以轻松完成所需的操作,您只需将数据源与XAML控件绑定,然后格式化XAML控件模板。
    您在android中使用的是列表视图,但在windows Phone中,您可以LongListSelector控制
    要了解有关数据绑定和LongListSelector的更多信息,请参阅以下文章


    主列表中的子列表。可能您正在寻找一个长列表选择器

    摘自下面给出的链接

    LongListSelector实际上是一个高级列表框,支持完整数据和UI虚拟化、平面列表和分组列表。它帮助用户滚动数据的长列表。基本上,当用户选择一个组标题时,快速跳转网格会覆盖列表,然后从网格中选择一个项目e用户将自动重定向回选定点的长列表

    它还提出了分别高效地管理标题和内容的方法

    开始使用的最佳链接

    从JSON数据生成的c#类结构

    public class Loffer
    {
        public string id { get; set; }
        public string price { get; set; }
        public string seller { get; set; }
    }
    
    public class Sdetail
    {
        public List<Loffer> loffers { get; set; }
        public int O_count { get; set; }
        public string name { get; set; }
        public int r_count { get; set; }
        public string sku { get; set; }
        public string url { get; set; }
        public int? offers_count { get; set; }
        public int? recentoffers_count { get; set; }
    }
    
    public class Features
    {
        public string __invalid_name__Wi-Fi Ready { get; set; }
        public string __invalid_name__BD Live { get; set; }
        public string __invalid_name__Coaxial Digital Audio Outputs { get; set; }
        public string __invalid_name__Audio Outputs { get; set; }
    }
    
    public class Result
    {
        public List<Sdetail> sdetails { get; set; }
        public string model { get; set; }
        public string weight { get; set; }
        public string price_currency { get; set; }
        public List<string> gtins { get; set; }
        public string mpn { get; set; }
        public string amam3_help { get; set; }
        public string cat_id { get; set; }
        public string height { get; set; }
        public string description { get; set; }
        public string name { get; set; }
        public Features features { get; set; }
        public string length { get; set; }
        public int created_at { get; set; }
        public List<string> geo { get; set; }
        public string width { get; set; }
        public string upc { get; set; }
        public string ean { get; set; }
        public string category { get; set; }
        public string price { get; set; }
        public int updated_at { get; set; }
        public string manufacturer { get; set; }
        public int images_total { get; set; }
        public List<string> images { get; set; }
        public string brand { get; set; }
        public string aam3_id { get; set; }
        public int offers_total { get; set; }
    }
    
    public class SPData
    {
        public List<Result> result { get; set; }
        public int total_results_count { get; set; }
        public int results_count { get; set; }
        public string code { get; set; }
        public int offset { get; set; }
    }
    
    public class RootObject
    {
        public string returnCode { get; set; }
        public SPData SPData { get; set; }
    } 
    
    公共类Loffer
    {
    公共字符串id{get;set;}
    公共字符串price{get;set;}
    公共字符串卖方{get;set;}
    }
    公共类详细信息
    {
    公共列表loffers{get;set;}
    公共整数O_计数{get;set;}
    公共字符串名称{get;set;}
    公共整数r_计数{get;set;}
    公共字符串sku{get;set;}
    公共字符串url{get;set;}
    公共int?提供_count{get;set;}
    公共int?接收器计数{get;set;}
    }
    公共类功能
    {
    公共字符串\uuuu无效\uu名称\uuuu Wi-Fi就绪{get;set;}
    公共字符串uu无效u名称uu BD Live{get;set;}
    公共字符串\uuuu无效\u名称\uuuuu同轴数字音频输出{get;set;}
    公共字符串uu无效u名称uu音频输出{get;set;}
    }
    公开课成绩
    {
    公共列表详细信息{get;set;}
    公共字符串模型{get;set;}
    公共字符串权重{get;set;}
    公共字符串price_currency{get;set;}
    公共列表gtins{get;set;}
    公共字符串mpn{get;set;}
    公共字符串amam3_help{get;set;}
    公共字符串cat_id{get;set;}
    公共字符串高度{get;set;}
    公共字符串说明{get;set;}
    公共字符串名称{get;set;}
    公共要素{get;set;}
    公共字符串长度{get;set;}
    在{get;set;}处创建的公共int_
    公共列表geo{get;set;}
    公共字符串宽度{get;set;}
    公共字符串upc{get;set;}
    公共字符串ean{get;set;}
    公共字符串类别{get;set;}
    公共字符串price{get;set;}
    在{get;set;}处更新了公共int_
    公共字符串制造商{get;set;}
    公共整数图像\u总计{get;set;}
    公共列表图像{get;set;}
    公共字符串品牌{get;set;}
    公共字符串aam3_id{get;set;}
    public int提供_total{get;set;}
    }
    公共类SPData
    {
    公共列表结果{get;set;}
    公共整数总计结果计数{get;set;}
    public int results_count{get;set;}
    公共字符串代码{get;set;}
    公共整数偏移量{get;set;}
    }
    公共类根对象
    {
    公共字符串返回码{get;set;}
    公共SPData SPData{get;set;}
    } 
    
    现在,调试和检查正在获取的列表中的RootObject可以