Example #1
0
        void loadLOsInCircle(int index)
        { 
            var vm = ViewModel as LOViewModel;
            if (vm.LOsInCircle != null)
            {

                for (int i = index; i < vm.LOsInCircle.Count; i++)
                {
                    ChapterDataSource newchapter = new ChapterDataSource();
                    newchapter.Title = vm.LOsInCircle[i].lo.title;
                    newchapter.Author = vm.LOsInCircle[i].lo.name + "\n" + vm.LOsInCircle[i].lo.lastname;
                    newchapter.Description = vm.LOsInCircle[i].lo.description;
                    newchapter.ChapterColor = StaticStyles.Colors[vm.LOsInCircle[i].lo.color_id].MainColor;
                    newchapter.TemporalColor = StaticStyles.Colors[vm.LOsInCircle[index].lo.color_id].MainColor;

                    if (vm.LOsInCircle[i].background_bytes != null)
                        newchapter.BackgroundImage = Constants.ByteArrayToImageConverter.Convert(vm.LOsInCircle[i].background_bytes);

                    vm.LOsInCircle[i].PropertyChanged += (s1, e1) =>
                            {
                                if (e1.PropertyName == "background_bytes")
                                {
                                    newchapter.BackgroundImage = Constants.ByteArrayToImageConverter.Convert((s1 as MLearning.Core.ViewModels.MainViewModel.lo_by_circle_wrapper ).background_bytes);
                                }
                            };

                    //loading the stacks
                    if (vm.LOsInCircle[i].stack.IsLoaded)
                    {
                        var s_list = vm.LOsInCircle[i].stack.StacksList;
                        for (int j = 0; j < s_list.Count; j++)
                        {
                            SectionDataSource stack = new SectionDataSource();

                            stack.Name = s_list[j].TagName;
                            for (int k = 0; k < s_list[j].PagesList.Count; k++)
                            {
                                var page = new PageDataSource();
                                page.Name = s_list[j].PagesList[k].page.title;
                                page.Description = s_list[j].PagesList[k].page.description;
                                if (s_list[j].PagesList[k].cover_bytes != null)
                                    page.ImageContent = Constants.ByteArrayToImageConverter.Convert(s_list[j].PagesList[k].cover_bytes);
                                s_list[j].PagesList[k].PropertyChanged += (s2, e2) =>
                                {
                                    if (e2.PropertyName == "cover_bytes")
                                        page.ImageContent = Constants.ByteArrayToImageConverter.Convert((s2 as MLearning.Core.ViewModels.LOViewModel.page_wrapper).cover_bytes);
                                };
                                stack.Pages.Add(page);
                            }
                            newchapter.Sections.Add(stack);
                        }

                    }
                    else
                    {

                        vm.LOsInCircle[i].stack.PropertyChanged += (s3, e3) =>
                            {
                                var s_list = vm.LOsInCircle[i].stack.StacksList;
                                for (int j = 0; j < s_list.Count; j++)
                                {
                                    SectionDataSource stack = new SectionDataSource();

                                    stack.Name = s_list[j].TagName;
                                    for (int k = 0; k < s_list[j].PagesList.Count; k++)
                                    {
                                        PageDataSource page = new PageDataSource();
                                        page.Name = s_list[j].PagesList[k].page.title;
                                        page.Description = s_list[j].PagesList[k].page.description;
                                        if (s_list[j].PagesList[k].cover_bytes != null)
                                        {
                                            page.ImageContent = Convert(s_list[j].PagesList[k].cover_bytes, 267, 150); 
                                        }
                                        s_list[j].PagesList[k].PropertyChanged += (s2, e2) =>
                                        {
                                            if (e2.PropertyName == "cover_bytes")
                                            {
                                                page.ImageContent = Convert(s_list[j].PagesList[k].cover_bytes,267, 150); 
                                            }
                                        };
                                        stack.Pages.Add(page);
                                    }
                                    newchapter.Sections.Add(stack);
                                }
                            };
                    }
                    booksource.Chapters.Add(newchapter);
                }
                down_menu.SelectElement(vm.LOCurrentIndex);
                booksource.TemporalColor = StaticStyles.Colors[vm.LOsInCircle[_currentLO].lo.color_id].MainColor;
                _backgroundscroll.Source = booksource;
                logo_image.BackSource = new BitmapImage(new Uri(StaticStyles.LogosScroll[vm.LOsInCircle[_currentLO].lo.color_id]));
                _menucontroller.SEtColor(StaticStyles.Colors[vm.LOsInCircle[_currentLO].lo.color_id].MainColorA);
            }
        }
Example #2
0
        //private:
        private void initproperties()
        {
            _itemnumber = 0;
            _initialangle = 0.0;
            _datasource = null;
            _bordersource = null;

            _thumbheight = 0;
            _thumbwidth = 0;
            _borderheight = 0;
            _borderwidth = 0.0;
            _initialposition = 0;
            _finalposition = 0;

            _isopen = false;
            _isfull = false;

            _touches = 0;
            _maxthreshold = 100;

            _ismfull = false;
        }