-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserialWizard.cs
118 lines (102 loc) · 3.98 KB
/
serialWizard.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Script_Builder
{
public partial class serialWizard : Form
{
public DataTable TblSerialTable;
private mainForm mainForm;
public string LinkTableA { get; private set; }
public string LinkTableB { get; private set; }
public serialWizard(mainForm mainForm, string[] SerialInputTable, DataTable TblSerialTable, string LinkTableA, string LinkTableB)
{
InitializeComponent();
this.mainForm = mainForm;
cboInputLinkB.Items.AddRange(SerialInputTable);
this.TblSerialTable = TblSerialTable;
updateTable();
if (LinkTableA != "")
cboInputLinkA.Text = LinkTableA;
if (LinkTableB != "")
cboInputLinkB.Text = LinkTableB;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
private void btnAccept_Click(object sender, EventArgs e)
{
LinkTableA = cboInputLinkA.SelectedItem != null ? cboInputLinkA.SelectedItem.ToString() : "";
LinkTableB = cboInputLinkB.SelectedItem != null ? cboInputLinkB.SelectedItem.ToString() : "";
dgvSerialInputTable.Enabled = false;
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void spalteHinzuToolStripMenuItem_Click(object sender, EventArgs e)
{
TblSerialTable.Columns.Add();
updateTable();
}
private void updateTable()
{
dgvSerialInputTable.DataSource = TblSerialTable.DefaultView;
cboInputLinkA.Items.Clear();
for (int iSpalte = 0; iSpalte < TblSerialTable.Columns.Count; iSpalte++)
cboInputLinkA.Items.Add(TblSerialTable.Columns[iSpalte].Caption);
}
private void spalteToolStripMenuItem_Click(object sender, EventArgs e)
{
TblSerialTable.Clear();
TblSerialTable.Columns.Clear();
updateTable();
}
private void überschriftInErsterZeileToolStripMenuItem_Click(object sender, EventArgs e)
{
mainForm.headerInFirstRow(TblSerialTable);
updateTable();
}
private void excelDatenAusToolStripMenuItem_Click(object sender, EventArgs e)
{
mainForm.PasteExcelData(TblSerialTable);
updateTable();
}
private void tabelleExportierenToolStripMenuItem_Click(object sender, EventArgs e)
{
mainForm.exportTableToFile(mainForm, TblSerialTable);
}
private void tabelleInportierenToolStripMenuItem_Click(object sender, EventArgs e)
{
mainForm.importTableFromFile(mainForm, TblSerialTable);
updateTable();
}
private void dgvSerialInputTable_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
mainForm.changeTableHeader(mainForm, TblSerialTable, e.ColumnIndex);
}
}
private void dgvSerialInputTable_KeyPress(object sender, KeyPressEventArgs e)
{
if ((int)e.KeyChar == 22)
{
mainForm.PasteExcelData(TblSerialTable);
e.Handled = true;
}
}
private void dgvSerialInputTable_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
statusLabel.Text = mainForm.programmStrings.GetString("textEntities") + TblSerialTable.Rows.Count.ToString();
}
private void verknüpfungLösenToolStripMenuItem_Click(object sender, EventArgs e)
{
cboInputLinkA.SelectedItem = null;
cboInputLinkB.SelectedItem = null;
}
}
}