2 using System.Collections;
3 using System.Collections.Generic;
4 using System.ComponentModel;
8 using System.Windows.Forms;
10 namespace SeciUserInterface.Dialogs.VIs
12 public partial class AddVI : Form
14 private List<String> _toAdd =
new List<String>();
15 public List<String> VIsToAdd {
get {
return _toAdd; } }
19 InitializeComponent();
23 browseDialog.InitialDirectory = Seci.Definitions.Status.LabViewDir;
28 dataGridView1.Visible =
false;
29 btnAdd.Location =
new System.Drawing.Point(btnAdd.Location.X, 34);
30 btnCancel.Location =
new System.Drawing.Point(btnCancel.Location.X, 34);
31 this.Size =
new System.Drawing.Size(this.Size.Width, 100);
36 dataGridView1.Visible =
true;
37 btnAdd.Location =
new System.Drawing.Point(btnAdd.Location.X, 236);
38 btnCancel.Location =
new System.Drawing.Point(btnCancel.Location.X, 236);
39 this.Size =
new System.Drawing.Size(this.Size.Width, 303);
47 DialogResult res = browseDialog.ShowDialog();
48 if (res == DialogResult.OK)
50 txtVI.Text = browseDialog.FileName;
52 if (browseDialog.FileName.ToLower().EndsWith(
".llb"))
57 List<String> panels = Seci.Managers.LabViewMgr.GetLlbInfo(browseDialog.FileName);
59 if ((panels != null) && (panels.Count > 0))
62 for (
int i = 0; i < panels.Count; ++i)
64 String[] rowInfo = panels[i].Split(
';');
66 String VIname = rowInfo[0].Replace(browseDialog.FileName,
"");
68 if (rowInfo[1] ==
"no")
70 dataGridView1.Rows.Add(VIname,
false,
false);
74 dataGridView1.Rows.Add(VIname,
true,
false);
93 if (!String.IsNullOrEmpty(txtVI.Text))
95 btnAdd.Enabled =
false;
97 if (txtVI.Text.ToLower().EndsWith(
".vi"))
99 _toAdd.Add(txtVI.Text);
101 else if (txtVI.Text.ToLower().EndsWith(
".llb"))
104 for (
int i = 0; i < dataGridView1.Rows.Count; ++i)
106 if (dataGridView1.Rows[i].Cells[2].Value.ToString() ==
"True")
108 _toAdd.Add(txtVI.Text + dataGridView1.Rows[i].Cells[0].Value.ToString());
113 DialogResult = DialogResult.OK;
118 MessageBox.Show(
"Please select a VI to add.",
"VI Not Selected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
void btnBrowse_Click(object sender, EventArgs e)
void btnAdd_Click(object sender, EventArgs e)