private void guiAddProfile_Click(object sender, EventArgs e) { BattleTag battleTag; try { battleTag = new BattleTag(guiBattleTag.Text); } catch (Exception) { MessageBox.Show("Battle Tag syntax is invalid: verify the battle tag."); return; } var host = (Host)guiBattleNetHostList.SelectedItem; var profileExists = config.Profiles.Any(p => p.BattleTag.Id.ToLower() == battleTag.Id.ToLower() && p.Host.Url == host.Url); if (profileExists) { MessageBox.Show("The profile already exists."); return; } FetchCareer(battleTag, host); var profileContainer = new D3ProfileContainer(battleTag, host); config.Profiles.Add(profileContainer); AddProfile(profileContainer); }
private void AddProfile(D3ProfileContainer profileContainer) { var control = new BNetProfileControl(profileContainer.BattleTag, profileContainer.Host) { Tag = profileContainer }; control.Click += bNetProfileControl_Click; guiProfilePanel.Controls.Add(control); }