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; } } }
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(); } }
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(); } } } }
public static void Run(clsGame prGame) { Instance.SetDetails(prGame); }
internal async static Task <string> InsertGameAsync(clsGame game) { return(await InsertOrUpdateAsync(game, "http://localhost:60064/api/game/PostGame", "POST")); }
internal static void DispatchGameForm(clsGame prGame) { _GamesForm[prGame.Type].DynamicInvoke(prGame); }
public void SetDetails(clsGame prGame) { _Game = prGame; updateForm(); Show(); }