SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
RemoveAssoc.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 SeciUserInterface.Dialogs.AssocFiles
10 {
11  public partial class RemoveFile : Form
12  {
13 
14  private String[] toRemove;
15 
16  public RemoveFile()
17  {
18  InitializeComponent();
19  }
20 
21  private void RemoveExe_Load(object sender, EventArgs e)
22  {
23  List<String> conf = new List<string>(Seci.Managers.AssocFileMgr.GetListOfAsscFiles(false));
24  List<String> comp = new List<string>(Seci.Managers.AssocFileMgr.GetListOfComponentAsscFiles());
25 
26  for (int i = 0; i < conf.Count; ++i)
27  {
28  lstProgs.Items.Add(conf[i]);
29  }
30 
31  for (int i = 0; i < comp.Count; ++i)
32  {
33  lstSubs.Items.Add(comp[i]);
34  }
35  }
36 
37  private void btnRemove_Click(object sender, EventArgs e)
38  {
39  if (lstProgs.SelectedIndex != -1)
40  {
41  lstToRemove.Items.Add(lstProgs.SelectedItem);
42  lstProgs.Items.RemoveAt(lstProgs.SelectedIndex);
43  }
44  }
45 
46  private void btnUndo_Click(object sender, EventArgs e)
47  {
48  if (lstToRemove.SelectedIndex != -1)
49  {
50  lstProgs.Items.Add(lstToRemove.SelectedItem);
51  lstToRemove.Items.RemoveAt(lstToRemove.SelectedIndex);
52  }
53  }
54 
55  private void btnOK_Click(object sender, EventArgs e)
56  {
57  if (lstToRemove.Items.Count > 0)
58  {
59  //Copy the names to remove
60  toRemove = new String[lstToRemove.Items.Count];
61 
62  for (int i = 0; i < lstToRemove.Items.Count; ++i)
63  {
64  toRemove[i] = lstToRemove.Items[i].ToString();
65  }
66  }
67 
68  if (toRemove != null)
69  {
70 
71  //Remove the Progs
72  for (int i = 0; i < toRemove.GetLength(0); ++i)
73  {
74  Seci.Managers.AssocFileMgr.RemoveFile(toRemove[i]);
75  }
76  }
77 
78  DialogResult = DialogResult.OK;
79  Close();
80  }
81 
82 
83 
84  }
85 }
void btnUndo_Click(object sender, EventArgs e)
Definition: RemoveAssoc.cs:46
void RemoveExe_Load(object sender, EventArgs e)
Definition: RemoveAssoc.cs:21
void btnOK_Click(object sender, EventArgs e)
Definition: RemoveAssoc.cs:55
void btnRemove_Click(object sender, EventArgs e)
Definition: RemoveAssoc.cs:37