comparison FrmSystem.cs @ 12:6284c091b132

Merge local with IBBoard
author Tsudico
date Fri, 17 Dec 2010 22:14:43 -0600
parents 43d88f50c712
children 372f921c20fc
comparison
equal deleted inserted replaced
9:b42ba80ec613 12:6284c091b132
209 } 209 }
210 this.btnCategoryApply.Enabled = false; 210 this.btnCategoryApply.Enabled = false;
211 break; 211 break;
212 } 212 }
213 } 213 }
214 if(this.listCategories.SelectedIndex == 0)
215 {
216 this.btnCategoryUp.Enabled = false;
217 }
218 else
219 {
220 this.btnCategoryUp.Enabled = true;
221 }
222 if (this.listCategories.SelectedIndex == this.listCategories.Items.Count - 1)
223 {
224 this.btnCategoryDown.Enabled = false;
225 }
226 else
227 {
228 this.btnCategoryDown.Enabled = true;
229 }
214 } 230 }
215 231
216 private void btnCategoryAdd_Click(object sender, EventArgs e) 232 private void btnCategoryAdd_Click(object sender, EventArgs e)
217 { 233 {
218 if(this.txtCategoryName.Text == string.Empty) 234 if(this.txtCategoryName.Text == string.Empty)
252 } 268 }
253 } 269 }
254 updateCategoryList(); 270 updateCategoryList();
255 } 271 }
256 272
273 private void btnCategoryUp_Click(object sender, EventArgs e)
274 {
275 int index = this.listCategories.SelectedIndex;
276 IBBoard.WarFoundry.API.Objects.Category[] catList = new IBBoard.WarFoundry.API.Objects.Category[this.listCategories.Items.Count];
277
278 for(int i = 0; i < system.Categories.Length; i++)
279 {
280 catList[i] = system.Categories[i];
281 }
282 foreach(IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
283 {
284 system.RemoveCategory(cat.ID);
285 }
286
287 IBBoard.WarFoundry.API.Objects.Category temp = catList[index];
288 catList[index] = catList[index - 1];
289 catList[index - 1] = temp;
290
291 for(int i = catList.Length - 1; i >= 0; i--)
292 {
293 system.AddCategory(catList[i]);
294 }
295
296 updateCategoryList();
297 this.listCategories.SelectedIndex = index - 1;
298 }
299
300 private void btnCategoryDown_Click(object sender, EventArgs e)
301 {
302 int index = this.listCategories.SelectedIndex;
303 IBBoard.WarFoundry.API.Objects.Category[] catList = new IBBoard.WarFoundry.API.Objects.Category[this.listCategories.Items.Count];
304
305 for (int i = 0; i < system.Categories.Length; i++)
306 {
307 catList[i] = system.Categories[i];
308 }
309 foreach (IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
310 {
311 system.RemoveCategory(cat.ID);
312 }
313
314 IBBoard.WarFoundry.API.Objects.Category temp = catList[index];
315 catList[index] = catList[index + 1];
316 catList[index + 1] = temp;
317
318 for (int i = catList.Length - 1; i >= 0; i--)
319 {
320 system.AddCategory(catList[i]);
321 }
322
323 updateCategoryList();
324 this.listCategories.SelectedIndex = index + 1;
325 }
326
257 private void txtCategoryName_TextChanged(object sender, EventArgs e) 327 private void txtCategoryName_TextChanged(object sender, EventArgs e)
258 { 328 {
259 if (this.UpdateCategory) 329 if (this.UpdateCategory)
260 { 330 {
261 this.btnCategoryApply.Enabled = true; 331 this.btnCategoryApply.Enabled = true;