SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
OrderGroups.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 
10 namespace SeciUserInterface.Dialogs.Blocks
11 {
12  public partial class OrderGroups : Form
13  {
14  public List<String> Order = new List<string>();
15 
16  public OrderGroups()
17  {
18  InitializeComponent();
19  }
20 
21  private void OrderGroups_Load(object sender, EventArgs e)
22  {
23  populateList();
24  }
25 
26  private void populateList()
27  {
28  lstGroups.Items.Clear();
29  for (int i = 0; i < Order.Count; ++i)
30  {
31  lstGroups.Items.Add(Order[i]);
32  }
33  }
34 
35  private void btnOK_Click(object sender, EventArgs e)
36  {
37  DialogResult = System.Windows.Forms.DialogResult.OK;
38  Close();
39  }
40 
41  private void btnCancel_Click(object sender, EventArgs e)
42  {
43 
44  }
45 
46  private void btnUp_Click(object sender, EventArgs e)
47  {
48  if (lstGroups.SelectedIndex != -1 && lstGroups.SelectedIndex > 0)
49  {
50  string temp = Order[lstGroups.SelectedIndex - 1];
51  Order.RemoveAt(lstGroups.SelectedIndex - 1);
52  Order.Insert(lstGroups.SelectedIndex, temp);
53  int index = lstGroups.SelectedIndex;
54  populateList();
55  lstGroups.SelectedIndex = index - 1;
56  }
57  }
58 
59  private void btnDown_Click(object sender, EventArgs e)
60  {
61  if (lstGroups.SelectedIndex != -1 && lstGroups.SelectedIndex < Order.Count - 1)
62  {
63  string temp = Order[lstGroups.SelectedIndex + 1];
64  Order.RemoveAt(lstGroups.SelectedIndex + 1);
65  Order.Insert(lstGroups.SelectedIndex, temp);
66  int index = lstGroups.SelectedIndex;
67  populateList();
68  lstGroups.SelectedIndex = index + 1;
69  }
70  }
71  }
72 }
void btnOK_Click(object sender, EventArgs e)
Definition: OrderGroups.cs:35
void btnCancel_Click(object sender, EventArgs e)
Definition: OrderGroups.cs:41
void btnDown_Click(object sender, EventArgs e)
Definition: OrderGroups.cs:59
void OrderGroups_Load(object sender, EventArgs e)
Definition: OrderGroups.cs:21
void btnUp_Click(object sender, EventArgs e)
Definition: OrderGroups.cs:46