Пример #1
0
        void HandleFriendSourceOptionSelected(object sender, FriendSourceViewModel e)
        {
            switch (e.SourceId)
            {
            case FriendSourceId.FACEBOOK:
                var selectFacebookFriendFragment = new SelectFacebookFriendFragment();
                selectFacebookFriendFragment.FriendSelected -= HandleFriendSelected;
                selectFacebookFriendFragment.FriendSelected += HandleFriendSelected;
                DoTransaction(selectFacebookFriendFragment, FragmentTransit.FragmentOpen, true, "Choose Facebook Friend");
                break;

            case FriendSourceId.RANDOM:
                break;

            case FriendSourceId.RANDOM_NEARBY:
                break;
            }
        }
Пример #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);
        }