コード例 #1
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <ReplyString> GetUserDetails()
        {
            string      newUrl = url + "GetUserDetails?username=" + UserInfo.GetUser().GetUsername();
            ReplyString ans    = await PostString(newUrl);

            return(ans);
        }
コード例 #2
0
        public UserControlGame(int gameID, int playerID)
        {
            InitializeComponent();
            Receiver.GetReceiver().Attach(this);
            this.gameID        = gameID;
            this.playerID      = playerID;
            seatsHaveBeenTaken = false;
            seats = new Seat[9] {
                new Seat(ImgSmallBigBlind1, TxtUsername1, TxtChips1, TxtBet1), new Seat(ImgSmallBigBlind2, TxtUsername2, TxtChips2, TxtBet2), new Seat(ImgSmallBigBlind3, TxtUsername3, TxtChips3, TxtBet3),
                new Seat(ImgSmallBigBlind4, TxtUsername4, TxtChips4, TxtBet4), new Seat(ImgSmallBigBlind5, TxtUsername5, TxtChips5, TxtBet5), new Seat(ImgSmallBigBlind6, TxtUsername6, TxtChips6, TxtBet6),
                new Seat(ImgSmallBigBlind7, TxtUsername7, TxtChips7, TxtBet7), new Seat(ImgSmallBigBlind8, TxtUsername8, TxtChips8, TxtBet8), new Seat(ImgSmallBigBlind9, TxtUsername9, TxtChips9, TxtBet9)
            };

            LblUsername.Content   = LblUsername.Content + UserInfo.GetUser().GetUsername();
            rdbtFold.Visibility   = Visibility.Hidden;
            rdbtnBet.Visibility   = Visibility.Hidden;
            rdbtnCall.Visibility  = Visibility.Hidden;
            rdbtnCheck.Visibility = Visibility.Hidden;
            btnConfirm.Visibility = Visibility.Hidden;
            txtBetSize.Visibility = Visibility.Hidden;
            txtPotSize.Visibility = Visibility.Hidden;
            lblPotSize.Visibility = Visibility.Hidden;
            hole1.Visibility      = Visibility.Hidden;
            hole2.Visibility      = Visibility.Hidden;
            com1.Visibility       = Visibility.Hidden;
            com2.Visibility       = Visibility.Hidden;
            com3.Visibility       = Visibility.Hidden;
            com4.Visibility       = Visibility.Hidden;
            com5.Visibility       = Visibility.Hidden;
        }
コード例 #3
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <Reply> DeleteAccount()
        {
            Logout();
            string newUrl = url + "DeleteAccount?username=" + UserInfo.GetUser().GetUsername();
            Reply  ans    = await PostBool(newUrl);

            return(ans);
        }
コード例 #4
0
 public Menu()
 {
     InitializeComponent();
     LblUserWelcome.Content = LblUserWelcome.Content + UserInfo.GetUser().GetUsername() + "!";
     if (UserControlTabs.firstInitiate == false)
     {
         btnLogout.Visibility = Visibility.Hidden;
     }
 }
コード例 #5
0
 public UserControlProfile(UserDetails userDetails)
 {
     InitializeComponent();
     this.userDetails      = userDetails;
     LabelUsername.Content = UserInfo.GetUser().GetUsername();
     txbxPassword.Text     = UserInfo.GetUser().GetPassword();
     txbxMail.Text         = userDetails.Email;
     txbxMoney.Text        = userDetails.MoneyBalance.ToString();
 }
コード例 #6
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <ReplyInt> SpectateGame(int gameID)
        {
            string newUrl = url + "SpectateGame?username="******"&gameID=" + gameID;
            ReplyInt ans = await GetIntReply(newUrl);

            return(ans);
        }
コード例 #7
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <Reply> LeaveGame(int gameID)
        {
            string newUrl = url + "LeaveGame?username="******"&gameID=" + gameID;
            Reply ans = await PostBool(newUrl);

            return(ans);
        }
コード例 #8
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <ReplyInt> JoinGame(int gameID)
        {
            string newUrl = url + "JoinGame?username="******"&gameID=" + gameID;
            ReplyInt ans = await PostInt(newUrl);

            return(ans);
        }
コード例 #9
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <Reply> Logout()
        {
            string newUrl = url + "Logout?username=" + UserInfo.GetUser().GetUsername();
            Reply  ans    = await PostBool(newUrl);

            string username = UserInfo.GetUser().GetUsername();

            //signalRClient.disconnect(connections[username]);
            connections.Remove(username);
            return(ans);
        }
コード例 #10
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <Reply> EditProfileEmail(string email)
        {
            if (!email.Equals(""))
            {
                string newUrl = url + "EditProfile?username="******"&password="******"&email=" + email;
                Reply ans = await PostBool(newUrl);

                return(ans);
            }
            return(new Reply(false, "Invalid input!"));
        }
コード例 #11
0
        public UserControlSpectate(int gameID, int spectatorID)
        {
            InitializeComponent();
            Receiver.GetReceiver().Attach(this);
            this.gameID        = gameID;
            this.spectatorID   = spectatorID;
            seatsHaveBeenTaken = false;
            seats = new Seat[9] {
                new Seat(ImgSmallBigBlind1, TxtUsername1, TxtChips1, TxtBet1), new Seat(ImgSmallBigBlind2, TxtUsername2, TxtChips2, TxtBet2), new Seat(ImgSmallBigBlind3, TxtUsername3, TxtChips3, TxtBet3),
                new Seat(ImgSmallBigBlind4, TxtUsername4, TxtChips4, TxtBet4), new Seat(ImgSmallBigBlind5, TxtUsername5, TxtChips5, TxtBet5), new Seat(ImgSmallBigBlind6, TxtUsername6, TxtChips6, TxtBet6),
                new Seat(ImgSmallBigBlind7, TxtUsername7, TxtChips7, TxtBet7), new Seat(ImgSmallBigBlind8, TxtUsername8, TxtChips8, TxtBet8), new Seat(ImgSmallBigBlind9, TxtUsername9, TxtChips9, TxtBet9)
            };

            LblUsername.Content = LblUsername.Content + UserInfo.GetUser().GetUsername();
        }
コード例 #12
0
        private async void BtnSend_OnClick(object sender, RoutedEventArgs e)
        {
            if (!TxtMessage.Text.Equals(""))
            {
                if (TxtTo.Text.Equals(""))
                {
                    Reply accept;
                    try
                    {
                        accept = await Client.SendMessage(UserInfo.GetUser().GetUsername(), TxtMessage.Text, gameID);

                        if (!accept.Sucsses)
                        {
                            MessageBox.Show(accept.ErrorMessage, "Warning");
                        }
                        else
                        {
                            ClearChatFields();
                        }
                    }
                    catch (HttpRequestException exception)
                    {
                        MessageBox.Show(exception.Message, "Warning");
                    }
                }
                else
                {
                    Reply accept;
                    try
                    {
                        accept = await Client.SendWhisper(UserInfo.GetUser().GetUsername(), TxtTo.Text, TxtMessage.Text, gameID);

                        if (!accept.Sucsses)
                        {
                            MessageBox.Show(accept.ErrorMessage, "Warning");
                        }
                        else
                        {
                            ClearChatFields();
                        }
                    }
                    catch (HttpRequestException exception)
                    {
                        MessageBox.Show(exception.Message, "Warning");
                    }
                }
            }
        }
コード例 #13
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <Reply> EditProfilePassword(string password, string email)
        {
            if (!password.Equals(""))
            {
                string newUrl = url + "EditProfile?username="******"&password="******"&email=" + email;
                Reply ans = await PostBool(newUrl);

                if (ans.Sucsses)
                {
                    UserInfo.GetUser().SetPassword(password);
                }
                return(ans);
            }
            return(new Reply(false, "Invalid input!"));
        }
コード例 #14
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        // GameCenter
        public static async Task <ReplyInt> CreateGame(List <KeyValuePair <string, int> > preferenceList)
        {
            string newUrl = url + "CreateGame?username="******"&gameType=" + temp[0].Value;
            newUrl = newUrl + "&minPlayers=" + temp[1].Value;
            newUrl = newUrl + "&maxPlayers=" + temp[2].Value;
            newUrl = newUrl + "&minBet=" + temp[3].Value;
            newUrl = newUrl + "&chipPolicy=" + temp[4].Value;
            newUrl = newUrl + "&spectateGame=" + temp[5].Value;
            newUrl = newUrl + "&buyIn=" + temp[6].Value;
            ReplyInt ans = await PostInt(newUrl);

            return(ans);
        }
コード例 #15
0
ファイル: client.cs プロジェクト: sionovd/TexasHoldem
        public static async Task <Reply> Login(string username, string password)
        {
            if (!username.Equals("") & !password.Equals(""))
            {
                string newUrl = url + "Login?username="******"&password="******"Invalid input!"));
        }
コード例 #16
0
        private async void btnSavePassword_Click(object sender, RoutedEventArgs e)
        {
            if (MainWindow.debug)
            {
                btnEditMail.IsEnabled     = true;
                btnChangePassword.Content = "Change password";
                txbxPassword.IsEnabled    = false;
                btnBack.IsEnabled         = true;
                btnChangePassword.RemoveHandler(Button.ClickEvent,
                                                new RoutedEventHandler(btnSavePassword_Click));
                btnChangePassword.AddHandler(Button.ClickEvent,
                                             new RoutedEventHandler(btnChangePassword_Click));
            }
            else
            {
                Reply accept;
                try
                {
                    accept = await Client.EditProfilePassword(txbxPassword.Text, userDetails.Email);

                    if (!accept.Sucsses)
                    {
                        MessageBox.Show(accept.ErrorMessage, "Warning");
                        txbxPassword.Text         = UserInfo.GetUser().GetPassword();
                        btnEditMail.IsEnabled     = true;
                        btnChangePassword.Content = "Change password";
                        txbxPassword.IsEnabled    = false;
                        btnBack.IsEnabled         = true;
                        btnChangePassword.RemoveHandler(Button.ClickEvent,
                                                        new RoutedEventHandler(btnSavePassword_Click));
                        btnChangePassword.AddHandler(Button.ClickEvent,
                                                     new RoutedEventHandler(btnChangePassword_Click));
                    }
                    else
                    {
                        UserInfo.GetUser().SetPassword(txbxPassword.Text);
                        btnEditMail.IsEnabled     = true;
                        btnChangePassword.Content = "Change password";
                        txbxPassword.IsEnabled    = false;
                        btnBack.IsEnabled         = true;
                        btnChangePassword.RemoveHandler(Button.ClickEvent,
                                                        new RoutedEventHandler(btnSavePassword_Click));
                        btnChangePassword.AddHandler(Button.ClickEvent,
                                                     new RoutedEventHandler(btnChangePassword_Click));
                    }
                }
                catch (HttpRequestException exception)
                {
                    MessageBox.Show(exception.Message, "Warning");
                    txbxPassword.Text         = UserInfo.GetUser().GetPassword();
                    btnEditMail.IsEnabled     = true;
                    btnChangePassword.Content = "Change password";
                    txbxPassword.IsEnabled    = false;
                    btnBack.IsEnabled         = true;
                    btnChangePassword.RemoveHandler(Button.ClickEvent,
                                                    new RoutedEventHandler(btnSavePassword_Click));
                    btnChangePassword.AddHandler(Button.ClickEvent,
                                                 new RoutedEventHandler(btnChangePassword_Click));
                }
            }
        }