コード例 #1
0
        async void DoOpenLOSectionListCommandCommand(lo_by_circle_wrapper learningobj)
        {
            var listas = await _mLearningService.GetSectionsByLO(learningobj.lo.id);

            if (listas != null)
            {
                //NewsCollection=new ObservableCollection<string>(await service.LoadNews ());

                this.LOsectionList = new ObservableCollection <LOsection>(listas);
            }
        }
コード例 #2
0
        async Task LoadPages2(int loListIndex, bool images)
        {
            var lo_obj = LOsInCircle[loListIndex];
            var LOID   = lo_obj.lo.id;

            var sectionList = await _mLearningService.GetSectionsByLO(LOID);

            //var allSections = new ObservableCollection<LOsection>();

            //Collection for transorming data
            var AllPagesList = new ObservableCollection <page_wrapper> ();
            //collections of collections
            var GroupedPagesList = new ObservableCollection <page_collection_wrapper>();

            //For collection al pages
            var pagesList = new List <Page> ();



            foreach (var item in sectionList)
            {
                var sectionPages = await _mLearningService.GetPagesByLOSection(item.id);

                foreach (var page in sectionPages)
                {
                    pagesList.Add(page);
                }
                var collectionWrapper = new page_collection_wrapper();
                collectionWrapper.TagName = item.name;

                foreach (var p in sectionPages)
                {
                    Mvx.Trace("Id: " + p.id);
                    LOContent locontent = null;
                    //LOContent locontent =  new LOContent();
                    try
                    {
                        locontent = JsonConvert.DeserializeObject <LOContent> (p.content);                       //(locontentstring);;
                        //locontent.lopage = JsonConvert.DeserializeObject<Lopage>(p.content);
                    }
                    catch (Exception e)
                    {
                        Mvx.Trace("Serialization error: " + e.Message);
                    }

                    var pw1 = new page_wrapper {
                        page = p, content = locontent                                              /*, id=pagecount*/
                    };
                    collectionWrapper.PagesList.Add(pw1);

                    //AllPagesList.Add(pw1);
                    pagecount++;
                }

                GroupedPagesList.Add(collectionWrapper);

                if (this.LOID == item.LO_id)
                {
                    if (images)
                    {
                        UpdatePagesImages(0, collectionWrapper.PagesList);
                    }
                }
            }


            //if (images)
            //	UpdatePagesImages(0, GroupedPagesList[i].PagesList);


            LOsInCircle[loListIndex].stack.StacksList = GroupedPagesList;
            LOsInCircle[loListIndex].stack.IsLoaded   = true;

            LOCurrentIndex = loListIndex;

            UpdateExtraInfo(LOCurrentIndex);
        }