/// <summary> /// 从运行目录上一级的Resource文件夹下取Images /// </summary> /// <returns></returns> public IEnumerable <ImageSource> RollImages() { yield return(AppResources.GetImageSource(@"Images\rollimg\img1.png")); yield return(AppResources.GetImageSource(@"Images\rollimg\img2.png")); yield return(AppResources.GetImageSource(@"Images\rollimg\img3.png")); yield return(AppResources.GetImageSource(@"Images\rollimg\img4.png")); yield return(AppResources.GetImageSource(@"Images\rollimg\img5.png")); yield return(AppResources.GetImageSource(@"Images\rollimg\img6.png")); }
private void LoadData() { _sp.Children.Clear(); DynamicJson courseList = RestRC.BACARepository.Request(ApiList.courseList, string.Empty).AsDynamicJson(); dynamic categoryList = RestRC.BACARepository.Request(ApiList.categoryList, string.Empty).ToDynamicJson().list; if (categoryList != null) { foreach (DynamicJson category in categoryList) { if (category.GetStr("type") != "1") { continue; } IndexInfo catelogElement = new IndexInfo() { model = category }; catelogElement.Title.Content = category.GetStr("title"); foreach (DynamicJson course in courseList.GetChild <List <object> >("list")) { if (category.GetStr("id") == course.GetStr("basecoursecategoryid")) { CourseItem ci = new CourseItem(); ci._imgCourse.Source = AppResources.GetImageSource(course.GetStr("coverimg")); ci._imgCourse.Tag = course.GetStr("Id"); ci._imgTeacher.Source = AppResources.GetImageSource(course.GetChild <DynamicJson>("teacherEntity").GetStr("headimg")); ci._imgTeacher.Tag = course.GetStr("teacherid"); ci._tblDesc.Text = string.Format("教师:{0}\r\n{1}", course.GetChild <DynamicJson>("teacherEntity").GetStr("name"), course.GetStr("describeshort")); catelogElement._wpCourseItems.Children.Add(ci); ci._imgCourse.PreviewMouseLeftButtonUp += _imgCourse_PreviewMouseLeftButtonUp; ci._imgTeacher.PreviewMouseLeftButtonUp += _imgTeacher_PreviewMouseLeftButtonUp; } } _sp.Children.Add(catelogElement); } } }