示例#1
0
        public async void GetSpecificSchedule()
        {
            string html = string.Empty;

            try
            {
                html = await _coreService.GetSpecificSchedule(_httpService, Name, BJUTEduCenterUserinfo.Username, SelectedSchoolYear, SelectedTerm);
            }
            catch (HttpRequestException ex)
            {
                GalaSoft.MvvmLight.Messaging.Messenger.Default.Send("获取数据失败", messageToken);
            }
            catch
            {
                GalaSoft.MvvmLight.Messaging.Messenger.Default.Send("遇到意外错误", messageToken);
                return;
            }
            try
            {
                var list = Model.ScheduleModel.GetSchedule(html);//获取课表
                var temp = new Model.ScheduleModel {
                    ScheduleItemList = list, CurrentWeek = 1, SelectedWeek = 1
                };

                temp.GetAllWeek();//获取最大周数
                Schedule = temp;
            }
            catch
            {
                GalaSoft.MvvmLight.Messaging.Messenger.Default.Send("解析数据失败", messageToken);
            }
        }
示例#2
0
        public async void GetCurrentSchedule(string name, string username)
        {
            string html = string.Empty;

            try
            {
                html = await _coreService.GetCurrentSchedule(_httpService, name, username);
            }
            catch (HttpRequestException ex)
            {
                GalaSoft.MvvmLight.Messaging.Messenger.Default.Send("获取数据失败", messageToken);
            }
            catch
            {
                GalaSoft.MvvmLight.Messaging.Messenger.Default.Send("遇到意外错误", messageToken);
                return;
            }
            try
            {
                var list = Model.ScheduleModel.GetSchedule(html);//获取课表
                var temp = new Model.ScheduleModel {
                    ScheduleItemList = list, CurrentWeek = EduTime.Week,
                };

                temp.GetAllWeek();//获取最大周数
                temp.SelectedWeek = EduTime.Week;

                Schedule = temp;
                SaveSchedule();
            }
            catch
            {
                GalaSoft.MvvmLight.Messaging.Messenger.Default.Send("解析数据失败", messageToken);
            }
        }