예제 #1
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;
        }
예제 #2
0
 public Menu()
 {
     InitializeComponent();
     LblUserWelcome.Content = LblUserWelcome.Content + UserInfo.GetUser().GetUsername() + "!";
     if (UserControlTabs.firstInitiate == false)
     {
         btnLogout.Visibility = Visibility.Hidden;
     }
 }
 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();
 }
예제 #4
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();
        }
예제 #5
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");
                    }
                }
            }
        }
        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));
                }
            }
        }