SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
AddFiles.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.ComponentModel;
5 using System.Data;
6 using System.Drawing;
7 using System.Text;
8 using System.Windows.Forms;
9 
10 namespace Sample_Environment_Control_Interface.Dialogs.Associated_Files
11 {
19  public partial class AddFiles : Form
20  {
24  public AddFiles()
25  {
26  InitializeComponent();
27  }
28 
34  private void btnAdd_Click(object sender, EventArgs e)
35  {
36  if (openFileDialog1.ShowDialog() == DialogResult.OK)
37  {
38  foreach (String filename in openFileDialog1.FileNames)
39  {
40  lstFiles.Items.Add(filename);
41  }
42  }
43  }
44 
50  private void btnOK_Click(object sender, EventArgs e)
51  {
52  ArrayList fails = new ArrayList();
53 
54  for (int i = 0; i < lstFiles.Items.Count; ++i)
55  {
56  Boolean result = Seci.SeciInterface.Assoc_AddFile(new Seci.AssociatedFile(lstFiles.Items[i].ToString()));
57 
58  if (!result)
59  {
60  fails.Add(lstFiles.Items[i].ToString());
61  }
62 
63  }
64 
65  if (fails.Count > 0)
66  {
67  String mess = "";
68 
69  for (int j = 0; j < fails.Count; ++j)
70  {
71  mess += "\t" + fails[j].ToString();
72  }
73 
74  MessageBox.Show("The following associated files have already been added to the configuration:\n\n" + mess, "Duplication!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
75  }
76 
77  DialogResult = DialogResult.OK;
78  Close();
79  }
80  }
81 }