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);
        }
Beispiel #2
0
        void LoadPagesDataSource()
        {
            bool is_main = true;
            int  space   = Configuration.getWidth(30);

            var s_listp = vm.LOsInCircle[vm._currentUnidad].stack.StacksList;
            int indice  = 0;

            if (s_listp != null)
            {
                int j = vm._currentSection;
                //	for (int j = 0; j < s_listp.Count; j++) {

                for (int k = 0; k < s_listp [j].PagesList.Count; k++)
                {
                    //		if (j == vm._currentSection) {

                    VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this);
                    scrollPager.setOnScrollViewListener(this);
                    LinearLayout linearScroll = new LinearLayout(this);
                    linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                    linearScroll.Orientation      = Orientation.Vertical;

                    var content = s_listp [j].PagesList [k].content;
                    FrontContainerViewPager front = new FrontContainerViewPager(this);
                    front.Tag = "pager";


                    front.ImageChapter = s_listp [j].PagesList [k].page.url_img;


                    front.Title       = s_listp [j].PagesList [k].page.title;
                    front.Description = s_listp [j].PagesList [k].page.description;


                    var slides = s_listp [j].PagesList [k].content.lopage.loslide;
                    front.setBack(drBack);


                    linearScroll.AddView(front);

                    LinearLayout descriptionLayout = new LinearLayout(this);
                    descriptionLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                    descriptionLayout.SetPadding(space, 0, space, space);
                    descriptionLayout.Orientation = Orientation.Vertical;

                    TextView titulo_detalle = new TextView(this);
                    titulo_detalle.Text     = "Descripción";
                    titulo_detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf");
                    titulo_detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(38));
                    titulo_detalle.SetTextColor(Color.ParseColor(Configuration.ListaColores [indice % 6]));
                    titulo_detalle.SetPadding(0, 0, 0, space);
                    descriptionLayout.AddView(titulo_detalle);

                    TextView detalle = new TextView(this);
                    detalle.TextFormatted = Html.FromHtml(slides [0].loparagraph);
                    detalle.Typeface      = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf");
                    detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32));
                    descriptionLayout.AddView(detalle);

                    ViewTreeObserver vto = detalle.ViewTreeObserver;
                    int H = 0;
                    vto.GlobalLayout += (sender, args) =>
                    {
                        H = detalle.Height;
                        Console.WriteLine("TAM:::1:" + H);
                        detalle.LayoutParameters.Height = H - Configuration.getHeight(60);
                    };



                    LinearLayout separationLinear = new LinearLayout(this);
                    separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5);
                    separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8"));
                    separationLinear.Orientation = Orientation.Horizontal;
                    //separationLinear.SetPadding (0,0,0,50);

                    //Añadir mis-Favoritos-----------------------------------------------------------
                    iconFavorito = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/notas.png"), Configuration.getWidth(40), Configuration.getWidth(30), true);
                    //Colocando icono de Favoritos
                    ImageView favorit_ = new ImageView(this);
                    favorit_.Tag = j;
                    favorit_.SetImageBitmap(iconFavorito);
                    favorit_.SetX(Configuration.getWidth(20));
                    favorit_.SetY(Configuration.getHeight(0));
                    favorit_.Click += delegate { funcFavoritos(favorit_); };

                    TextView tomar_notas = new TextView(this);
                    tomar_notas.Text = "Tomar notas";
                    tomar_notas.SetTextColor(Color.ParseColor("#E65100"));
                    tomar_notas.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(21));
                    tomar_notas.SetX(Configuration.getWidth(60));
                    tomar_notas.SetY(Configuration.getHeight(0));
                    tomar_notas.Click += delegate
                    {
                        Bundle bundle = new Bundle();
                        bundle.PutString("Titulo", front.Title);
                        bundle.PutInt("TaskID", isListNotas(front.Title));

                        //Intent nos permite enlazar dos actividades
                        Intent intent = new Intent(this, typeof(NotasItemScreen));
                        //añadir parametros
                        intent.PutExtras(bundle);
                        //ejuta intent
                        StartActivity(intent);
                    };

                    RelativeLayout misFavoritos = new RelativeLayout(this);
                    misFavoritos.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(60));
                    misFavoritos.SetX(Configuration.getWidth(0));
                    misFavoritos.SetY(Configuration.getHeight(0));
                    misFavoritos.AddView(tomar_notas);
                    misFavoritos.AddView(favorit_);
                    linearScroll.AddView(misFavoritos);
                    //FIN FAVoritos-----------------------------------------------------------
                    linearScroll.AddView(descriptionLayout);
                    linearScroll.AddView(separationLinear);

                    listFrontPager.Add(front);

                    var currentpage = s_listp [j].PagesList [k];



                    for (int m = 1; m < slides.Count; m++)
                    {
                        LOSlideSource slidesource = new LOSlideSource(this);

                        var _id_ = vm.LOsInCircle [vm._currentUnidad].lo.color_id;
                        is_main = !is_main;


                        slidesource.ColorS = Configuration.ListaColores [indice % 6];

                        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;
                        }

                        var c_slide = slides [m];


                        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;
                                }


                                var c_item_ize = items [n];

                                slidesource.Itemize.Add(item);
                            }
                        }



                        slidesource.title_page = front.Title;
                        linearScroll.AddView(slidesource.getViewSlide());                                          //Toda la info menos la descripcion
                    }

                    scrollPager.VerticalScrollBarEnabled = false;
                    if (k == 0)
                    {
                        scrollPager.AddView(linearScroll);
                        listaScroll.Add(scrollPager);
                        indice++;
                    }


                    //	}
                }

                //}
            }
            else
            {
                Console.WriteLine("ERROR");
            }


            mainLayoutPages.RemoveAllViews();
            mainLayoutPages.AddView(viewPager);
            mainLayoutPages.SetX(0);
            mainLayoutPages.SetY(0);
            _mainLayout.AddView(mainLayoutPages);

            _publicidadLayout = new LinearLayout(this);
            _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(85));
            Drawable drp = new BitmapDrawable(getBitmapFromAsset("images/footerad.jpg"));

            _publicidadLayout.SetBackgroundDrawable(drp);
            _publicidadLayout.SetY(Configuration.getHeight(1136 - 85));
            _mainLayout.AddView(_publicidadLayout);
            _publicidadLayout.Click += delegate {
                if (adOpen)
                {
                    hideAd();
                }
                else
                {
                    Random rnd = new Random();
                    showAd(rnd.Next(adsImagesPath.Count));
                }
            };


            LOViewAdapter adapter = new LOViewAdapter(this, listaScroll);

            viewPager.Adapter = adapter;
            //viewPager.CurrentItem = IndiceSection;
            //viewPager.SetCurrentItem (vm._currentSection, true);
        }
Beispiel #3
0
        void loadPagesDataSource()
        {
            //var vm = ViewModel as LOViewModel;
            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;

                        if (s_list [j].PagesList [k].cover_bytes != null)
                        {
                            page.Cover = WidgetsUtil.ToUIImage(s_list [j].PagesList [k].cover_bytes);
                        }


                        page.PageIndex  = k;
                        page.StackIndex = j;
                        page.LOIndex    = i;

                        var slides = s_list[j].PagesList[k].content.lopage.loslide;

                        page.Slides = new List <LOSlideSource>();

                        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;
                            }

                            //slidesource.Color = WidgetsUtil.themes[ vm.LOsInCircle [i].lo.color_id % 6];
                            slidesource.Color = WidgetsUtil.themes[j % 6];

                            if (slides[m].loitemize != null)
                            {
                                slidesource.Itemize = new ObservableCollection <LOItemSource>();
                                var items = slides[m].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;  @todo : comente esto :S
                                    slidesource.Itemize.Add(item);
                                }
                            }
                            page.Slides.Add(slidesource);
                        }
                        pageListSource.Add(page);
                    }
                }
            }
            //readerView.Source = pageListSource;

            readerview           = new YReaderView(new CGRect(1024, 0, 1024, 768));
            readerview.PagesList = pageListSource;
            View.Add(readerview);

            readerview.BackButton.TouchUpInside += (sender, e) => {
                UIView.Animate(0.35, () => {
                    readerview.Frame = new CGRect(1024, 0, 1024, 768);
                }, () => {
                    backButton.Hidden = false;
                });
            };
        }
Beispiel #4
0
        void LoadPagesDataSource()
        {
            //LOViewModel vm = ViewModel as LOViewModel;
            //var styles = new StyleConstants();
            //vm.IsLoading.Execute(null);
            bool is_main = true;
            int  space   = Configuration.getWidth(30);
            //	for (int i = 0; i < 3; i++)
            //	{
            var s_listp = vm.LOsInCircle[vm._currentUnidad].stack.StacksList;
            int indice  = 0;

            if (s_listp != null)
            {
                for (int j = 0; j < s_listp.Count; j++)
                {
                    for (int k = 0; k < s_listp [j].PagesList.Count; k++)
                    {
                        VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this);
                        scrollPager.setOnScrollViewListener(this);
                        LinearLayout linearScroll = new LinearLayout(this);
                        linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                        linearScroll.Orientation      = Orientation.Vertical;

                        var content = s_listp [j].PagesList [k].content;
                        FrontContainerViewPager front = new FrontContainerViewPager(this);
                        front.Tag = "pager";


                        front.ImageChapter = s_listp [j].PagesList [k].page.url_img;


                        front.Title       = s_listp [j].PagesList [k].page.title;
                        front.Description = s_listp [j].PagesList [k].page.description;
                        var slides = s_listp [j].PagesList [k].content.lopage.loslide;
                        front.setBack(drBack);


                        linearScroll.AddView(front);

                        LinearLayout descriptionLayout = new LinearLayout(this);
                        descriptionLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);

                        descriptionLayout.Orientation = Orientation.Vertical;

                        int padW = Configuration.getWidth(30);
                        int padH = Configuration.getHeight(30);

                        descriptionLayout.SetPadding(padW, 0, padW, 0);


                        TextView titulo_detalle = new TextView(this);
                        titulo_detalle.Text     = "Descripción";
                        titulo_detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf");
                        titulo_detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(38));
                        titulo_detalle.SetTextColor(Color.ParseColor(Configuration.ListaColores [indice % 6]));
                        descriptionLayout.AddView(titulo_detalle);

                        TextView detalle = new TextView(this);
                        detalle.TextFormatted = Html.FromHtml(slides[0].loparagraph);
                        detalle.Typeface      = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf");
                        detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32));
                        descriptionLayout.AddView(detalle);



                        ViewTreeObserver vto = detalle.ViewTreeObserver;
                        int H = 0;
                        vto.GlobalLayout += (sender, args) => {
                            H = detalle.Height;
                            detalle.LayoutParameters.Height = H - Configuration.getHeight(50);
                        };


                        LinearLayout separationLinear = new LinearLayout(this);
                        separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5);
                        separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8"));
                        separationLinear.Orientation = Orientation.Horizontal;

                        linearScroll.AddView(descriptionLayout);
                        linearScroll.AddView(separationLinear);

                        separationLinear.SetPadding(0, padH, 0, padH);


                        listFrontPager.Add(front);

                        var currentpage = s_listp [j].PagesList [k];



                        for (int m = 1; m < slides.Count; m++)
                        {
                            LOSlideSource slidesource = new LOSlideSource(this);

                            var _id_ = vm.LOsInCircle [vm._currentUnidad].lo.color_id;
                            is_main = !is_main;


                            slidesource.ColorS = Configuration.ListaColores [indice % 6];

                            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;
                            }

                            var c_slide = slides [m];


                            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;
                                    }


                                    var c_item_ize = items [n];

                                    slidesource.Itemize.Add(item);
                                }
                            }



                            linearScroll.AddView(slidesource.getViewSlide());
                        }


                        //linearScroll.SetPadding (padW,padH,padW,padH);

                        scrollPager.VerticalScrollBarEnabled = false;
                        if (k == 0)
                        {
                            scrollPager.AddView(linearScroll);
                            listaScroll.Add(scrollPager);
                            indice++;
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("ERROR");
            }



            //	}
            mainLayoutPages.RemoveAllViews();
            //_progresD.Hide ();
            mainLayoutPages.AddView(viewPager);
            mainLayoutPages.SetX(0);
            mainLayoutPages.SetY(0);
            _mainLayout.AddView(mainLayoutPages);

            _publicidadLayout = new LinearLayout(this);
            _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(85));
            Drawable drp = new BitmapDrawable(getBitmapFromAsset("images/footerad.jpg"));

            _publicidadLayout.SetBackgroundDrawable(drp);
            _publicidadLayout.SetY(Configuration.getHeight(1136 - 85));
            _mainLayout.AddView(_publicidadLayout);
            _publicidadLayout.Click += delegate {
                if (adOpen)
                {
                    hideAd();
                }
                else
                {
                    Random rnd = new Random();
                    showAd(rnd.Next(adsImagesPath.Count));
                }
            };


            LOViewAdapter adapter = new LOViewAdapter(this, listaScroll);

            viewPager.Adapter = adapter;
            //viewPager.CurrentItem = IndiceSection;
            viewPager.SetCurrentItem(vm._currentSection, true);
        }
Beispiel #5
0
        void LoadPagesDataSource()
        {
            var vm = ViewModel as LOViewModel;

            //var styles = new StyleConstants();
            if (vm.LOsInCircle == null)
            {
                return;
            }

            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++)
                {
                    List <LOPageSource> list_lo = new List <LOPageSource> ();
                    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      = MLConstants.BytesToUIImage(s_list[j].PagesList[k].cover_bytes);
                        page.PageIndex  = k;
                        page.StackIndex = j;
                        page.LOIndex    = i;
                        var slides = s_list[j].PagesList[k].content.lopage.loslide;
                        page.Slides = new List <LOSlideSource>();
                        for (int m = 0; m < slides.Count; m++)
                        {
                            LOSlideSource slidesource = new LOSlideSource();
                            slidesource.Style = new LOSlideStyle()
                            {
                                TitleColor = MLConstants.getUIColor(slides [m].lotype, 255)
                            };                                                                                                                                  //[slides[m].lotype];
                            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;
                            }

                            if (slides[m].loitemize != null)
                            {
                                slidesource.Itemize = new ObservableCollection <LOItemSource>();
                                var items = slides[m].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;
                                    }
                                    slidesource.Itemize.Add(item);
                                }
                            }
                            page.Slides.Add(slidesource);
                        }
                        //pages
                        list_lo.Add(page);
                    }
                    pagelistsource.Add(list_lo);
                }
            }

            //readerView.InitContentReader (0);

            //add pages
            //_readerview.Source = pagelistsource;
            //Canvas.SetZIndex(_readerview, 10);
        }
Beispiel #6
0
        void LoadPagesDataSource()
        {
            //LOViewModel vm = ViewModel as LOViewModel;
            //var styles = new StyleConstants();
            //vm.IsLoading.Execute(null);
            bool is_main = true;

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

                if (s_listp != null)
                {
                    for (int j = 0; j < s_listp.Count; j++)
                    {
                        for (int k = 0; k < s_listp [j].PagesList.Count; k++)
                        {
                            VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this);
                            scrollPager.setOnScrollViewListener(this);
                            LinearLayout linearScroll = new LinearLayout(this);
                            linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                            linearScroll.Orientation      = Orientation.Vertical;

                            var content = s_listp [j].PagesList [k].content;
                            FrontContainerViewPager front = new FrontContainerViewPager(this);
                            front.Tag = "pager";


                            front.ImageChapter = s_listp [j].PagesList [k].page.url_img;


                            front.Title       = s_listp [j].PagesList [k].page.title;
                            front.Description = s_listp [j].PagesList [k].page.description;
                            var slides = s_listp [j].PagesList [k].content.lopage.loslide;
                            front.setBack(drBack);


                            linearScroll.AddView(front);
                            listFrontPager.Add(front);

                            var currentpage = s_listp [j].PagesList [k];


                            for (int m = 1; m < slides.Count; m++)
                            {
                                LOSlideSource slidesource = new LOSlideSource(this);

                                var _id_ = vm.LOsInCircle [i].lo.color_id;
                                is_main = !is_main;


                                slidesource.ColorS = Configuration.ListaColores [indice % 6];

                                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;
                                }

                                var c_slide = slides [m];


                                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;
                                        }


                                        var c_item_ize = items [n];

                                        slidesource.Itemize.Add(item);
                                    }
                                }


                                linearScroll.AddView(slidesource.getViewSlide());
                            }

                            scrollPager.VerticalScrollBarEnabled = false;
                            if (k == 0)
                            {
                                scrollPager.AddView(linearScroll);
                                listaScroll.Add(scrollPager);
                                indice++;
                            }
                        }
                    }
                }
                else
                {
                    Console.WriteLine("ERROR");
                }
            }
            mainLayoutPages.RemoveAllViews();
            //_progresD.Hide ();
            mainLayoutPages.AddView(viewPager);
            mainLayoutPages.SetX(0);
            mainLayoutPages.SetY(0);
            _mainLayout.AddView(mainLayoutPages);
            LOViewAdapter adapter = new LOViewAdapter(this, listaScroll);

            viewPager.Adapter     = adapter;
            viewPager.CurrentItem = IndiceSection;
        }
        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 = GetPlainTextFromHtml(slides[m].loparagraph);
                            }
                            if (slides[m].loimage != null)
                            {
                                slidesource.ImageUrl = slides[m].loimage;
                            }
                            if (slides[m].lotext != null)
                            {
                                slidesource.Paragraph = GetPlainTextFromHtml(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 = GetPlainTextFromHtml(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);
        }