Esempio n. 1
0
        private void InvitePlayer_Click(object sender, System.EventArgs e, int playerId, int clubId)
        {
            AlertDialog.Builder alert       = new AlertDialog.Builder(_activity);
            EditText            description = new EditText(_activity);

            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent,
                                                                         LinearLayout.LayoutParams.WrapContent);

            lp.LeftMargin  = 60;
            lp.RightMargin = 60;
            description.LayoutParameters = lp;
            alert.SetView(description);
            alert.SetTitle("Покана на играч");
            alert.SetMessage("Добавете описание към поканата");
            alert.SetPositiveButton("Покани", async(senderAlert, args) =>
            {
                InvitePlayerRequest invitePlayer = new InvitePlayerRequest
                {
                    PlayerId    = playerId,
                    ClubId      = clubId,
                    Description = description.Text
                };

                HttpResponseMessage invitePlayerHttpResponse = await RestManager.InvitePlayer(invitePlayer);

                if (invitePlayerHttpResponse.IsSuccessStatusCode)
                {
                    Toast.MakeText(_activity, "Играчът е поканен!", ToastLength.Short).Show();
                }
            });

            alert.SetNegativeButton("Отказ", (senderAlert, args) =>
            {
                return;
            });

            Dialog dialog = alert.Create();

            dialog.Show();
        }