private void BackGrid_Tapped(object sender, TappedRoutedEventArgs e) { Debug.WriteLine("前" + KBCLassFlyoutPivot.Items.Count.ToString()); do { KBCLassFlyoutPivot.Items.RemoveAt(0); }while (KBCLassFlyoutPivot.Items.Count.ToString() != "0"); Debug.WriteLine("删除" + KBCLassFlyoutPivot.Items.Count.ToString()); Grid g = sender as Grid; Debug.WriteLine(g.GetValue(Grid.ColumnProperty)); Debug.WriteLine(g.GetValue(Grid.RowProperty)); string[] temp = classtime[Int32.Parse(g.GetValue(Grid.ColumnProperty).ToString()), Int32.Parse(g.GetValue(Grid.RowProperty).ToString()) / 2]; for (int i = 0; i < temp.Length; i++) { ClassList c = classList.Find(p => p._Id.Equals(temp[i])); PivotItem pi = new PivotItem(); TextBlock HeaderTextBlock = new TextBlock(); HeaderTextBlock.Text = c.Course; HeaderTextBlock.FontSize = 25; pi.Header = HeaderTextBlock; ListView lv = new ListView(); lv.ItemTemplate = KBCLassFlyoutListView.ItemTemplate; List <ClassList> cc = new List <ClassList>(); cc.Add(c); lv.ItemsSource = cc; pi.Content = lv; KBCLassFlyoutPivot.Items.Add(pi); Debug.WriteLine("后" + KBCLassFlyoutPivot.Items.Count.ToString()); } KBCLassFlyout.ShowAt(page); }
private void BackGrid_Tapped(object sender, TappedRoutedEventArgs e) { peoplelist.Clear(); Grid g = sender as Grid; Debug.WriteLine(g.GetValue(Grid.ColumnProperty)); Debug.WriteLine(g.GetValue(Grid.RowProperty)); int day = Int32.Parse(g.GetValue(Grid.ColumnProperty).ToString()); int lesson = Int32.Parse(g.GetValue(Grid.RowProperty).ToString()) / 2; string[] temp = ResultName[day, lesson]; string week = ""; string nowclass = ""; string time = ""; switch (day.ToString()) { case "0": week = "一"; break; case "1": week = "二"; break; case "2": week = "三"; break; case "3": week = "四"; break; case "4": week = "五"; break; case "5": week = "六"; break; case "6": week = "日"; break; } switch (lesson) { case 0: nowclass = "1-2节"; time = "8:00 - 9:40 AM"; break; case 1: nowclass = "3-4节"; time = "10:05 - 11:45 AM"; break; case 2: nowclass = "5-6节"; time = "14:00 - 15:40 PM"; break; case 3: nowclass = "7-8节"; time = "16:05 - 17:45 PM"; break; case 4: nowclass = "9-10节"; time = "19:00 - 20:40 PM"; break; case 5: nowclass = "11-12节"; time = "20:50 - 22:30 PM"; break; } FlyoutFreeDetailWeekTextBlock.Text = "星期" + week + " " + nowclass; FlyoutFreeDetailTimeTextBlock.Text = time; FlyoutFreeDetailPeopleTextBlock.Text = "共计" + temp.Length + "人"; if (!weekorterm) { for (int i = 0; i < temp.Length; i++) { peoplelist.Add(new People { name = temp[i] }); } } else { for (int i = 0; i < temp.Length; i++) { int[] weeks = (from n in termresult where n.Hash_day == day && n.Hash_lesson == lesson select n.nameweek[temp[i]]).ToArray()[0]; string weekstr = ""; if (weeks.Length != 0) { weekstr = WeeknumConverter(weeks); } peoplelist.Add(new People { name = temp[i], weekstostr = " " + weekstr }); } } KBCLassFlyout.ShowAt(page); }