예제 #1
0
파일: ComComm.cs 프로젝트: dan89080/ComComm
        private void DataReceivedHandler_1(object sender, SerialDataReceivedEventArgs e)
        {
            SerialPort sp     = (SerialPort)sender;
            string     indata = sp.ReadExisting();

            richTextBox1.Invoke((MethodInvoker) delegate
            {
                richTextBox1.SelectionColor = color_white;
                richTextBox1.SelectionFont  = default_font;
                richTextBox1.AppendText(indata);
                richTextBox1.SelectionStart = richTextBox1.Text.Length;
                richTextBox1.ScrollToCaret();
                richTextBox1.Font = default_font;
            });
            button_GetPortLog1.Invoke((MethodInvoker) delegate
            {
                button_GetPortLog1.Focus();
            });

            richTextBox2.Invoke((MethodInvoker) delegate
            {
                SF = new StatFuncs(indata);
                //richTextBox2.Text += SF.theINT + "\n\n";
            });

            button_test.Invoke((MethodInvoker) delegate
            {
                //button_test.PerformClick();
            });
        }
예제 #2
0
파일: ComComm.cs 프로젝트: dan89080/ComComm
        private void button_test_Click(object sender, EventArgs e)
        {
            try
            {
                int        cnt   = Convert.ToInt32(textBox_test.Text);
                List <int> yoSTR = new List <int>();

                for (int i = 0; i < cnt; i++)
                {
                    yoSTR.Add(theSTR[i]);
                }

                StatFuncs.CalcStats(yoSTR);
                ShowStats_test(yoSTR);
                ShowAmpCnts(yoSTR);
            }
            catch (Exception E)
            { Console.WriteLine(E.ToString()); }
        }
예제 #3
0
파일: ComComm.cs 프로젝트: dan89080/ComComm
        private void button_stats1_Click(object sender, EventArgs e)
        {
            //button_StopLog1.PerformClick();

            try
            {
                char[]   delimiterChars = { ':', '\n', ' ', '\t', '\r' };
                string[] words          = richTextBox1.Text.Split(delimiterChars);
                //STR = "0:" + words[0] + "\n1:" + words[1] + "\n2:" + words[2] + "\n3:" + words[3];
                theSTR = new List <int>();
                foreach (string s in words)
                {
                    if (s != "")
                    {
                        int temp = Convert.ToInt32(s);
                        theSTR.Add(temp);
                    }
                }
                //button_stats1.Text = StatFuncs.CalcStats();
                button_stats1.Text = StatFuncs.CalcStats(theSTR);
                ShowStats(theSTR);
            }
            catch (Exception E) { button_stats1.Text = E.Message; }
        }