Inheritance: System.Windows.Forms.ListViewItem
Beispiel #1
0
 private void SetGCodeRowBP(GCodeListViewItem gcode)
 {
     if (gcode.Breakpoint)
     {
         gcode.ImageIndex = 1;
         gcode.BackColor = GCODE_BREAKPOINT;
     }
     else
     {
         gcode.ImageIndex = -1;
         gcode.BackColor = Color.FromKnownColor(KnownColor.Window);
     }
 }
Beispiel #2
0
        private void Load_Btn_Click(object sender, EventArgs e)
        {
            openFileDialog.Filter = "G-code Files|*.cnc;*.nc;*.tap;*.txt;*.gcode;*.ngc|All files|*.*";
            openFileDialog.FileName = "";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName.Text = openFileDialog.FileName;

                if (File.Exists(FileName.Text))
                {
                    using (StreamReader r = new StreamReader(FileName.Text))
                    {
                        GCodes.Items.Clear();
                        GCodes.CurrentLine = 0;
                        GCodes.StopLine = -1;
                        Debug_Btn.Enabled = false;
                        string line = String.Empty;

                        while ((line = r.ReadLine()) != null)
                        {
                            line = line.Trim();
                            int i, j;
                            while ((line.Length > 0) && (i = line.IndexOf('(')) >= 0)
                            {
                                j = line.IndexOf(')', i);
                                line = string.Concat(
                                    (i > 0) ? line.Substring(0, i) : string.Empty,
                                    (j >= 0 && j + 1 < line.Length) ? line.Substring(j + 1) : string.Empty
                                    ).Trim();
                            }
                            if (line.Length > 0)
                            {
                                GCodeListViewItem gcode = new GCodeListViewItem();
                                gcode.SubItems.Add(new ListViewItem.ListViewSubItem(gcode, line));
                                GCodes.Items.Add(gcode);
                                if (gcode.Index == GCodes.CurrentLine)
                                {
                                    GCodes.SavedLine = GCodes.CurrentLine;
                                    gcode.BackColor = GCODE_CURRENT;
                                }
                            }
                        }
                        if (GCodes.Items.Count > 0)
                        {
                            TabLogGraph.SelectedTab = PageGCode;
                            Debug_Btn.Enabled = true;
                        }

                        RowsInFileLbl.Text = "Rows: " + GCodes.Items.Count.ToString();
                        r.Close();
                    }
                }

            }
        }
Beispiel #3
0
 private void SetGCodeRowAttributes(GCodeListViewItem gcode)
 {
     SetGCodeRowBP(gcode);
     if (gcode.Index == GCodes.CurrentLine)
         gcode.BackColor = GCODE_CURRENT;
 }