예제 #1
0
 /// <summary>
 /// 学期和周的切换
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CalendarWeekAppBarButton_Click(object sender, RoutedEventArgs e)
 {
     if (week != -100)
     {
         week_old   = week;
         week       = -100;
         weekorterm = true;
         HubSectionKBNum.Visibility  = Visibility.Collapsed;
         HubSectionKBNumD.Visibility = Visibility.Collapsed;
         HubSectionKBNumZ.Visibility = Visibility.Collapsed;
         ResultName.Initialize();
         EmptyClass ec = new EmptyClass(week, forsearchlist);
         ec.getfreetime(result, termresult);
         showFreeKB(termresult, showWeekend);
     }
     else
     {
         weekorterm                  = false;
         week                        = week_old;
         HubSectionKBNum.Text        = week.ToString();
         HubSectionKBNum.Visibility  = Visibility.Visible;
         HubSectionKBNumD.Visibility = Visibility.Visible;
         HubSectionKBNumZ.Visibility = Visibility.Visible;
         ResultName.Initialize();
         EmptyClass ec = new EmptyClass(week, forsearchlist);
         ec.getfreetime(result, termresult);
         showFreeKB(result, showWeekend);
     }
 }
예제 #2
0
 /// <summary>
 /// 输入周查课表
 /// </summary>
 private void KBNumSearch()
 {
     if (KBNumFlyoutTextBox.Text != "" && KBNumFlyoutTextBox.Text.IndexOf(".") == -1)
     {
         try
         {
             week = int.Parse(KBNumFlyoutTextBox.Text);
             HubSectionKBNum.Text = KBNumFlyoutTextBox.Text;
             KBNumFlyout.Hide();
             ResultName = new string[7, 6][];
             EmptyClass ec = new EmptyClass(week, forsearchlist);
             result = new ObservableCollection <ClassListLight>();
             ec.getfreetime(result, termresult);
             showFreeKB(result, showWeekend);
         }
         catch (Exception)
         {
             Utils.Message("请输入正确的周次");
         }
     }
     else
     {
         Utils.Message("请输入正确的周次");
     }
 }
예제 #3
0
        /// <summary>
        /// 获得各个学号的课表
        /// </summary>
        private async void initFree()
        {
            for (int i = 0; i < muIdList.Count; i++)
            {
                int issuccess = 0;
                List <ClassListLight> clist = new List <ClassListLight>();
                while (issuccess < 2) //失败后重试两次
                {
                    List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >();
                    paramList.Add(new KeyValuePair <string, string>("stuNum", muIdList[i].uId));
                    string kbtemp = await NetWork.getHttpWebRequest("redapi2/api/kebiao", paramList); //新

                    if (kbtemp != "")
                    {
                        JObject job = JObject.Parse(kbtemp);
                        if (Int32.Parse(job["status"].ToString()) == 200)
                        {
                            JArray jarry = Utils.ReadJso(kbtemp);
                            for (int j = 0; j < jarry.Count; j++)
                            {
                                ClassListLight cll      = new ClassListLight();
                                var            istriple = cll.getattribute((JObject)jarry[j]);
                                cll.Name = new string[] { muIdList[i].uName }; // muIdList[i].uName;
                                if (istriple != null)
                                {
                                    clist.Add(istriple);
                                    istriple.Name = cll.Name;
                                }
                                clist.Add(cll);
                            }
                        }
                        issuccess = 2;
                    }
                    else
                    {
                        issuccess++;
                    }
                }
                forsearchlist.Add(muIdList[i].uName, clist);
                FreeLoddingProgressBar.Value = FreeLoddingProgressBar.Value + 100.0 / muIdList.Count;
                Debug.WriteLine(FreeLoddingProgressBar.Value);
            }
            //查无课表,参数第几周==
            EmptyClass ec = new EmptyClass(week, forsearchlist);

            ec.getfreetime(result, termresult);
            //freetime(11, forsearchlist);
            FreeLoddingStackPanel.Visibility   = Visibility.Collapsed;
            FreeKBTableGrid.Visibility         = Visibility.Visible;
            ShowWeekendAppBarButton.Visibility = Visibility.Visible;
            if (result.Count != 0)
            {
                showFreeKB(result);
            }
            else
            {
                showFreeKB(termresult);
            }
        }
예제 #4
0
        /// <summary>
        /// 显示隐藏周末
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ShowWeekendAppBarButton_Click(object sender, RoutedEventArgs e)
        {
            if (showWeekend)
            {
                ShowWeekendAppBarButton.Label = "显示周末课表";
            }
            else
            {
                ShowWeekendAppBarButton.Label = "隐藏周末课表";
            }
            showWeekend = !showWeekend;
            EmptyClass ec = new EmptyClass(week, forsearchlist);

            ec.getfreetime(result, termresult); if (week != -100)
            {
                showFreeKB(result, showWeekend);
            }
            else
            {
                showFreeKB(termresult, showWeekend);
            }
        }
 /// <summary>
 /// 获得各个学号的课表
 /// </summary>
 private async void initFree()
 {
     for (int i = 0; i < muIdList.Count; i++)
     {
         int issuccess = 0;
         List<ClassListLight> clist = new List<ClassListLight>();
         while (issuccess < 2) //失败后重试两次
         {
             List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>();
             paramList.Add(new KeyValuePair<string, string>("stuNum", muIdList[i].uId));
             string kbtemp = await NetWork.getHttpWebRequest("redapi2/api/kebiao", paramList); //新
             if (kbtemp != "")
             {
                 JObject job = JObject.Parse(kbtemp);
                 if (Int32.Parse(job["status"].ToString()) == 200)
                 {
                     JArray jarry = Utils.ReadJso(kbtemp);
                     for (int j = 0; j < jarry.Count; j++)
                     {
                         ClassListLight cll = new ClassListLight();
                         var istriple = cll.getattribute((JObject)jarry[j]);
                         cll.Name = new string[] { muIdList[i].uName }; // muIdList[i].uName;
                         if (istriple != null)
                         {
                             clist.Add(istriple);
                             istriple.Name = cll.Name;
                         }
                         clist.Add(cll);
                     }
                 }
                 issuccess = 2;
             }
             else
             {
                 issuccess++;
             }
         }
         forsearchlist.Add(muIdList[i].uName, clist);
         FreeLoddingProgressBar.Value = FreeLoddingProgressBar.Value + 100.0 / muIdList.Count;
         Debug.WriteLine(FreeLoddingProgressBar.Value);
     }
     //查无课表,参数第几周==
     EmptyClass ec = new EmptyClass(week, forsearchlist);
     ec.getfreetime(result, termresult);
     //freetime(11, forsearchlist);
     FreeLoddingStackPanel.Visibility = Visibility.Collapsed;
     FreeKBTableGrid.Visibility = Visibility.Visible;
     ShowWeekendAppBarButton.Visibility = Visibility.Visible;
     if (result.Count != 0)
         showFreeKB(result);
     else
         showFreeKB(termresult);
 }
 /// <summary>
 /// 显示隐藏周末
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ShowWeekendAppBarButton_Click(object sender, RoutedEventArgs e)
 {
     if (showWeekend)
         ShowWeekendAppBarButton.Label = "显示周末课表";
     else
         ShowWeekendAppBarButton.Label = "隐藏周末课表";
     showWeekend = !showWeekend;
     EmptyClass ec = new EmptyClass(week, forsearchlist);
     ec.getfreetime(result, termresult); if (week != -100)
     {
         showFreeKB(result, showWeekend);
     }
     else
     {
         showFreeKB(termresult, showWeekend);
     }
 }
 /// <summary>
 /// 学期和周的切换
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CalendarWeekAppBarButton_Click(object sender, RoutedEventArgs e)
 {
     if (week != -100)
     {
         week_old = week;
         week = -100;
         weekorterm = true;
         HubSectionKBNum.Visibility = Visibility.Collapsed;
         HubSectionKBNumD.Visibility = Visibility.Collapsed;
         HubSectionKBNumZ.Visibility = Visibility.Collapsed;
         ResultName.Initialize();
         EmptyClass ec = new EmptyClass(week, forsearchlist);
         ec.getfreetime(result, termresult);
         showFreeKB(termresult, showWeekend);
     }
     else
     {
         weekorterm = false;
         week = week_old;
         HubSectionKBNum.Text = week.ToString();
         HubSectionKBNum.Visibility = Visibility.Visible;
         HubSectionKBNumD.Visibility = Visibility.Visible;
         HubSectionKBNumZ.Visibility = Visibility.Visible;
         ResultName.Initialize();
         EmptyClass ec = new EmptyClass(week, forsearchlist);
         ec.getfreetime(result, termresult);
         showFreeKB(result, showWeekend);
     }
 }
 /// <summary>
 /// 输入周查课表
 /// </summary>
 private void KBNumSearch()
 {
     if (KBNumFlyoutTextBox.Text != "" && KBNumFlyoutTextBox.Text.IndexOf(".") == -1)
     {
         try
         {
             week = int.Parse(KBNumFlyoutTextBox.Text);
             HubSectionKBNum.Text = KBNumFlyoutTextBox.Text;
             KBNumFlyout.Hide();
             ResultName = new string[7, 6][];
             EmptyClass ec = new EmptyClass(week, forsearchlist);
             result = new ObservableCollection<ClassListLight>();
             ec.getfreetime(result, termresult);
             showFreeKB(result, showWeekend);
         }
         catch (Exception)
         {
             Utils.Message("请输入正确的周次");
         }
     }
     else
         Utils.Message("请输入正确的周次");
 }