示例#1
0
        async void DoCreateCircleCommand()
        {
            int circle_id = await _mLearningService.CreateCircle(UserID, CircleName, CircleType);


            var circle = new circle_by_user {
                id = circle_id, name = CircleName, type = CircleType
            };

            CirclesList.Add(circle);

            //Register the Publisher as a user in a Circle
            _mLearningService.CreateObject <CircleUser>(new CircleUser {
                Circle_id = circle_id, User_id = UserID, created_at = DateTime.UtcNow, updated_at = DateTime.UtcNow
            }, c => c.id);
        }
        async Task LoadLearningObjects(int circle_id)
        {
            if (LearningOjectsList != null)
            {
                LearningOjectsList.Clear();
            }

            var list = await _mLearningService.GetLOByCircleAndUser(circle_id, UserID);

            int circleIndex = CirclesList.IndexOf(CirclesList.Where(c => c.id == circle_id).First());

            var circleLOList = new List <lo_by_circle_wrapper>();



            foreach (var item in list)
            {
                circleLOList.Add(new lo_by_circle_wrapper {
                    lo = item
                });
            }

            CirclesLearningObjects[circleIndex] = new ObservableCollection <lo_by_circle_wrapper>(circleLOList);

            LearningOjectsList = CirclesLearningObjects[circleIndex];


            await BlockDownload.TryPutBytesInVector <MLearning.Core.ViewModels.MainViewModel.lo_by_circle_wrapper>(LearningOjectsList.ToList(),
                                                                                                                   (pos, bytes) => {
                if (pos < LearningOjectsList.Count)
                {
                    LearningOjectsList[pos].background_bytes = bytes;
                }
            },
                                                                                                                   (lo) => { return(lo.lo.url_background); }
                                                                                                                   );


            _locover_manager.Clear();

            CurrentIndexDisplaying = 0;

            await UpdateLOImages(CurrentIndexDisplaying, CirclesLearningObjects[CirclesList.IndexOf(CirclesList.Where(c => c.id == CircleID).First())]);
        }