public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.NewGame, container, false);

            var adapter = new SpinnerAdapter(this.Activity, Resource.Layout.Row, mTeams.ToArray());

            // Set Home Team
            mHomeTeamName               = view.FindViewById <Spinner>(Resource.Id.homeTeam);
            mHomeTeamName.Adapter       = adapter;
            mHomeTeamName.ItemSelected += setTeam;

            // Set Away Team
            mAwayTeamName               = view.FindViewById <Spinner>(Resource.Id.awayTeam);
            mAwayTeamName.Adapter       = adapter;
            mAwayTeamName.ItemSelected += setTeam;

            // Set Overs
            mOvers               = view.FindViewById <Spinner>(Resource.Id.overs);
            mOvers.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, mOversArray);
            mOvers.ItemSelected += setOvers;

            // Set Location
            mLocation               = view.FindViewById <Spinner>(Resource.Id.location);
            mLocation.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, Locations.ToArray());
            mLocation.ItemSelected += setLocation;

            // Set Umpire one
            mUmpireOne               = view.FindViewById <Spinner>(Resource.Id.umpire1);
            mUmpireOne.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, Umpires.ToArray());
            mUmpireOne.ItemSelected += setUmpires;

            // Set Umpire two
            mUmpireTwo               = view.FindViewById <Spinner>(Resource.Id.umpire2);
            mUmpireTwo.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, Umpires.ToArray());
            mUmpireTwo.ItemSelected += setUmpires;

            // Create Match
            mCreateMatchBtn         = view.FindViewById <Button>(Resource.Id.createMatchButton);
            mCreateMatchBtn.Enabled = false;
            mCreateMatchBtn.Click  += (object sender, EventArgs e) =>
            {
                int matchId = AddMatch();
                if (matchId == 0)
                {
                    return;
                }
                var currentMatchActivity = new Intent(this.Activity, typeof(CurrentMatchActivity));
                currentMatchActivity.PutExtra("MatchId", matchId);
                StartActivity(currentMatchActivity);
                Fragment prev = (DialogFragment)FragmentManager.FindFragmentByTag("newgame dialog");
                if (prev != null)
                {
                    DialogFragment df = (DialogFragment)prev;
                    df.Dismiss();
                }
            };

            return(view);
        }
Пример #2
0
        private void hideErrorDialog()
        {
            DialogFragment errorDialog =
                (DialogFragment)GetFragmentManager().FindFragmentByTag(TAG_ERROR_DIALOG);

            if (errorDialog != null)
            {
                errorDialog.Dismiss();
            }
        }
Пример #3
0
        private void showErrorDialog(DialogFragment errorDialog)
        {
            DialogFragment oldErrorDialog =
                (DialogFragment)GetFragmentManager().FindFragmentByTag(TAG_ERROR_DIALOG);

            if (oldErrorDialog != null)
            {
                oldErrorDialog.Dismiss();
            }

            errorDialog.Show(GetFragmentManager(), TAG_ERROR_DIALOG);
        }
Пример #4
0
            /// <summary>
            /// Called when the permission request is canceled by the web content.
            /// </summary>
            /// <param name="request">Request.</param>
            public override void OnPermissionRequestCanceled(Android.Webkit.PermissionRequest request)
            {
                Log.Info(TAG, "onPermissionRequestCanceled");
                // We dismiss the prompt UI here as the request is no longer valid.
                permissionReqFrag.mPermissionRequest = null;
                DialogFragment fragment = (DialogFragment)permissionReqFrag.ChildFragmentManager
                                          .FindFragmentByTag(FRAGMENT_DIALOG);

                if (null != fragment)
                {
                    fragment.Dismiss();
                }
            }
Пример #5
0
        protected void hideProgressDialog()
        {
            FragmentManager manager = GetFragmentManager();

            if (manager != null)
            {
                DialogFragment progressDialog = (DialogFragment)manager
                                                .FindFragmentByTag(TAG_PROGRESS_DIALOG);
                if (progressDialog != null)
                {
                    progressDialog.Dismiss();
                }
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.NewGameView, container, false);

            mHomeTeamName = view.FindViewById <Spinner>(Resource.Id.homeTeam);
            mAwayTeamName = view.FindViewById <Spinner>(Resource.Id.awayTeam);
            var overs_tournaments = view.FindViewById <TextView>(Resource.Id.overs_tournaments_label);

            mOversOrTournaments = view.FindViewById <Spinner>(Resource.Id.overs_tournaments_values);
            mLocation           = view.FindViewById <Spinner>(Resource.Id.location);
            mUmpireOne          = view.FindViewById <Spinner>(Resource.Id.umpire1);
            mUmpireTwo          = view.FindViewById <Spinner>(Resource.Id.umpire2);

            mCreateMatchBtn         = view.FindViewById <Button>(Resource.Id.createMatchButton);
            mCreateMatchBtn.Enabled = false;
            mCreateMatchBtn.Click  += (object sender, EventArgs e) =>
            {
                var hometeamname       = mHomeTeamName.SelectedItem.ToString();
                var awayteamname       = mAwayTeamName.SelectedItem.ToString();
                var oversOrTournaments = mOversOrTournaments.SelectedItem.ToString();
                var location           = mLocation.SelectedItem.ToString();
                var primaryumpire      = mUmpireOne.SelectedItem.ToString();
                var secondaryumpire    = mUmpireTwo.SelectedItem.ToString();

                var match = ViewModel.AddMatch(hometeamname, awayteamname, oversOrTournaments, location, primaryumpire, secondaryumpire);
                var currentMatchActivity = new Intent(this.Activity, typeof(MatchActivity));
                currentMatchActivity.PutExtra("MatchId", match.Id);
                StartActivity(currentMatchActivity);
                Fragment prev = (DialogFragment)FragmentManager.FindFragmentByTag("newgame dialog");
                if (prev != null)
                {
                    DialogFragment df = (DialogFragment)prev;
                    df.Dismiss();
                }
            };

            return(view);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.DialogDeclare, container, false);

            // Set match result
            mMatchResult               = view.FindViewById <Spinner>(Resource.Id.matchresult);
            mMatchResult.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, MatchResults);
            mMatchResult.ItemSelected += setMatchResult;

            // Set winning team
            mWinner         = view.FindViewById <Spinner>(Resource.Id.winner);
            mWinner.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.Row, TeamNames.ToArray());
            mWinner.Enabled = false;

            mComment = view.FindViewById <EditText>(Resource.Id.comments);

            // Declare match
            mDeclareMatch        = view.FindViewById <Button>(Resource.Id.declarematch);
            mDeclareMatch.Click += (object sender, EventArgs e) =>
            {
                Match.Comments        = mComment.Text;
                Match.Complete        = true;
                Match.WinningTeamName = mWinner.SelectedItem.ToString();
                Access.MatchService.UpdateMatch(Match);

                var currentMatchActivity = new Intent(this.Activity, typeof(CurrentMatchActivity));
                currentMatchActivity.PutExtra("MatchId", Match.Id);
                StartActivity(currentMatchActivity);
                Fragment prev = (DialogFragment)FragmentManager.FindFragmentByTag("declare dialog");
                if (prev != null)
                {
                    DialogFragment df = (DialogFragment)prev;
                    df.Dismiss();
                }
            };
            return(view);
        }