Пример #1
0
 public DataPointViewConfig(int rx, int ry, bool showXText, bool showYText, AssistLineStratogy als)
 {
     this.rangeX = rx;
     this.rangeY = ry;
     this.showXText = showXText;
     this.showYText = showYText;
     this.alStratogy = als;
 }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            strategy = new AssistLineStratogy();
            userName = "";
            dataRecord = new List<GripData>();
            perRecord = new ArrayList();
            isReceiving = false;

            baudRate = 115200;
            portName = "";
            parity = Parity.None;
            dataBits = 8;
            stopBits = StopBits.One;

            tempStringBuilder = new StringBuilder();

            connected = false;
            comboBoxPorts.Items.Clear();
            sp = new SerialPort();
            sp.ReadTimeout = 1000;

            refreshTimer = new System.Windows.Forms.Timer();
            refreshTimer.Interval = 40;

            pointsPerSecond = 1/dataTimeSpan;

            try
            {
                string[] str = SerialPort.GetPortNames();
                if (str.Equals(null))
                {
                    MessageBox.Show("本机没有串口!", "Error");
                    return;
                }
                if (str == null)
                {
                    MessageBox.Show("本机没有串口!", "Error");
                    return;
                }
               /* Console.WriteLine("test");
                foreach (string s in str)
                {
                    Console.WriteLine(s);
                }*/

                comboBoxPorts.Items.AddRange(str);
                if (comboBoxPorts.Items.Count > 0)
                {
                    comboBoxPorts.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("异常!!!!!!!");
                Console.WriteLine(ex.ToString());
            }
        }