예제 #1
0
        //Listeners
        //Listener for double clicking
        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))
                {
                    //It's a game label, since its a number
                    //Console.WriteLine(PersonalLibrary[x].myInfo());
                    GamePage newPage = new GamePage(PersonalLibrary[x], LoggedIn, this, null);

                    //newPage.beOwned();      //game is owned by someone

                    newPage.Show();
                }
                else
                {
                    Console.WriteLine("Other label");
                }
            }
            else if (sender is Label)
            {
                Label suspect = (Label)sender;
                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",
                                                                               "Default",
                                                                               MousePosition.X,
                                                                               MousePosition.Y);
                    double addedmoney = 0;
                    //hello there
                    try {
                        addedmoney = Math.Round(Convert.ToDouble(answer), 2);
                    }
                    catch {
                        Console.WriteLine("Some error");
                    }
                    LoggedIn.Funds     += addedmoney;
                    this.UserFunds.Text = string.Format("{0:C}", (LoggedIn.Funds));
                    FAM.saveUser(LoggedIn);
                }
                else if (suspect.Name.Equals(this.BackButtonLabel.Name))
                {
                    //Go back to the previous page
                    parentForm.SetDesktopLocation(this.Location.X, this.Location.Y);
                    parentForm.Show();
                    CloseUp = false;
                    this.Close();
                }
            }
        }
예제 #2
0
 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");
         }
     }
 }
예제 #3
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);
         }
     }
 }