Mercurial > repos > WarFoundryForge
diff FrmSystem.cs @ 12:6284c091b132
Merge local with IBBoard
author | Tsudico |
---|---|
date | Fri, 17 Dec 2010 22:14:43 -0600 |
parents | 43d88f50c712 |
children | 372f921c20fc |
line wrap: on
line diff
--- a/FrmSystem.cs Fri Dec 17 20:14:43 2010 +0000 +++ b/FrmSystem.cs Fri Dec 17 22:14:43 2010 -0600 @@ -211,6 +211,22 @@ break; } } + if(this.listCategories.SelectedIndex == 0) + { + this.btnCategoryUp.Enabled = false; + } + else + { + this.btnCategoryUp.Enabled = true; + } + if (this.listCategories.SelectedIndex == this.listCategories.Items.Count - 1) + { + this.btnCategoryDown.Enabled = false; + } + else + { + this.btnCategoryDown.Enabled = true; + } } private void btnCategoryAdd_Click(object sender, EventArgs e) @@ -254,6 +270,60 @@ updateCategoryList(); } + private void btnCategoryUp_Click(object sender, EventArgs e) + { + int index = this.listCategories.SelectedIndex; + IBBoard.WarFoundry.API.Objects.Category[] catList = new IBBoard.WarFoundry.API.Objects.Category[this.listCategories.Items.Count]; + + for(int i = 0; i < system.Categories.Length; i++) + { + catList[i] = system.Categories[i]; + } + foreach(IBBoard.WarFoundry.API.Objects.Category cat in system.Categories) + { + system.RemoveCategory(cat.ID); + } + + IBBoard.WarFoundry.API.Objects.Category temp = catList[index]; + catList[index] = catList[index - 1]; + catList[index - 1] = temp; + + for(int i = catList.Length - 1; i >= 0; i--) + { + system.AddCategory(catList[i]); + } + + updateCategoryList(); + this.listCategories.SelectedIndex = index - 1; + } + + private void btnCategoryDown_Click(object sender, EventArgs e) + { + int index = this.listCategories.SelectedIndex; + IBBoard.WarFoundry.API.Objects.Category[] catList = new IBBoard.WarFoundry.API.Objects.Category[this.listCategories.Items.Count]; + + for (int i = 0; i < system.Categories.Length; i++) + { + catList[i] = system.Categories[i]; + } + foreach (IBBoard.WarFoundry.API.Objects.Category cat in system.Categories) + { + system.RemoveCategory(cat.ID); + } + + IBBoard.WarFoundry.API.Objects.Category temp = catList[index]; + catList[index] = catList[index + 1]; + catList[index + 1] = temp; + + for (int i = catList.Length - 1; i >= 0; i--) + { + system.AddCategory(catList[i]); + } + + updateCategoryList(); + this.listCategories.SelectedIndex = index + 1; + } + private void txtCategoryName_TextChanged(object sender, EventArgs e) { if (this.UpdateCategory)