public async void Refresh()
        {
            IsRefreshing = true;
            try
            {
                BJUTEduCenterUserinfo = _dbService.GetAll <Models.BJUTEduCenterUserinfo>().FirstOrDefault();
                if (BJUTEduCenterUserinfo != null)
                {
                    var gradeChart = await GetGrade(_studentName, BJUTEduCenterUserinfo.Username);//获取最新数据

                    if (gradeChart != null)
                    {
                        GradeChart.Clear();
                        GradeChart.MainList.Clear();

                        foreach (var item in gradeChart)
                        {
                            GradeChart.Add(item);
                        }

                        GradeChart.InitList();

                        SaveGradeChart();//保存成绩表
                    }
                }
            }
            catch
            {
                Services.NotityService.Notify("解析最新数据失败");
            }
            finally
            {
                IsRefreshing = false;
            }
        }
        public async void Loaded()
        {
            if (_isLogined == true)
            {
                return;
            }
            if (Device.OS == TargetPlatform.iOS)
            {
                IsDisable = true;
                return;
            }
            else
            {
                IsDisable = false;
            }

            await Services.NotityService.DisplayAlert("工大助手", "此功能目前需要连接校园网使用");

            IsLoading = true;

            var user = _dbService.GetAll <Models.BJUTInfoCenterUserinfo>().FirstOrDefault();

            if (user == null)
            {
                return;
            }

            InfoCenterUserInfo = user;
            LoadLocalCampascadInfo();

            IsLoading = true;
            try
            {
                var re = await LoginInfoCenter();

                if (re == true)
                {
                    _isLogined = true;
                    await GetTransactionInfo();
                }
            }
            catch
            {
            }
            finally
            {
                IsLoading = false;
            }
        }
        public void OnNavigatedTo(NavigationParameters parameters)
        {
            var infouser = _deService.GetAll <Models.BJUTInfoCenterUserinfo>().FirstOrDefault();
            var eduuser  = _deService.GetAll <Models.BJUTInfoCenterUserinfo>().FirstOrDefault();

            if (infouser == null && eduuser != null)
            {
                StudentID = eduuser.Username;
            }
            else if (infouser != null && eduuser == null)
            {
                StudentID = infouser.Username;
            }
            else if (infouser != null && eduuser != null)
            {
                StudentID = infouser.Username == eduuser.Username ? infouser.Username : string.Empty;
            }
        }
Beispiel #4
0
        /// <summary>
        /// 约定导航到本页面参数必须提供from字段,CLR类型为Type
        /// </summary>
        /// <param name="parameters"></param>
        public async void OnNavigatedTo(NavigationParameters parameters)
        {
            if (parameters.ContainsKey("from"))
            {
                if (parameters["from"] == typeof(Views.EduScheduleDetailPage))
                {
                    return;
                }

                if (parameters["from"] == typeof(Views.CaptchaPage))
                {
                    ViewModels.EduPageViewModel.CaptchaText = (string)parameters["captchatext"];
                    await Login();

                    if (isRefreshing)
                    {
                        Refresh();
                        isRefreshing = false;
                    }
                    return;
                }
                else if (parameters["from"] == typeof(Views.UserInfoDetailPage))
                {
                    var eduuser = _dbService.GetAll <Models.BJUTEduCenterUserinfo>().FirstOrDefault();
                    ViewModels.EduPageViewModel.BJUTEduCenterUserinfo = eduuser;
                    await Login();

                    return;
                }
            }

            EduPageViewModel.BJUTEduCenterUserinfo = _dbService.GetAll <Models.BJUTEduCenterUserinfo>().FirstOrDefault();

            EduTime = (Models.EduTimeModel)parameters["edutime"];


            InitSchedule();
            SetTime();
            hasLoadLoaclInfo = true;
        }
Beispiel #5
0
        public async void OnNavigatedTo(NavigationParameters parameters)
        {
            if (parameters != null)
            {
                _coreService = EduPageViewModel.CoreService;
                _httpService = EduPageViewModel.HttpService;
                _studentName = EduPageViewModel.Name;

                BJUTEduCenterUserinfo = _dbService.GetAll <Models.BJUTEduCenterUserinfo>().FirstOrDefault();

                IsLoading = true;
                await GetExamInfo();

                IsLoading = false;
            }
        }
Beispiel #6
0
        public Models.EduTimeModel GetLocalEdutime()
        {
            var timeinfo = _dbService.GetAll <Models.EduTimeModel>().FirstOrDefault();

            if (timeinfo != null)
            {
                //自动调整周数
                var startDayOfWeek = timeinfo.CreateTime.DayOfWeek;
                var nowDayOfWeek   = DateTime.Now.Date.DayOfWeek;

                var daySpan  = DateTime.Now.Date - timeinfo.CreateTime.Date;
                var weekSpan = daySpan.Days / 7;
                timeinfo.Week += weekSpan;
                var dis = nowDayOfWeek - startDayOfWeek;
                if (dis < 0 && dis > -(int)startDayOfWeek)//这一周之类
                {
                    timeinfo.Week++;
                }
            }

            return(timeinfo);
        }