示例#1
0
 public void LoadCurrentPage(LOPageSource page)
 {
     if (do_reset)
     {
         _elementslist[_currentindex].resetpage(page);
         do_reset = false;
     }
 }
        public void resetpage(LOPageSource tmpsource)
        {
            LOPageViewer page = new LOPageViewer();

            page.PropertyChanged += page_PropertyChanged;
            page.Source           = _source; // set source
            _pagegrid.Children.Add(page);
            //setvisual values
            Canvas.SetZIndex(_pagegrid, 10);
            //Canvas.SetZIndex(_loadingview, -10);
            IsLoaded = true;
        }
示例#3
0
        void LoadPagesDataSource()
        {
            var vm = ViewModel as LOViewModel;
            //var styles = new StyleConstants();
            int scroll_index = 0;

            //for styles
            bool white_style = false, is_main = true;

            for (int i = 0; i < vm.LOsInCircle.Count; i++)
            {
                var s_list = vm.LOsInCircle[i].stack.StacksList;
                for (int j = 0; j < s_list.Count; j++)
                {

                    for (int k = 0; k < s_list[j].PagesList.Count; k++)
                    {
                        LOPageSource page = new LOPageSource();
                        var content = s_list[j].PagesList[k].content;

                        //page.Cover = Constants.ByteArrayToImageConverter.Convert(s_list[j].PagesList[k].cover_bytes);
                        page.CoverBytes = s_list[j].PagesList[k].cover_bytes;
                        page.PageIndex = k;
                        page.StackIndex = j;
                        page.LOIndex = i;
                        //to set postion in the scroll
                        page.Index = scroll_index;
                        scroll_index += 1;
                        var slides = s_list[j].PagesList[k].content.lopage.loslide;


                        //vm.OpenPageCommand.Execute(s_list[j].PagesList[k]);

                        var currentpage = s_list[j].PagesList[k];
                        page.Slides = new List<LOSlideSource>();
                        currentpage.PropertyChanged += (sender, args) => {
                            if (args.PropertyName == "IsLoaded") 
                            {
                                page.IsLoaded = currentpage.IsLoaded;
                            }
                        };
                        for (int m = 0; m < slides.Count; m++)
                        {
                            LOSlideSource slidesource = new LOSlideSource();
                            var _id_ = vm.LOsInCircle[i].lo.color_id;
                           
                            slidesource.Style = getSlideStyle(white_style, is_main, _id_ , slides[m].lotype);
                            slidesource.Style.ID = _id_+1;
                            
                            is_main = !is_main;
                            if (slides[m].lotype != 0 && slides[m].lotype != 6)
                                white_style = !white_style;
                            slidesource.Type = slides[m].lotype;
                            if (slides[m].lotitle != null) slidesource.Title = slides[m].lotitle;
                            if (slides[m].loparagraph != null) slidesource.Paragraph = slides[m].loparagraph;
                            if (slides[m].loimage != null) slidesource.ImageUrl = slides[m].loimage;
                            if (slides[m].lotext != null) slidesource.Paragraph = slides[m].lotext;
                            if (slides[m].loauthor != null) slidesource.Author = slides[m].loauthor;
                            if (slides[m].lovideo != null) slidesource.VideoUrl = slides[m].lovideo;
                            //imagebytes
                            if (slides[m].image_bytes != null) slidesource.ImageBytes = slides[m].image_bytes; 
                            
                            var c_slide = slides[m];
                            c_slide.PropertyChanged+=(s,e)=>{
                                if (e.PropertyName == "image_bytes" && c_slide.image_bytes != null)
                                    slidesource.ImageBytes = c_slide.image_bytes; 
                            };

                            if (c_slide.loitemize != null)
                            {
                                slidesource.Itemize = new ObservableCollection<LOItemSource>();
                                var items = c_slide.loitemize.loitem;
                                for (int n = 0; n < items.Count; n++)
                                { 
                                    LOItemSource item = new LOItemSource();
                                    if (items[n].loimage != null) item.ImageUrl = items[n].loimage;
                                    if (items[n].lotext != null) item.Text = items[n].lotext;
                                    //imagebytes
                                    if (items[n].image_bytes != null) item.ImageBytes = items[n].image_bytes; 

                                    var c_item_ize = items[n];
                                    c_item_ize.PropertyChanged += (s1, e1) =>
                                    {
                                        if (e1.PropertyName == "image_bytes" && c_item_ize.image_bytes != null)
                                            item.ImageBytes = c_item_ize.image_bytes; 
                                    };
                                    slidesource.Itemize.Add(item);
                                }
                            }
                            page.Slides.Add(slidesource);
                             
                             
                        } 
                        //pages

                        pagelistsource.Add(page);
                    }
                }
            }

            //add pages
            _readerview.Source = pagelistsource;
            //Canvas.SetZIndex(_readerview, 10);
        }
 public  void LoadCurrentPage(LOPageSource page)
 {
     if (do_reset)
     {
         _elementslist[_currentindex].resetpage(page);
         do_reset = false;
     }
 }
 public void resetpage( LOPageSource tmpsource )
 { 
     LOPageViewer page = new LOPageViewer();
     page.PropertyChanged += page_PropertyChanged;
     page.Source = _source; // set source
     _pagegrid.Children.Add(page);
     //setvisual values
     Canvas.SetZIndex(_pagegrid, 10);
     //Canvas.SetZIndex(_loadingview, -10);
     IsLoaded = true;
 }