Пример #1
0
 private void lbGames_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbGames.Items.Count > 0)
     {
         clsGame lcGame = lbGames.SelectedItem as clsGame;
         if (lcGame != null)
         {
             string lcInfo = "Game Details:" +
                             "\nName: " + lcGame.Name +
                             "\nCategory: " + lcGame.Catergory +
                             "\nType: " + lcGame.Type +
                             "\nStock: " + lcGame.Stock.ToString() +
                             "\nPrice: " + lcGame.Price.ToString();
             if (lcGame.Type == "disc")
             {
                 lcInfo = lcInfo + "\nWeight: " + lcGame.Weight.ToString() +
                          "\nShipping: " + lcGame.Shipping.ToString();
             }
             else
             {
                 lcInfo = lcInfo + "\nSerial: " + lcGame.Serial +
                          "\nDownload: " + lcGame.Download;
             }
             lblGameInfo.Text = lcInfo;
         }
     }
 }
Пример #2
0
        private async void btnDeleteGame_Click(object sender, EventArgs e)
        {
            int lcIndex = lbGames.SelectedIndex;

            if (lcIndex >= 0 && MessageBox.Show("Are you sure?", "Deleting Game", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                clsGame lcGame = lbGames.SelectedItem as clsGame;
                MessageBox.Show(await clsServiceCalls.DeleteGameAsync(lcGame.Id.ToString()));
                UpdateDisplay();
                frmMain.Instance.UpdateDisplay();
            }
        }
Пример #3
0
        private void btnAddGame_Click(object sender, EventArgs e)
        {
            string lcReply = cmbType.Text;

            if (!string.IsNullOrEmpty(lcReply)) // not cancelled?
            {
                clsGame lcGame = clsGame.NewWork(lcReply);
                if (lcGame != null) // valid artwork created?
                {
                    lcGame.Catergory = _Catergory.Name;
                    frmDetails.DispatchGameForm(lcGame);
                    if (!string.IsNullOrEmpty(lcGame.Name)) // not cancelled?
                    {
                        UpdateDisplay();
                        frmMain.Instance.UpdateDisplay();
                    }
                }
            }
        }
Пример #4
0
 public static void Run(clsGame prGame)
 {
     Instance.SetDetails(prGame);
 }
Пример #5
0
 internal async static Task <string> InsertGameAsync(clsGame game)
 {
     return(await InsertOrUpdateAsync(game, "http://localhost:60064/api/game/PostGame", "POST"));
 }
Пример #6
0
 internal static void DispatchGameForm(clsGame prGame)
 {
     _GamesForm[prGame.Type].DynamicInvoke(prGame);
 }
Пример #7
0
 public void SetDetails(clsGame prGame)
 {
     _Game = prGame;
     updateForm();
     Show();
 }