Example #1
0
        private void WishListOnclick(string name)
        {
            this.Close();
            myHome.Show();

            myHome.setLibpanelVisible(false);
            myHome.setGameDetailpanelVisible(true);

            for (int i = 0; i < myHome.saveGamePreviews.Count(); i++)
            {
                if (myHome.saveGamePreviews.ElementAt(i).gameO.Name == name)
                {
                    myHome.currGame = myHome.saveGamePreviews.ElementAt(i).gameO;
                    myHome.LoadGamePanel(myHome.currGame);
                }
            }
        }
Example #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFreecode.Text))
            {
                MessageBox.Show("You should enter free code!", "Error");
            }
            else
            {
                var response = AccountsControllerShould.PostEnterFreeCodeAccountController(new FreeCode(txtFreecode.Text), id);

                var rs   = response.IsSuccess.ToString();
                var mess = response.Message;

                if (rs == "False")
                {
                    if (mess.Equals("Object reference not set to an instance of an object."))
                    {
                        txtFreecode.Text = "";
                        MessageBox.Show("Free code is wrong!", "Error");
                    }
                    else
                    {
                        txtFreecode.Text = "";
                        MessageBox.Show("Free code used!\nYou already have this game!", "Error");
                    }
                }
                else
                {
                    MessageBox.Show("Get game success!");
                    for (int i = 0; i < myHome.lib_game.Count(); i++)
                    {
                        if (myHome.lib_game.ElementAt(i).Id.ToString() == response.Payload.gameId)
                        {
                            myHome.user_game.Add(myHome.lib_game.ElementAt(i));
                            break;
                        }
                    }
                    myHome.showListGame();
                    myHome.setLibpanelVisible(true);
                    myHome.setStorepanelVisible(false);
                    this.Close();
                }
            }
        }