private async void button1_Click(object sender, EventArgs e) { if (validateInput()) { using (RandomPicture atask = new RandomPicture()) { Task <string> getImage = atask.GetRandomImage(); progressLabel.Text = "Generating Character"; string path = await getImage; progressLabel.Text = "Completed!"; ShowMyImage(path, 200, 200); Job j; Race r; if (DataManager.GetJobs().TryGetValue(JobBox.Text, out j) && DataManager.GetRaces().TryGetValue(RaceBox.Text, out r)) { Character character = new Character(charName.Text, GenderBox.Text, j, r); bool success = await DataManager.AddCharacter(character); if (!success) { progressLabel.Text = "Character already exist!"; } } } } }
public void CharacterSelect() { DataManager.CharacterIsSelected[activeCharacter] = true; DataManager.AddCharacter(); }