SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
RemoveFiles.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.Text;
7 using System.Windows.Forms;
8 
9 namespace Sample_Environment_Control_Interface.Dialogs.Associated_Files
10 {
11  public partial class RemoveFiles : Form
12  {
13 
14  private String[] toRemove;
15 
16  public RemoveFiles()
17  {
18  InitializeComponent();
19  }
20 
21  private void RemoveFiles_Load(object sender, EventArgs e)
22  {
23  lstFiles.Items.AddRange(Seci.SeciInterface.Assoc_GetListOfFiles().ToArray());
24  }
25 
26  private void btnRemove_Click(object sender, EventArgs e)
27  {
28  if (lstFiles.SelectedIndex != -1)
29  {
30  lstToRemove.Items.Add(lstFiles.SelectedItem);
31  lstFiles.Items.RemoveAt(lstFiles.SelectedIndex);
32  }
33  }
34 
35  private void btnUndo_Click(object sender, EventArgs e)
36  {
37  if (lstToRemove.SelectedIndex != -1)
38  {
39  lstFiles.Items.Add(lstToRemove.SelectedItem);
40  lstToRemove.Items.RemoveAt(lstToRemove.SelectedIndex);
41  }
42  }
43 
44  private void btnOK_Click(object sender, EventArgs e)
45  {
46  if (lstToRemove.Items.Count > 0)
47  {
48  //Copy the names to remove
49  toRemove = new String[lstToRemove.Items.Count];
50 
51  for (int i = 0; i < lstToRemove.Items.Count; ++i)
52  {
53  toRemove[i] = lstToRemove.Items[i].ToString();
54  }
55  }
56 
57  if (toRemove != null)
58  {
59 
60  //Remove the Assocfiles
61  for (int i = 0; i < toRemove.GetLength(0); ++i)
62  {
63  Seci.SeciInterface.Assoc_RemoveFile(toRemove[i]);
64  }
65  }
66 
67  DialogResult = DialogResult.OK;
68  Close();
69  }
70 
71 
72 
73  }
74 }