-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathFormChooseCharacter.cs
74 lines (61 loc) · 2.19 KB
/
FormChooseCharacter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Rawr
{
/**
* FormChooseCharacter
* @author Charinna
* This class/form allows a user to select a Realm & Character from a list
* of realms & characters found in a CharacterProfiler export.
*/
public partial class FormChooseCharacter : Form
{
CharacterProfilerData m_characterList;
public CharacterProfilerCharacter Character
{
get { return m_characterList.Realms[comboBoxRealm.SelectedIndex].Characters[comboBoxCharacter.SelectedIndex]; }
}
public FormChooseCharacter(CharacterProfilerData characterList)
{
InitializeComponent();
m_characterList = characterList;
foreach (CharacterProfilerFailedImport error in m_characterList.Errors)
{
object[] asRowData = { error.Realm, error.Character, error.Error };
dataGridFailedImport.Rows.Add(asRowData);
}
foreach (CharacterProfilerRealm realm in m_characterList.Realms)
{
comboBoxRealm.Items.Add(realm.Name);
}
comboBoxRealm.SelectedIndex = 0;
updateCharacterList();
}
private void comboBoxRealm_SelectedIndexChanged(object sender, EventArgs e)
{
updateCharacterList();
}
private void comboBoxCharacter_SelectedIndexChanged(object sender, EventArgs e)
{
updateCharacterSummary();
}
private void updateCharacterList()
{
comboBoxCharacter.Items.Clear();
foreach (CharacterProfilerCharacter character in m_characterList.Realms[comboBoxRealm.SelectedIndex].Characters)
{
comboBoxCharacter.Items.Add(character.Name);
}
comboBoxCharacter.SelectedIndex = 0;
}
private void updateCharacterSummary()
{
labelDescription.Text = m_characterList.Realms[comboBoxRealm.SelectedIndex].Characters[comboBoxCharacter.SelectedIndex].Summary;
}
}
}