Esempio n. 1
0
        private void addBotBtn_Click(object sender, EventArgs e)
        {
            if (botChampionCombo.SelectedItem == null || botTeamCombo.SelectedItem == null || botDifficultyCombo.SelectedItem == null)
            {
                return;
            }
            Lobby lobby = null;

            try
            {
                lobby = QsoApi.GetMyLobby();
            }
            catch (QsoEndpointException)
            {
                return; // lobby doesn't exist, no need for user response.
            }

            try
            {
                lobby.AddBot((ChampionID)Enum.Parse(typeof(ChampionID), (string)botChampionCombo.SelectedItem), (TeamID)Enum.Parse(typeof(TeamID), (string)botTeamCombo.SelectedItem), (string)botDifficultyCombo.SelectedItem);
            }
            catch (QsoEndpointException ex)
            {
                MessageBox.Show($"Unable to add bot to lobby with such configuration:\n{ex.ErrorResponse.Message}", "Endpoint Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }