private void initFreeList() { FreeLoddingTextBlock.Text = "处理中..."; FreeLoddingProgressBar.Value = 0; for (int i = 0; i < kb.Length; i++) { if (kb[i] != "") { JObject obj = JObject.Parse(kb[i]); if (Int32.Parse(obj["status"].ToString()) == 200) { JArray ClassListArray = Utils.ReadJso(kb[i]); for (int j = 0; j < ClassListArray.Count; j++) { ClassList classitem = new ClassList(); classitem.GetAttribute((JObject)ClassListArray[j]); Debug.WriteLine(Array.IndexOf(classitem.Week, week)); if (Array.IndexOf(classitem.Week, week) != -1) { freeclasstime[classitem.Hash_day, classitem.Hash_lesson] = 1; } } } } FreeLoddingProgressBar.Value = FreeLoddingProgressBar.Value + 100.0 / muIdList.Count; Debug.WriteLine(FreeLoddingProgressBar.Value); } FreeLoddingStackPanel.Visibility = Visibility.Collapsed; for (int i = 0; i < 7; i++) { for (int j = 0; j < 6; j++) { if (freeclasstime[i, j] == 0) { FreeList ft = new FreeList(); ft.vis = 1; ft.weekday = i; mFreeList.Add(ft); break; } } for (int j = 0; j < 6; j++) { if (freeclasstime[i, j] == 0) { FreeList fc = new FreeList(); fc.vis = 0; fc.time = j; mFreeList.Add(fc); } } } }
private void showKB(int weekOrAll = 1, int week = 0) { for (int i = 0; i < 7; i++) { for (int j = 0; j < 6; j++) { classtime[i, j] = null; } } kebiaoGrid.Children.Clear(); SetKebiaoGridBorder(week); classList.Clear(); JArray ClassListArray = Utils.ReadJso(kb); int ColorI = 0; for (int i = 0; i < ClassListArray.Count; i++) { ClassList classitem = new ClassList(); classitem.GetAttribute((JObject)ClassListArray[i]); classList.Add(classitem); int ClassColor = 0; if (!appSettingclass.Values.ContainsKey(classitem.Course)) { appSettingclass.Values[classitem.Course] = ColorI; ClassColor = ColorI; ColorI++; if (ColorI > 2) { ColorI = 0; } } else { ClassColor = System.Int32.Parse(appSettingclass.Values[classitem.Course].ToString()); } if (weekOrAll == 1) { SetClassAll(classitem, ClassColor); HubSectionKBNum.Visibility = Visibility.Collapsed; } else { HubSectionKBNum.Visibility = Visibility.Visible; if (week == 0) { if (Array.IndexOf(classitem.Week, Int32.Parse(appSetting.Values["nowWeek"].ToString())) != -1) { SetClassAll(classitem, ClassColor); HubSectionKBNum.Text = " | 第" + appSetting.Values["nowWeek"].ToString() + "周"; } } else { if (Array.IndexOf(classitem.Week, week) != -1) { SetClassAll(classitem, ClassColor); HubSectionKBNum.Text = " | 第" + week.ToString() + "周"; } } } } appSettingclass.Values.Clear(); //当日课表显示 KebiaoDayGrid.Children.Clear(); for (int i = 0; i < ClassListArray.Count; i++) { ClassList classitem = new ClassList(); classitem.GetAttribute((JObject)ClassListArray[i]); #if DEBUG if (Array.IndexOf(classitem.Week, 5) != -1 && classitem.Hash_day == 2) { SetClassDay(classitem); } #else if (Array.IndexOf(classitem.Week, Int32.Parse(appSetting.Values["nowWeek"].ToString())) != -1 && classitem.Hash_day == (Int16.Parse(Utils.GetWeek()) + 6) % 7) { SetClassDay(classitem); } #endif } }