private void undoToolStripMenuItem_Click(object sender, EventArgs e) { try { CustomM4Editor editor = (CustomM4Editor)tabControl1.SelectedTab.Controls[0]; editor.deshacer(); } catch (Exception ex) { } }
private void executeObject(string fileName) { this.txtConsole.Clear(); CustomM4Editor editor = (CustomM4Editor)tabControl1.SelectedTab.Controls[0]; Process proc = new Process { StartInfo = new ProcessStartInfo { FileName = "scanner\\objeto\\" + fileName, Arguments = "\"" + editor.FileName + "\"", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true } }; proc.Start(); while (!proc.StandardOutput.EndOfStream) { string line = proc.StandardOutput.ReadLine(); var decompose = line.Split('~'); if (decompose.Count() >= 2) { var lineNUmber = Convert.ToInt32(decompose[1]); editor.create_hint(decompose[0], lineNUmber); } else { this.txtConsole.Text += line + Environment.NewLine; } // do something with line } }
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) { try { CustomM4Editor editor = (CustomM4Editor)tabControl1.SelectedTab.Controls[0]; editor.seleccionarTodo(); } catch (Exception ex) { } }
private void saveToolStripButton_Click(object sender, EventArgs e) { try { CustomM4Editor editor = (CustomM4Editor)tabControl1.SelectedTab.Controls[0]; editor.guardar(); MessageBox.Show("Archivo guardado exitosamente", "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { } }
private void createNewTabFromFile(string filePath) { String[] substrings = filePath.Split('\\'); string fileName = substrings[substrings.Length - 1]; TabPage tab = new TabPage(fileName); CustomM4Editor editor = new CustomM4Editor(filePath); editor.Dock = DockStyle.Fill; editor.ContextMenuStrip = cmMain; tabControl1.TabPages.Add(tab); tab.Controls.Add(editor); changeFormText(); }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { try { CustomM4Editor editor = (CustomM4Editor)tabControl1.SelectedTab.Controls[0]; SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "M4 file|*.m4"; saveFileDialog1.Title = "Save an M4 File"; saveFileDialog1.ShowDialog(); // If the file name is not an empty string open it for saving. if (saveFileDialog1.FileName != "") { // Saves the Image via a FileStream created by the OpenFile method. editor.FileName = saveFileDialog1.FileName; editor.guardar(); MessageBox.Show("Archivo guardado exitosamente", "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { } }
private void changeFormText() { CustomM4Editor editor = (CustomM4Editor)tabControl1.SelectedTab.Controls[0]; this.Text = "IDE M4 - " + editor.FileName; }