private void createCharButton_Click(object sender, EventArgs e) { SimpleCharacter chara = new SimpleCharacter(charNameBox.Text, (int)charInitBox.Value, (int)bodyAtrInput.Value, (int)agilityAtrInput.Value, (int)reactionAtrInput.Value, (int)strengthAtrInput.Value, (int)charismaAtrInput.Value, (int)intuitionAtrInput.Value, (int)logicAtrInput.Value, (int)willpowerAtrInput.Value); addCharacterToCharacterList(chara); PersistentListHandler.WriteListFile(charList); }
private void delCharButton_Click(object sender, EventArgs e) { charList.RemoveAt(charListBox.SelectedIndex); charListBox.DataSource = null; charListBox.DataSource = charList; charListBox.ValueMember = "Name"; charListBox.DisplayMember = "name"; PersistentListHandler.WriteListFile(charList); }
private void ImportCharacterButton_Click(object sender, EventArgs e) { DialogResult res = openFileDialog1.ShowDialog(); if (res == DialogResult.OK) // Test result. { string file = openFileDialog1.FileName; ChummerCharacter cc = ChummerCharacter.Load(file); cc.ParseAttributes(); string name = cc.alias; //string arm = cc.primaryarm; SimpleCharacter cha = new SimpleCharacter(cc.alias, 1, cc.BOD, cc.AGI, cc.REA, cc.STR, cc.CHA, cc.INT, cc.LOG, cc.WIL); addCharacterToCharacterList(cha); } PersistentListHandler.WriteListFile(charList); }
private void editCharButton_Click(object sender, EventArgs e) { if (charListBox.SelectedItem != null) { SimpleCharacter chara = new SimpleCharacter(charNameBox.Text, (int)charInitBox.Value, (int)bodyAtrInput.Value, (int)agilityAtrInput.Value, (int)reactionAtrInput.Value, (int)strengthAtrInput.Value, (int)charismaAtrInput.Value, (int)intuitionAtrInput.Value, (int)logicAtrInput.Value, (int)willpowerAtrInput.Value); charList[charListBox.SelectedIndex] = chara; charListBox.DataSource = null; //charList.RemoveAt(charListBox.SelectedIndex-1); //charList.Insert(charListBox.SelectedIndex, chara); charListBox.DataSource = charList; charListBox.ValueMember = "Name"; charListBox.DisplayMember = "name"; } PersistentListHandler.WriteListFile(charList); }