private void CustomItem_DoubleClick(object sender, EventArgs e)
 {
     if (sender is Panel)
     {
         Panel suspect = (Panel)sender;
         if (Int32.TryParse(suspect.Name, out int x))
         {
             //USER HAS CLICKED ON A GAME PANEL
             //we Go in the game library
             //Console.WriteLine(StoreLibrary[x].myInfo());
             if (Application.OpenForms.OfType <GamePage>().Count() >= 1)
             {
                 Application.OpenForms.OfType <GamePage>().First().Close();
             }
             GamePage gamePage = new GamePage(StoreLibrary[x], LoggedUser, this, GameCart);
             gamePage.Show();
             Console.WriteLine("BrowseStore. Activate GamePage");
         }
         else
         {
             Console.WriteLine("BrowseStore. Other label");
         }
     }
 }
Exemple #2
0
 private void CustomItem_DoubleClick(object sender, EventArgs e)
 {
     if (sender is Panel)
     {
         Panel suspect = (Panel)sender;
         //Console.WriteLine(suspect.Name);
         if (Int32.TryParse(suspect.Name, out int x))
         {
             //USER HAS CLICKED ON A GAME PANEL
             //we Go in the game library
             //Console.WriteLine(StoreLibrary[x].myInfo());
             if (Application.OpenForms.OfType <GamePage>().Count() >= 1)
             {
                 Application.OpenForms.OfType <GamePage>().First().Close();
             }
             GamePage gamePage = new GamePage(StoreLibrary[x], LoggedIn, this, InCart);
             gamePage.Show();
         }
         else
         {
             Console.WriteLine("WelcomePage.  Other label");
         }
     }
     else if (sender is Label)
     {
         Label suspect = (Label)sender;
         if (suspect.Name.Equals(this.LogOutLabel.Name))
         {
             mainform.SetDesktopLocation(this.Location.X, this.Location.Y);
             mainform.Show();
             CloseUp = false;
             this.Close();
         }
         else if (suspect.Name.Equals(this.UserFunds.Name))
         {
             //Going to add money
             string answer = Microsoft.VisualBasic.Interaction.InputBox("Enter how much money you would like to add",
                                                                        "Adding Funds",
                                                                        "0.00",
                                                                        MousePosition.X,
                                                                        MousePosition.Y);
             double addedmoney = 0;
             try
             {
                 addedmoney = Math.Round(Convert.ToDouble(answer), 2);
             }
             catch
             {
                 Console.WriteLine("WelcomePage. Some error");
             }
             LoggedIn.Funds     += addedmoney;
             this.UserFunds.Text = string.Format("{0:C}", (LoggedIn.Funds));
             FAM.saveUser(LoggedIn);
         }
         else if (suspect.Name.Equals(this.InCartLabel.Name))
         {
             if (Application.OpenForms.OfType <GameCart>().Count() >= 1)
             {
                 Application.OpenForms.OfType <GameCart>().First().Close();
             }
             MakeCart(this, LoggedIn, InCart);
         }
     }
 }