Beispiel #1
0
        public MyCourseViewModel()
        {
            var mycourseresult = WebHelper.Get(BaseConfig.Host + "/myCourses.asp").Html;
            var matchsname     = Regex.Matches(mycourseresult, regexName);
            var matchsbutton   = Regex.Matches(mycourseresult, regexButton);

            for (int a = 0; a < matchsbutton.Count; a++)
            {
                string sprogress = TextHelper.Between(matchsbutton[a].Groups[2].Value, "(", "%");
                MyCourseList.Add(new MyCourseModel
                {
                    IndexPhoto = matchsname[a].Groups[2].Value,
                    CourseName = matchsname[a].Groups[3].Value,
                    CourseUrl  = matchsbutton[a].Groups[1].Value,
                    Progress   = Convert.ToDecimal(sprogress)
                });
            }
            OnPropertyChanged(nameof(MyCourseList));
            if (MyCourseList.Count <= 0)
            {
                Growl.Info("没有找到课程!");
            }
        }