public GetAttribute ( Newtonsoft.Json.Linq.JObject ExamDetailJObject ) : void | ||
ExamDetailJObject | Newtonsoft.Json.Linq.JObject | |
Результат | void |
private async void initExam() { string exam = ""; List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>(); var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); //await Utils.ShowSystemTrayAsync(Color.FromArgb(255, 2, 140, 253), Colors.White, text: "正在紧张安排考试...", isIndeterminate: true); //TODO:未登陆时 没有考试/补考信息 if (IsExamOrRe == 2) { //paramList.Add(new KeyValuePair<string, string>("stuNum", appSetting.Values["stuNum"].ToString())); //paramList.Add(new KeyValuePair<string, string>("idNum", appSetting.Values["idNum"].ToString())); paramList.Add(new KeyValuePair<string, string>("stuNum", credentialList[0].UserName)); paramList.Add(new KeyValuePair<string, string>("idNum", credentialList[0].Password)); exam = await NetWork.getHttpWebRequest("api/examSchedule", paramList); } else if (IsExamOrRe == 3) { #if DEBUG paramList.Add(new KeyValuePair<string, string>("stu", "2014214136")); #else //paramList.Add(new KeyValuePair<string, string>("stu", appSetting.Values["stuNum"].ToString())); paramList.Add(new KeyValuePair<string, string>("stu", credentialList[0].UserName)); #endif exam = await NetWork.getHttpWebRequest("examapi/index.php", paramList); } Debug.WriteLine("exam->" + exam); if (exam != "") { try { JObject obj = JObject.Parse(exam); if (Int32.Parse(obj["status"].ToString()) == 200) { List<ExamList> examList = new List<ExamList>(); JArray ExamListArray = Utils.ReadJso(exam); for (int i = 0; i < ExamListArray.Count; i++) { ExamList examitem = new ExamList(); examitem.GetAttribute((JObject)ExamListArray[i]); if (IsExamOrRe == 2) examitem.DateTime = "第" + examitem.Week + "周周" + examitem.Weekday + "\r\n" + examitem.Begin_time + "-" + examitem.End_time; else if (IsExamOrRe == 3) examitem.DateTime = "日期:" + examitem.Date + "\r\n" + "时间:" + examitem.Time; examList.Add(examitem); } examList = examList.OrderBy(x => x.DateTime).ToList(); var nonzeroweek = from x in examList where x.Begin_time=="待定" select x;// examList.Select(x => !x.DateTime.Contains("周0")).ToList(); var zeroweek = from x in examList where x.Begin_time!="待定" select x;// examList.Select(x => x.DateTime.Contains("周0")); List<ExamList> orderedlist = new List<ExamList>(); orderedlist.AddRange(zeroweek); orderedlist.AddRange(nonzeroweek); ObservableCollection<ExamList> move = new ObservableCollection<ExamList>(); ExamListView.ItemsSource = move; for (int i = 0; i < orderedlist.Count; i++) { move.Add(orderedlist[i]); await Task.Delay(60); } } else if (Int32.Parse(obj["status"].ToString()) == 300) { ListFailedStackPanelTextBlock.Text = "暂无数据,过几天再来看看"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Collapsed; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } else if (Int32.Parse(obj["status"].ToString()) == 0) { ListFailedStackPanelTextBlock.Text = "没补考的孩子别瞎点"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Collapsed; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } else { ListFailedStackPanelTextBlock.Text = "加载失败,点击重试"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Visible; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } } catch (Exception) { Debug.WriteLine("考试信息->解析异常"); ListFailedStackPanelTextBlock.Text = "加载失败,点击重试"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Visible; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } } else { ListFailedStackPanelTextBlock.Text = "加载失败,点击重试"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Visible; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } //StatusBar statusBar = StatusBar.GetForCurrentView(); //await statusBar.ProgressIndicator.HideAsync(); }
private async void initExam() { string exam = ""; List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>(); await Utils.ShowSystemTrayAsync(Color.FromArgb(255, 2, 140, 253), Colors.White, text: "正在紧张安排考试...", isIndeterminate: true); if (IsExamOrRe == 2) { ExamTextBlock.Text = "考试安排"; paramList.Add(new KeyValuePair<string, string>("stuNum", appSetting.Values["stuNum"].ToString())); paramList.Add(new KeyValuePair<string, string>("idNum", appSetting.Values["idNum"].ToString())); exam = await NetWork.getHttpWebRequest("api/examSchedule", paramList); } else if (IsExamOrRe == 3) { ExamTextBlock.Text = "补考安排"; #if DEBUG paramList.Add(new KeyValuePair<string, string>("stu", "2014214136")); #else paramList.Add(new KeyValuePair<string, string>("stu", appSetting.Values["stuNum"].ToString())); #endif exam = await NetWork.getHttpWebRequest("examapi/index.php", paramList); } Debug.WriteLine("exam->" + exam); if (exam != "") { try { JObject obj = JObject.Parse(exam); if (Int32.Parse(obj["status"].ToString()) == 200) { List<ExamList> examList = new List<ExamList>(); JArray ExamListArray = Utils.ReadJso(exam); for (int i = 0; i < ExamListArray.Count; i++) { ExamList examitem = new ExamList(); examitem.GetAttribute((JObject)ExamListArray[i]); if (IsExamOrRe == 2) examitem.DateTime = "第" + examitem.Week + "周周" + examitem.Weekday + "\r\n" + examitem.Begin_time + "-" + examitem.End_time; else if (IsExamOrRe == 3) examitem.DateTime = "日期:" + examitem.Date + "\r\n" + "时间:" + examitem.Time; examList.Add(examitem); } ExamListView.ItemsSource = examList; } else if (Int32.Parse(obj["status"].ToString()) == 300) { ListFailedStackPanelTextBlock.Text = "暂无数据,过几天再来看看"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Collapsed; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } else if (Int32.Parse(obj["status"].ToString()) == 0) { ListFailedStackPanelTextBlock.Text = "没补考的孩子别瞎点"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Collapsed; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } else { ListFailedStackPanelTextBlock.Text = "加载失败,点击重试"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Visible; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } } catch (Exception) { Debug.WriteLine("考试信息->解析异常"); ListFailedStackPanelTextBlock.Text = "加载失败,点击重试"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Visible; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } } else { ListFailedStackPanelTextBlock.Text = "加载失败,点击重试"; ListFailedStackPanel.Visibility = Visibility.Visible; ListFailedStackPanelImage.Visibility = Visibility.Visible; ListFailedStackPanelTextBlock.Visibility = Visibility.Visible; } StatusBar statusBar = StatusBar.GetForCurrentView(); await statusBar.ProgressIndicator.HideAsync(); }