예제 #1
0
        /// <summary>
        /// 获取学院列表
        /// </summary>
        private async void getAcademyInfor()
        {
            string academy = Utils.ConvertUnicodeStringToChinese(await NetWork.getHttpWebRequest("/public/academy", new List<KeyValuePair<String, String>>()));
            Debug.WriteLine("academy" + academy);

            try
            {
                if (academy != "")
                {
                    JArray academyArray = Utils.ReadJso(academy);
                    for (int i = 0; i < academyArray.Count; i++)
                    {
                        JObject jobj = (JObject)academyArray[i];
                        var b = new AcademyList
                        {
                            Id = Convert.ToInt32(jobj["id"].ToString()),
                            Name = jobj["name"].ToString()
                        };
                        acalist.Add(b);
                    }
                    appSetting.Values["academy_json"] = academy;
                }
                else
                    getAcademyInfor();
            }
            catch (Exception)
            {
                Debug.WriteLine("主页,获取学院异常");
                getAcademyInfor();
            }
        }
 private void getAca()
 {
     string academy = appSetting.Values["academy_json"].ToString();
     Debug.WriteLine("academy" + academy);
     if (academy != "")
     {
         JArray academyArray = Utils.ReadJso(academy);
         for (int i = 0; i < academyArray.Count; i++)
         {
             JObject jobj = (JObject)academyArray[i];
             var b = new AcademyList
             {
                 Id = Convert.ToInt32(jobj["id"].ToString()),
                 Name = jobj["name"].ToString()
             };
             acalist.Add(b);
         }
         Acabox.ItemsSource = acalist;
     }
 }