Пример #1
0
        // IList<PicturePublic> items;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.IndeterminateProgress);
            SetContentView(Resource.Layout.MyTrophiesLayout);
            this.ActionBar.Title = "Loading Trophies";
            SetProgressBarIndeterminate(true);
            SetProgressBarIndeterminateVisibility(true);

            ((POPpicApplication)Application).GetGameRepository(this).ContinueWith(r => {
                viewModel = new MyTrophiesViewModel(r.Result);
                viewModel.InitializeAsync().ContinueWith(t => {
                    if (!t.IsFaulted)
                    {
                        var thumbnailsFragment            = new MyTrophiesGalleryFragment(this.viewModel.MyBuddyPictures);
                        thumbnailsFragment.ImageSelected += HandleImageSelected;
                        this.DoTransaction(thumbnailsFragment, FragmentTransit.FragmentOpen, false, "My Trophies");
                    }
                    else
                    {
                        AndroidUtilities.ShowAlert(this, "Loading Failed", "Unable to load your trophies");
                    }
                });
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.TabBarController.TabBar.Hidden = true;

            // Register any custom UICollectionViewCell classes
            CollectionView.RegisterClassForCell(typeof(TrophiesCollectionViewControllerCell), TrophiesCollectionViewControllerCell.Key);

            this.viewModel = new MyTrophiesViewModel(AppDelegate.Repository);
            this.viewModel.InitializeAsync().ContinueWith(t => {
                if (!t.IsFaulted && t.Result)
                {
                    BeginInvokeOnMainThread(() => {
                        CollectionView.ReloadData();
                    });
                }
            });
        }
 public void SetViewModel(MyTrophiesViewModel viewModel, int currentIndex)
 {
     this.viewModel    = viewModel;
     this.currentIndex = currentIndex;
 }