public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // this.TabBarController.TabBar.Hidden = false;

            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);

            addButton.Clicked += (s, ev) => {
                var selectFriendViewModel = new SelectFriendSourceViewModel(AppDelegate.Repository);
                BTProgressHUD.Show("Loading", -1, ProgressHUD.MaskType.Black);
                selectFriendViewModel.InitializeAsync().ContinueWith(t => {
                    InvokeOnMainThread(() => {
                        BTProgressHUD.Dismiss();
                        var selectFriendViewController = new SelectFriendDialogViewController(selectFriendViewModel);
                        this.NavigationController.PushViewController(selectFriendViewController, true);
                    });
                });
            };

            // var trophyButton = new UIBarButtonItem (UIBarButtonSystemItem.Action);
            var trophyImage  = UIImage.FromBundle("trophyIcon.png");
            var trophyButton = new UIBarButtonItem(trophyImage, UIBarButtonItemStyle.Plain, null);

            trophyButton.Clicked += (s, ev) => {
                var layout = new UICollectionViewFlowLayout();
                layout.SectionInset            = new UIEdgeInsets(5, 5, 5, 5);
                layout.MinimumInteritemSpacing = 5;
                layout.MinimumLineSpacing      = 5;
                layout.ItemSize = new System.Drawing.SizeF(100, 100);
                var trophiesController = new TrophiesCollectionViewControllerController(
                    layout);
                this.NavigationController.PushViewController(trophiesController, true);
            };

            this.NavigationItem.RightBarButtonItems = new UIBarButtonItem[] {
                addButton,
                trophyButton
            };

            this.TableView.Source = tableSource;
        }
예제 #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            myView = inflater.Inflate(Resource.Layout.SelectFriendSourceLayout, container, false);


            this.viewModel = new SelectFriendSourceViewModel();
            this.viewModel.FriendSources.Add(FriendSourceViewModel.CreateModel("Facebook Friends", "play against your Facebook friends", Resource.Drawable.facebook_icon, FriendSourceId.FACEBOOK));

            var rootView            = myView.FindViewById <LinearLayout> (Resource.Id.linearLayout1);
            var topList             = Utility.CreateListView(this.viewModel.FriendSourceHeader, rootView, Resources, inflater);
            var bottomList          = Utility.CreateListView(this.viewModel.RecentFriendsHeader, rootView, Resources, inflater);
            var friendSourceAdapter = new AndroidSelectFriendSourceListAdapter(this.Activity, this.viewModel.FriendSources);

            friendSourceAdapter.OptionSelected += this.FriendSourceOptionSelected;
            topList.Adapter = friendSourceAdapter;

            Utility.SetListViewHeightBasedOnChildren2(topList);
            Utility.SetListViewHeightBasedOnChildren2(bottomList);

            return(myView);
        }