using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using CSOCR.Properties; using System.Text; using System.IO; using System.Windows.Forms; using System.IO.Ports; using System.Threading; namespace CSOCR { public partial class Form1 : Form { // The main control for communicating through the RS-232 port private SerialPort comport = new SerialPort(); // Various colors for logging info private Color[] LogMsgTypeColor = { Color.Blue, Color.Green, Color.Black, Color.Orange, Color.Red }; // Temp holder for whether a key was pressed private bool KeyHandled = false; private Settings settings = Settings.Default; public Form1() { // Load user settings settings.Reload(); // Build the form InitializeComponent(); // Restore the users settings InitializeControlValues(); // Enable/disable controls based on the current state EnableControls(); // When data is recieved through the port, call this method comport.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived); comport.PinChanged += new SerialPinChangedEventHandler(comport_PinChanged); } private void Log(LogMsgType msgtype, string msg) // this is my first error { rtfTerminal.Invoke(new EventHandler(delegate { rtfTerminal.SelectedText = string.Empty; rtfTerminal.SelectionFont = new Font(rtfTerminal.SelectionFont, FontStyle.Bold); rtfTerminal.SelectionColor = LogMsgTypeColor[(int)msgtype]; rtfTerminal.AppendText(msg); rtfTerminal.ScrollToCaret(); })); } private DataMode CurrentDataMode // this is my second error { get { if (rbHex.Checked) return DataMode.Hex; else return DataMode.Text; } set { if (value == DataMode.Text) rbText.Checked = true; else rbHex.Checked = true; } } } }
using
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)