当前位置: 首页>>代码示例>>C#>>正文


C# JArray.ToObject方法代码示例

本文整理汇总了C#中Newtonsoft.Json.Linq.JArray.ToObject方法的典型用法代码示例。如果您正苦于以下问题:C# JArray.ToObject方法的具体用法?C# JArray.ToObject怎么用?C# JArray.ToObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Newtonsoft.Json.Linq.JArray的用法示例。


在下文中一共展示了JArray.ToObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnTraceComplete

 public void OnTraceComplete(JArray myArray)
 {            
     // HACK: not sure why we have to explicitly cast the argument from a JArray, I thought Signalr should do this for us
     var e = myArray.ToObject<DaxStudioTraceEventArgs[]>();
     
     if (TraceCompleted != null)
     { TraceCompleted(this, e); }
 }
开发者ID:votrongdao,项目名称:DaxStudio,代码行数:8,代码来源:RemoteQueryTraceEngine.cs

示例2: DeserializeData

        private static IList<object> DeserializeData(JArray data)
        {
            var list = data.ToObject<List<object>>();

            for (int i = 0; i < list.Count; i++)
            {
                var value = list[i];

                if (value is JObject)
                    list[i] = DeserializeData(value as JObject);

                if (value is JArray)
                    list[i] = DeserializeData(value as JArray);
            }
            return list;
        }
开发者ID:cmdrmcdonald,项目名称:EliteDangerousDataProvider,代码行数:16,代码来源:Deserializtion.cs

示例3: GetIndexes

        private static IDictionary<WeatherChar, IDictionary<int, int>> GetIndexes(
            JArray jHeaders, IEnumerable<WeatherChar> charList, IEnumerable<int> postCodeList)
        {
            IDictionary<WeatherChar, IDictionary<int, int>> result =
                new Dictionary<WeatherChar, IDictionary<int, int>>();

            var headers = jHeaders.ToObject<List<string>>();
            foreach (WeatherChar ch in charList)
            {
                IDictionary<int, int> chResult = new Dictionary<int, int>();
                foreach (int postCode in postCodeList)
                {
                    chResult.Add(postCode,
                        headers.FindIndex(s => s.Contains(ch.ToString()) && s.Contains(postCode.ToString())));
                }
                result.Add(ch, chResult);
            }

            return result;
        }
开发者ID:kaplanov,项目名称:FlowOffSolution,代码行数:20,代码来源:WeatherLoader.cs

示例4: GetStoresOfOwner

 public async void GetStoresOfOwner()
 {
     try
     {
         if (Utilities.Helpers.NetworkHelper.Instance.HasInternetConnection)
         {
             JArray result = new JArray();
             int ownerId = MediateClass.UserVM.UserInfo.UserId;
             IDictionary<string, string> param = new Dictionary<string, string>
             {
                 {"ownerId" , ownerId.ToString()}
             };
             var response = await App.MobileService.InvokeApiAsync("Stores", HttpMethod.Get, param);
             result = JArray.Parse(response.ToString());
             StoresOfOwner = result.ToObject<ObservableCollection<Kios>>();
         }
     }
     catch (Exception ex)
     {
         await new MessageDialog(ex.Message.ToString(), "Get Store").ShowAsync();
     }
 }
开发者ID:monpham2310,项目名称:PayBay,代码行数:22,代码来源:KiosViewModel.cs

示例5: GetSaleOfOwner

        public async void GetSaleOfOwner(TYPEGET typeGet, TYPE type = TYPE.OLD)
        {
            try
            {
                JArray result = new JArray();
                int lastId = -1;
                if (typeGet == TYPEGET.MORE)
                {
                    if (SaleOfStoreOwner.Count != 0)
                    {
                        if (type == TYPE.OLD)
                            lastId = SaleOfStoreOwner.Min(x => x.SaleId);
                        else
                            lastId = SaleOfStoreOwner.Max(x => x.SaleId);
                    }
                }
                int ownerId = MediateClass.UserVM.UserInfo.UserId;
                SaleItem saleInfo = new SaleItem(lastId, ownerId, type);
                JToken body = JToken.FromObject(saleInfo);

                if (Utilities.Helpers.NetworkHelper.Instance.HasInternetConnection)
                {
                    var response = await App.MobileService.InvokeApiAsync("SaleInfoes", body, HttpMethod.Get, null);
                    result = JArray.Parse(response.ToString());
                    ObservableCollection<AdvertiseItem> more = result.ToObject<ObservableCollection<AdvertiseItem>>();
                    if (typeGet == TYPEGET.START)
                    {
                        SaleOfStoreOwner = more;
                    }
                    else
                    {
                        if (type == TYPE.OLD)
                        {
                            foreach (var item in more)
                            {
                                SaleOfStoreOwner.Add(item);
                            }
                        }
                        else
                        {
                            for (int i = 0; i < more.Count; i++)
                            {
                                SaleOfStoreOwner.Insert(i, more[i]);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                await new MessageDialog(ex.Message.ToString(), "Load Sale").ShowAsync();
            }
        }
开发者ID:monpham2310,项目名称:PayBay,代码行数:53,代码来源:AdvertiseViewModel.cs

示例6: GetNewProductList

        public async void GetNewProductList(TYPEGET typeGet, TYPE type = TYPE.OLD)
        {
            try
            {
                JArray result = new JArray();
                int lastId = -1;
                if (typeGet == TYPEGET.MORE)
                {
                    if (NewProductList.Count != 0)
                    {
                        if (type == TYPE.OLD)
                            lastId = NewProductList.Min(x => x.ProductId);
                        else
                            lastId = NewProductList.Max(x => x.ProductId);
                    }
                }

                IDictionary<string, string> param = new Dictionary<string, string>
                {
                    {"typeProduct" , type.ToString()},
                    {"productId" , lastId.ToString()}
                };

                if (Utilities.Helpers.NetworkHelper.Instance.HasInternetConnection)
                {
                    if (!isResponse)
                    {
                        isResponse = true;
                        var response = await App.MobileService.InvokeApiAsync("ProductStatistics", HttpMethod.Get, param);
                        result = JArray.Parse(response.ToString());
                        ObservableCollection<Product> more = result.ToObject<ObservableCollection<Product>>();
                        if (typeGet == TYPEGET.START)
                        {
                            NewProductList = more;
                        }
                        else
                        {
                            if (type == TYPE.OLD)
                            {
                                foreach (var item in more)
                                {
                                    NewProductList.Add(item);
                                }
                            }
                            else
                            {
                                for (int i = 0; i < more.Count; i++)
                                {
                                    NewProductList.Insert(i, more[i]);
                                }
                            }
                        }
                    }                    
                }
            }
            catch (Exception ex)
            {
                await new MessageDialog(ex.Message.ToString(), "Load Product").ShowAsync();
            }
            finally
            {
                isResponse = false;
            }
        }
开发者ID:monpham2310,项目名称:PayBay,代码行数:64,代码来源:ProductStatisticViewModel.cs

示例7: ParseResults

 public List<MovieSearchResult> ParseResults(JToken token)
 {
     var items = new JArray(token.SelectTokens("[*].results").Cast<JArray>().SelectMany(a => a));
     var result = items.ToObject<List<MovieSearchResult>>();
     return result;
 }
开发者ID:craigrs84,项目名称:PvrScraper,代码行数:6,代码来源:TmDbSync.cs

示例8: ParseMovies

 public List<Movie> ParseMovies(JToken token)
 {
     int i = 0;
     var items = new JArray(token.SelectTokens("[*].results").Cast<JArray>().SelectMany(a => a));
     var result = items.ToObject<List<Movie>>();
     result.ForEach(a => a.Source = items[i++].ToString(Formatting.Indented));
     return result;
 }
开发者ID:craigrs84,项目名称:PvrScraper,代码行数:8,代码来源:TmDbSync.cs


注:本文中的Newtonsoft.Json.Linq.JArray.ToObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。