private void button1_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "XLS files (*.xls)|*.xls;*.xlsx;*.xlsm"; if (dlg.ShowDialog() == DialogResult.OK) { dissableAll(); TheClass.createapliXL(); if (!listBox1.Items.Contains("File: " + Path.GetFileName(dlg.FileName))) { string nombreOWB = TheClass.openingWB(dlg.FileName); listBox1.Items.Add("File: " + nombreOWB); TheClass.createnewWB(nombreOWB); TheClass.addnewWBtoArrayLst(); } changeFieldsbydefault(); enableAll(); } }
private void button3_Click(object sender, EventArgs e) { if ((textBox1.Text != "Source") && (textBox2.Text != "IDs") && (textBox3.Text != "Translations")) { if (TheClass.checklimitcolums(textBox1.Text, textBox2.Text, textBox3.Text.Split(new Char[] { ' ', ',', '-' }), button4.BackColor) == true) { dissableAll(); if (button4.BackColor == Color.DarkRed) { TheClass.superswitch(int.Parse(textBox1.Text), int.Parse(textBox2.Text), textBox3.Text.Split(new Char[] { ' ', ',', '-' }), textBox4.Text, textBox5.Text, checkBox1.Checked, checkBox2.Checked); } else { string[] columnsLoc = new string[textBox3.Text.Split(new Char[] { ' ', ',', '-' }).Length]; for (int i = 0; i < columnsLoc.Length; i++) { if (textBox3.Text.Split(new Char[] { ' ', ',', '-' })[i] != "") { columnsLoc[i] = TheClass.GetIndexInAlphabet(textBox3.Text.Split(new Char[] { ' ', ',', '-' })[i][0]).ToString(); } } TheClass.superswitch(TheClass.GetIndexInAlphabet(textBox1.Text[0]), TheClass.GetIndexInAlphabet(textBox2.Text[0]), columnsLoc, textBox4.Text, textBox5.Text, checkBox1.Checked, checkBox2.Checked); } enableAll(); if (TheClass.thereareissues() == true) { SaveFileDialog svf = new SaveFileDialog(); DialogResult svfR; svf.OverwritePrompt = false; svf.Filter = "XLS files (*.xls)|*.xls"; do { svfR = svf.ShowDialog(); } while (listBox1.Items.Contains("File: " + Path.GetFileName(svf.FileName))); if (svfR == DialogResult.OK) { dissableAll(); checkBox1.Enabled = false; checkBox2.Enabled = false; TheClass.cerraroWB(); try { TheClass.returnWBReport().SaveAs(svf.FileName); MessageBox.Show("Export success", "Congratulations!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBox1.Text = "Nice"; textBox2.Text = "Work"; textBox3.Text = "=)"; } catch { MessageBox.Show("Cannot save the Report in \n" + svf.FileName + "\n Try to close the Report file before saving on it", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBox1.Text = "Good"; textBox2.Text = "Try"; textBox3.Text = "=)"; } listBox1.Items.Clear(); TheClass.cerrartodo(); TheClass.cleanWorkbooksArray(); } } else { dissableAll(); MessageBox.Show("There are not numeric issues!", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Hand); listBox1.Items.Clear(); TheClass.cerrartodo(); TheClass.cleanWorkbooksArray(); textBox1.Text = "Good"; textBox2.Text = "Try"; textBox3.Text = "=)"; } } else { MessageBox.Show("Please make sure that you insert \nintegers as column values less than 37 and different than 0.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please make sure that you fill \nin all the mandatory fields properly.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
protected override void OnClosed(EventArgs e) { TheClass.cerrartodo(); }