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_list = vm.LOsInCircle[i].stack.StacksList; //if (Configuration.IndiceActual == i) { int indice = 0; for (int j = 0; j < s_list.Count; j++) { for (int k = 0; k < s_list [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; //LOPageSource page = new LOPageSource(); var content = s_list [j].PagesList [k].content; FrontContainerViewPager front = new FrontContainerViewPager (this); front.Tag = "pager"; //front.ImageChapter = vm.LOsInCircle [i].lo.url_background; front.ImageChapter = s_list [j].PagesList[k].page.url_img; /* Bitmap bm = BitmapFactory.DecodeByteArray (s_list [j].PagesList [k].cover_bytes, 0, s_list [j].PagesList [k].cover_bytes.Length); front.ImageChapterBitmap = bm; bm = null; */ front.Title = s_list [j].PagesList [k].page.title; front.Description = s_list [j].PagesList [k].page.description; var slides = s_list [j].PagesList [k].content.lopage.loslide; front.setBack (drBack); //revisar si slides == null; //vm.OpenPageCommand.Execute (s_list [j].PagesList [k]); //var slides2 = s_list [j].PagesList [k].content.lopage.loslide. linearScroll.AddView (front); listFrontPager.Add (front); //listFrontPager [i].setBack (drBack); //vm.OpenPageCommand.Execute(s_list[j].PagesList[k]); var currentpage = s_list [j].PagesList [k]; //var pagerr = s_list[j].PagesList[k].content.lopage.loslide 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; //Console.WriteLine ("TIPOOOOOOOOOO = " + slides [m].lotype); 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; //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); } } linearScroll.AddView (slidesource.getViewSlide()); } scrollPager.VerticalScrollBarEnabled = false; scrollPager.AddView (linearScroll); listaScroll.Add (scrollPager); indice++; } //} } //} } 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() { //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); }
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; }