diff --git a/d20 SRD Spell Lists Tests/d20SRDSpellLists.Tests.csproj b/d20 SRD Spell Lists Tests/d20SRDSpellLists.Tests.csproj
index f088364..daac301 100644
--- a/d20 SRD Spell Lists Tests/d20SRDSpellLists.Tests.csproj
+++ b/d20 SRD Spell Lists Tests/d20SRDSpellLists.Tests.csproj
@@ -39,7 +39,7 @@
- G:\xunit.net\xunit.dll
+ ..\d20 SRD Spell Lists\lib\xunit.dll
diff --git a/d20 SRD Spell Lists/Extensions/BindingListExtensions.cs b/d20 SRD Spell Lists/Extensions/BindingListExtensions.cs
new file mode 100644
index 0000000..6710b4b
--- /dev/null
+++ b/d20 SRD Spell Lists/Extensions/BindingListExtensions.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace System.ComponentModel
+{
+ public static class BindingListExtensions
+ {
+ public static void AddRange(this BindingList collection, List elements) {
+ foreach (var e in elements)
+ {
+ collection.Add(e);
+ }
+ }
+
+ public static void ReloadFromList(this BindingList collection, List list)
+ {
+ collection.Clear();
+ collection.AddRange(list);
+ }
+
+ public static void Sort(this BindingList collection, IComparer comparer)
+ {
+ List list = collection.ToList();
+ list.Sort(comparer);
+ collection.ReloadFromList(list);
+ }
+ }
+}
diff --git a/d20 SRD Spell Lists/FrmMain.Designer.cs b/d20 SRD Spell Lists/FrmMain.Designer.cs
index 3ab227c..f350e69 100644
--- a/d20 SRD Spell Lists/FrmMain.Designer.cs
+++ b/d20 SRD Spell Lists/FrmMain.Designer.cs
@@ -97,7 +97,6 @@ namespace d20_SRD_Spell_Lists {
this.printDoc = new System.Drawing.Printing.PrintDocument();
this.dataGridViewImageColumn1 = new System.Windows.Forms.DataGridViewImageColumn();
this.dataGridViewImageColumn2 = new System.Windows.Forms.DataGridViewImageColumn();
- this.mainAppUpdater = new Microsoft.Samples.AppUpdater.AppUpdater(this.components);
this.tableLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.mainToolStrip.SuspendLayout();
@@ -106,7 +105,6 @@ namespace d20_SRD_Spell_Lists {
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.mainAppUpdater)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanel1
@@ -871,13 +869,6 @@ namespace d20_SRD_Spell_Lists {
this.dataGridViewImageColumn2.ReadOnly = true;
this.dataGridViewImageColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.True;
//
- // mainAppUpdater
- //
- this.mainAppUpdater.AutoFileLoad = true;
- this.mainAppUpdater.ChangeDetectionMode = Microsoft.Samples.AppUpdater.ChangeDetectionModes.ServerManifestCheck;
- this.mainAppUpdater.ShowDefaultUI = true;
- this.mainAppUpdater.UpdateUrl = "http://downloads.thecharonsheet.com/d20-srd-spell-lists/manifest.xml";
- //
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -900,7 +891,6 @@ namespace d20_SRD_Spell_Lists {
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.mainAppUpdater)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -977,7 +967,6 @@ namespace d20_SRD_Spell_Lists {
private System.Windows.Forms.DataGridViewTextBoxColumn descColumn;
private System.Windows.Forms.DataGridViewImageColumn editColumn;
private System.Windows.Forms.DataGridViewImageColumn deleteColumn;
- private Microsoft.Samples.AppUpdater.AppUpdater mainAppUpdater;
}
}
diff --git a/d20 SRD Spell Lists/FrmMain.cs b/d20 SRD Spell Lists/FrmMain.cs
index bc832d4..4778181 100644
--- a/d20 SRD Spell Lists/FrmMain.cs
+++ b/d20 SRD Spell Lists/FrmMain.cs
@@ -12,6 +12,7 @@ using System.Xml.Serialization;
using System.IO;
using Printing.DataGridViewPrint.Tools;
using System.Reflection;
+using System.Collections.ObjectModel;
namespace d20_SRD_Spell_Lists {
public partial class FrmMain : Form {
@@ -102,15 +103,9 @@ namespace d20_SRD_Spell_Lists {
var result = MessageBox.Show(question, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result == System.Windows.Forms.DialogResult.Yes) {
character.addAllClassSpells();
- refreshSpellList();
}
}
- private void refreshSpellList() {
- spellsDataGridView.DataSource = null;
- setupSpells();
- }
-
private void updateClassInformation(ComboBox classList) {
string charClass = classList.SelectedItem.ToString();
character.CharacterClass = (Character.SpellCastingClasses)Enum.Parse(typeof(Character.SpellCastingClasses), charClass);
@@ -235,7 +230,6 @@ namespace d20_SRD_Spell_Lists {
txtCharacter.Text = character.Name;
txtSpellCastingAttribute.Text = character.SpellCastingAttribute.ToString();
charClassComboBox.SelectedItem = Character.getSpellcastingClassName(character.CharacterClass);
- refreshSpellList();
}
private void btnAdd_Click(object sender, EventArgs e) {
@@ -244,7 +238,6 @@ namespace d20_SRD_Spell_Lists {
if (result == System.Windows.Forms.DialogResult.OK) {
character.Spells.Add(addForm.spell);
character.Spells.Sort(new SpellInequalityComparer());
- refreshSpellList();
dirtyCharacter = true;
}
}
@@ -256,7 +249,6 @@ namespace d20_SRD_Spell_Lists {
var result = editForm.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK) {
character.Spells[character.Spells.IndexOf(editItem)] = editForm.spell;
- refreshSpellList();
dirtyCharacter = true;
}
} else if (isDeleteButtonCell(e)) {
@@ -266,7 +258,6 @@ namespace d20_SRD_Spell_Lists {
var result = MessageBox.Show(msg, title, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == System.Windows.Forms.DialogResult.Yes) {
character.Spells.Remove(deleteItem);
- refreshSpellList();
dirtyCharacter = true;
}
}
diff --git a/d20 SRD Spell Lists/Models/Character.cs b/d20 SRD Spell Lists/Models/Character.cs
index 5a0596e..114c7e2 100644
--- a/d20 SRD Spell Lists/Models/Character.cs
+++ b/d20 SRD Spell Lists/Models/Character.cs
@@ -6,14 +6,16 @@ using System.Xml;
using System.Xml.Linq;
using d20_SRD_Spell_Lists.Exceptions;
using System.Xml.Serialization;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
namespace d20_SRD_Spell_Lists.Models {
public class Character {
- public List Spells { get; set; }
+ public BindingList Spells { get; set; }
public Character() {
- Spells = new List();
+ Spells = new BindingList();
}
private int modifier(int score) {
diff --git a/d20 SRD Spell Lists/Models/MasterSpellSet.cs b/d20 SRD Spell Lists/Models/MasterSpellSet.cs
index b968d4c..a01c4da 100644
--- a/d20 SRD Spell Lists/Models/MasterSpellSet.cs
+++ b/d20 SRD Spell Lists/Models/MasterSpellSet.cs
@@ -133,7 +133,7 @@ namespace d20_SRD_Spell_Lists.Models {
string c = Character.getSpellcastingClassName(characterClass);
Regex levelReg = new Regex(@" (\d+),?");
return (from sp in masterSpellList.Elements("spell")
- let xmlLevel = (string)sp.Element("level")
+ let xmlLevel = (string)sp.Element("level") ?? "0"
orderby (string)sp.Element("name")
where (string)sp.Element("name") == name
select new Spell {
diff --git a/d20 SRD Spell Lists/d20SRDSpellLists.csproj b/d20 SRD Spell Lists/d20SRDSpellLists.csproj
index c33bbc9..8e5b4f8 100644
--- a/d20 SRD Spell Lists/d20SRDSpellLists.csproj
+++ b/d20 SRD Spell Lists/d20SRDSpellLists.csproj
@@ -51,9 +51,6 @@
true
-
- G:\dotnetupdater\AppUpdater\bin\Release\AppUpdater.dll
-
@@ -68,11 +65,9 @@
-
- G:\xunit.net\xunit.dll
-
+
Form