Пример #1
0
        private async void SetContent(bool userAccount)
        {
            //add activity indicator while contents load
            innerGrid.Children.Clear();
            activityIndicator.IsRunning = true;
            innerGrid.Children.Add(activityIndicator, 0, 0);
            Grid.SetRowSpan(activityIndicator, 5);
            Grid.SetColumnSpan(activityIndicator, 2);
            if (_homePageViewModel.VimeoInfo == null)
            {
                await _homePageViewModel.GetVimeo(vimeoUrl);
            }
            if (_homePageViewModel.Successful)
            {
                activityIndicator.IsRunning = false;
                VimeoInfo = _homePageViewModel.VimeoInfo;
#if __ANDROID__
                androidVideo1Lbl.Text = VimeoInfo.data[0].name;
                androidVideo2Lbl.Text = VimeoInfo.data[1].name;
#endif
                video1Image.Source = VimeoInfo.data[0].pictures.sizes[4].link;
                video2Image.Source = VimeoInfo.data[1].pictures.sizes[4].link;
                video1Lbl.Text     = VimeoInfo.data[0].name;
                video2Lbl.Text     = VimeoInfo.data[1].name;

                if (userAccount)
                {
                    innerGrid.Children.Clear();
#if __ANDROID__
                    innerGrid.Children.Add(contenViewWhatsNewLbl, 0, 0);
                    Grid.SetColumnSpan(contenViewWhatsNewLbl, 2);
                    innerGrid.Children.Add(video1Frame, 0, 1);
                    Grid.SetColumnSpan(video1Frame, 2);
                    innerGrid.Children.Add(contentViewVideo1Lbl, 0, 1);
                    Grid.SetColumnSpan(contentViewVideo1Lbl, 2);
                    innerGrid.Children.Add(video2Frame, 0, 2);
                    Grid.SetColumnSpan(video2Frame, 2);
                    Grid.SetRowSpan(video2Frame, 2);
                    innerGrid.Children.Add(contentViewVideo2Lbl, 0, 2);
                    Grid.SetColumnSpan(contentViewVideo2Lbl, 2);
                    Grid.SetRowSpan(contentViewVideo2Lbl, 2);
                    innerGrid.Children.Add(contentViewPlayListLbl, 0, 4);
                    Grid.SetColumnSpan(contentViewPlayListLbl, 2);
                    innerGrid.Children.Add(androidViewPlaylistBtn.ToView(), 0, 5);
                    innerGrid.Children.Add(androidAddPlaylistBtn.ToView(), 1, 5);
#endif
#if __IOS__
                    innerGrid.Children.Add(whatsNewLbl, 0, 0);
                    Grid.SetColumnSpan(whatsNewLbl, 2);
                    innerGrid.Children.Add(video1Frame, 0, 1);
                    Grid.SetColumnSpan(video1Frame, 2);
                    innerGrid.Children.Add(video1Lbl, 0, 1);
                    Grid.SetColumnSpan(video1Lbl, 2);
                    innerGrid.Children.Add(video2Frame, 0, 2);
                    Grid.SetColumnSpan(video2Frame, 2);
                    Grid.SetRowSpan(video2Frame, 2);
                    innerGrid.Children.Add(video2Lbl, 0, 2);
                    Grid.SetColumnSpan(video2Lbl, 2);
                    Grid.SetRowSpan(video2Lbl, 2);
                    innerGrid.Children.Add(playListLbl, 0, 4);
                    Grid.SetColumnSpan(playListLbl, 2);
                    innerGrid.Children.Add(viewPlaylistBtn, 0, 5);
                    innerGrid.Children.Add(addPlaylistBtn, 1, 5);
#endif
                }
                else
                {
#if __IOS__
                    innerGrid.Children.Clear();
                    innerGrid.Children.Add(whatsNewLbl, 0, 0);
                    Grid.SetColumnSpan(whatsNewLbl, 2);
                    innerGrid.Children.Add(video1Frame, 0, 1);
                    Grid.SetColumnSpan(video1Frame, 2);
                    Grid.SetRowSpan(video1Frame, 2);
                    innerGrid.Children.Add(video1Lbl, 0, 1);
                    Grid.SetColumnSpan(video1Lbl, 2);
                    Grid.SetRowSpan(video1Lbl, 2);
                    innerGrid.Children.Add(video2Frame, 0, 3);
                    Grid.SetColumnSpan(video2Frame, 2);
                    Grid.SetRowSpan(video2Frame, 3);
                    innerGrid.Children.Add(video2Lbl, 0, 3);
                    Grid.SetColumnSpan(video2Lbl, 2);
                    Grid.SetRowSpan(video2Lbl, 3);
#endif
#if __ANDROID__
                    innerGrid.Children.Clear();
                    innerGrid.Children.Add(contenViewWhatsNewLbl, 0, 0);
                    Grid.SetColumnSpan(contenViewWhatsNewLbl, 2);
                    innerGrid.Children.Add(video1Frame, 0, 1);
                    Grid.SetColumnSpan(video1Frame, 2);
                    Grid.SetRowSpan(video1Frame, 2);
                    innerGrid.Children.Add(contentViewVideo1Lbl, 0, 1);
                    Grid.SetColumnSpan(contentViewVideo1Lbl, 2);
                    Grid.SetRowSpan(contentViewVideo1Lbl, 2);
                    innerGrid.Children.Add(video2Frame, 0, 3);
                    Grid.SetColumnSpan(video2Frame, 2);
                    Grid.SetRowSpan(video2Frame, 3);
                    innerGrid.Children.Add(contentViewVideo2Lbl, 0, 3);
                    Grid.SetColumnSpan(contentViewVideo2Lbl, 2);
                    Grid.SetRowSpan(contentViewVideo2Lbl, 3);
#endif
                }
            }
            else
            {
#if __IOS__
                innerGrid.Children.Clear();
                innerGrid.Children.Add(timeOutFrame, 0, 0);
                Grid.SetRowSpan(timeOutFrame, 5);
                Grid.SetRowSpan(timeOutLbl, 5);
                Grid.SetColumnSpan(timeOutFrame, 2);
                Grid.SetColumnSpan(timeOutLbl, 2);
#endif
#if __ANDROID__
                SetContent(this.account);
#endif
            }
        }