private void rewBtn_Click(object sender, EventArgs e) { CurrentRow = 0; serialResponseList.Items.Clear(); sentRowsLbl.Text = "Sent rows: 0"; mViewDevice.CurrentCodeLineIndex = 0; SetupJob(); RenderPanel.Invalidate(); }
private void ProcessFile(string file) { if (file == null) { return; } if (!File.Exists(file)) { MessageBox.Show("File not found: " + file); return; } try { StreamReader reader = new StreamReader(file); string line; SetLoading(true); mViewDevice.Clear(); while ((line = reader.ReadLine()) != null) { GCodeParser.ParseLine(line); } SetLoading(false); reader.Close(); ZoomTextbox.Text = mViewDevice.VisualScale.ToString(); SetupJob(); RenderPanel.Invalidate(); FileNameLabel.Text = Path.GetFileName(file); GetConfig().SetString("last.open.file", file); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BrowseBtn_Click(object sender, EventArgs e) { openFileDialog1.Filter = "G-code Files(*.CNC;*.NC;*.TAP;*.TXT)|*.CNC;*.NC;*.TAP;*.TXT|All files (*.*)|*.*"; openFileDialog1.FileName = ""; if (openFileDialog1.ShowDialog() == DialogResult.OK) { textBox1.Text = openFileDialog1.FileName; if (File.Exists(textBox1.Text)) { mViewDevice.Clear(); using (StreamReader r = new StreamReader(textBox1.Text)) { string line = String.Empty; int rowCounter = 0; while ((line = r.ReadLine()) != null) { if (line.Trim() != "") { gcodeparser.GCodeParser.ParseLine(line); rowCounter++; } } serialResponseList.Items.Clear(); mViewDevice.CurrentCodeLineIndex = 0; SetupJob(); RenderPanel.Invalidate(); rowsInFileLbl.Text = "Rows: " + rowCounter.ToString(); } } } }
void CompositionTarget_Rendering(object sender, EventArgs e) { RenderPanel.Invalidate(); }