Beispiel #1
0
        static void AddGames()
        {
            IGameManipulations gameLogic = new GameLogic();

            // add games
            Console.WriteLine("-> adding games...");
            Console.WriteLine("\t\t#Method AddOrUpdateGame()");
            gameLogic.AddOrUpdateGame(new GameType("GTA 5", ParticipantTypes.All));
            gameLogic.AddOrUpdateGame(new GameType("World of Warcraft", ParticipantTypes.Solo));
            gameLogic.AddOrUpdateGame(new GameType("Rome 2", ParticipantTypes.Team));
            // print games
            Console.WriteLine("\t\t#Method GameType.ToString()");
            Console.WriteLine("------- Games -------");
            foreach (GameType g in gameLogic.GetGames())
            {
                Console.WriteLine("  " + g.ToString());
            }
            Console.WriteLine("------- @@@@@ -------\n\n");
            // wait for user
            Wait();
        }
Beispiel #2
0
        private void btnAddGame_Click(object sender, EventArgs e)
        {
            IGameManipulations gameLogic = new GameLogic();

            try
            {
                gameLogic.AddOrUpdateGame(new GameType(tbGameName.Text, (ParticipantTypes)Enum.Parse(typeof(ParticipantTypes), upDownGameTypes.SelectedItem.ToString())));
                tbGameName.Text = "";
                UpdateGameList();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error: Add Player", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            UpdateTree();
        }