コード例 #1
0
 private async void getGradeInfor()
 {
     //年级
     string grade = "";
     if (appSetting.Values.ContainsKey("grade_json"))
         grade = appSetting.Values["grade_json"].ToString();
     if (grade != "")
     {
         JArray gradeArray = Utils.ReadJso(grade);
         for (int i = 0; i < gradeArray.Count; i++)
         {
             JObject jobj = (JObject)gradeArray[i];
             var b = new GradeList
             {
                 Id = Convert.ToInt32(jobj["id"].ToString()),
                 Name = jobj["name"].ToString()
             };
             gradelist.Add(b);
         }
     }
     else
     {
         grade = Utils.ConvertUnicodeStringToChinese(await NetWork.getHttpWebRequest("/public/grade", new List<KeyValuePair<String, String>>()));
         getGradeInfor();
     }
 }
コード例 #2
0
 /// <summary>
 /// 获取年级列表
 /// </summary>
 private async void getGradeInfor()
 {
     //年级
     try
     {
         string grade = Utils.ConvertUnicodeStringToChinese(await NetWork.getHttpWebRequest("/public/grade", new List<KeyValuePair<String, String>>()));
         Debug.WriteLine("grade" + grade);
         if (grade != "")
         {
             JArray gradeArray = Utils.ReadJso(grade);
             for (int i = 0; i < gradeArray.Count; i++)
             {
                 JObject jobj = (JObject)gradeArray[i];
                 var b = new GradeList
                 {
                     Id = Convert.ToInt32(jobj["id"].ToString()),
                     Name = jobj["name"].ToString()
                 };
                 gradelist.Add(b);
             }
             appSetting.Values["grade_json"] = grade;
         }
         else
             getGradeInfor();
     }
     catch (Exception)
     {
         Debug.WriteLine("主页,获取年级异常");
         getGradeInfor();
     }
 }
コード例 #3
0
 private void getGradeInfor()
 {
     //年级
     string grade = appSetting.Values["grade_json"].ToString();
     if (grade != "")
     {
         JArray gradeArray = Utils.ReadJso(grade);
         for (int i = 0; i < gradeArray.Count; i++)
         {
             JObject jobj = (JObject)gradeArray[i];
             var b = new GradeList
             {
                 Id = Convert.ToInt32(jobj["id"].ToString()),
                 Name = jobj["name"].ToString()
             };
             gradelist.Add(b);
         }
     }
     Grbox.ItemsSource = gradelist;
 }