changeset 10:43d88f50c712

Continued work on Category Tab Up and Down buttons adjust category position.
author Tsudico
date Fri, 17 Dec 2010 22:02:04 -0600
parents 0dadaa315430
children 38f0ed348ca8
files FrmSystem.Designer.cs FrmSystem.cs
diffstat 2 files changed, 72 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/FrmSystem.Designer.cs	Thu Dec 16 18:52:30 2010 -0600
     1.2 +++ b/FrmSystem.Designer.cs	Fri Dec 17 22:02:04 2010 -0600
     1.3 @@ -520,6 +520,7 @@
     1.4  			this.btnCategoryUp.TabIndex = 17;
     1.5  			this.btnCategoryUp.Text = "Up";
     1.6  			this.btnCategoryUp.UseVisualStyleBackColor = true;
     1.7 +			this.btnCategoryUp.Click += new System.EventHandler(this.btnCategoryUp_Click);
     1.8  			// 
     1.9  			// listCategories
    1.10  			// 
    1.11 @@ -538,6 +539,7 @@
    1.12  			this.btnCategoryDown.TabIndex = 16;
    1.13  			this.btnCategoryDown.Text = "Down";
    1.14  			this.btnCategoryDown.UseVisualStyleBackColor = true;
    1.15 +			this.btnCategoryDown.Click += new System.EventHandler(this.btnCategoryDown_Click);
    1.16  			// 
    1.17  			// btnCategoryAdd
    1.18  			// 
     2.1 --- a/FrmSystem.cs	Thu Dec 16 18:52:30 2010 -0600
     2.2 +++ b/FrmSystem.cs	Fri Dec 17 22:02:04 2010 -0600
     2.3 @@ -211,6 +211,22 @@
     2.4  					break;
     2.5  				}
     2.6  			}
     2.7 +			if(this.listCategories.SelectedIndex == 0)
     2.8 +			{
     2.9 +				this.btnCategoryUp.Enabled = false;
    2.10 +			}
    2.11 +			else
    2.12 +			{
    2.13 +				this.btnCategoryUp.Enabled = true;
    2.14 +			}
    2.15 +			if (this.listCategories.SelectedIndex == this.listCategories.Items.Count - 1)
    2.16 +			{
    2.17 +				this.btnCategoryDown.Enabled = false;
    2.18 +			}
    2.19 +			else
    2.20 +			{
    2.21 +				this.btnCategoryDown.Enabled = true;
    2.22 +			}
    2.23  		}
    2.24  
    2.25  		private void btnCategoryAdd_Click(object sender, EventArgs e)
    2.26 @@ -254,6 +270,60 @@
    2.27  			updateCategoryList();
    2.28  		}
    2.29  
    2.30 +		private void btnCategoryUp_Click(object sender, EventArgs e)
    2.31 +		{
    2.32 +			int index = this.listCategories.SelectedIndex;
    2.33 +			IBBoard.WarFoundry.API.Objects.Category[] catList = new IBBoard.WarFoundry.API.Objects.Category[this.listCategories.Items.Count];
    2.34 +			
    2.35 +			for(int i = 0; i < system.Categories.Length; i++)
    2.36 +			{
    2.37 +				catList[i] = system.Categories[i];
    2.38 +			}
    2.39 +			foreach(IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
    2.40 +			{
    2.41 +				system.RemoveCategory(cat.ID);
    2.42 +			}
    2.43 +			
    2.44 +			IBBoard.WarFoundry.API.Objects.Category temp = catList[index];
    2.45 +			catList[index] = catList[index - 1];
    2.46 +			catList[index - 1] = temp;
    2.47 +			
    2.48 +			for(int i = catList.Length - 1; i >= 0; i--)
    2.49 +			{
    2.50 +				system.AddCategory(catList[i]);
    2.51 +			}
    2.52 +			
    2.53 +			updateCategoryList();
    2.54 +			this.listCategories.SelectedIndex = index - 1;
    2.55 +		}
    2.56 +
    2.57 +		private void btnCategoryDown_Click(object sender, EventArgs e)
    2.58 +		{
    2.59 +			int index = this.listCategories.SelectedIndex;
    2.60 +			IBBoard.WarFoundry.API.Objects.Category[] catList = new IBBoard.WarFoundry.API.Objects.Category[this.listCategories.Items.Count];
    2.61 +
    2.62 +			for (int i = 0; i < system.Categories.Length; i++)
    2.63 +			{
    2.64 +				catList[i] = system.Categories[i];
    2.65 +			}
    2.66 +			foreach (IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
    2.67 +			{
    2.68 +				system.RemoveCategory(cat.ID);
    2.69 +			}
    2.70 +
    2.71 +			IBBoard.WarFoundry.API.Objects.Category temp = catList[index];
    2.72 +			catList[index] = catList[index + 1];
    2.73 +			catList[index + 1] = temp;
    2.74 +
    2.75 +			for (int i = catList.Length - 1; i >= 0; i--)
    2.76 +			{
    2.77 +				system.AddCategory(catList[i]);
    2.78 +			}
    2.79 +
    2.80 +			updateCategoryList();
    2.81 +			this.listCategories.SelectedIndex = index + 1;
    2.82 +		}
    2.83 +
    2.84  		private void txtCategoryName_TextChanged(object sender, EventArgs e)
    2.85  		{
    2.86  			if (this.UpdateCategory)