예제 #1
0
        private void AutoRun_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            string RCommand;

            RCommand = ComPort.AutoReceived();

            if (TBOX_Info.InvokeRequired)
            {
                TimeSpan mntOnTime = DateTime.Now - sendOnTime;
                TBOX_Info.Invoke(new Action(() => {
                    WriteMsgToTextBox("MNT ON Time: " + mntOnTime.Seconds + mntOnTime.Milliseconds);
                    File.AppendAllText(@"D:\log.txt", "MNT ON Time: " + mntOnTime.Seconds + mntOnTime.Milliseconds + "\r\n");
                }));
            }
        }
예제 #2
0
        private void SendDataTimerTick()
        {
            if (isTimerInvalid == false)
            {
                ComPort.AutonACSwitch(isACON);
                long   msTimes   = sw.ElapsedMilliseconds; //取得執行時間
                string AC_Status = (isACON == true) ? "ON " : "OFF";
                TBOX_Info.Invoke(new Action(() => {
                    WriteMsgToTextBox(SendDatatCounter + "   " + AC_Status + "    " + "waitTime: " + Math.Abs(msTimes) + " [ms]" + "  Dec = " + decDelayTime + "  rep" + repeatTime);
                    WriteMsgToText(SendDatatCounter + "   " + AC_Status + "    " + "waitTime: " + Math.Abs(msTimes) + " [ms]" + "  Dec = " + decDelayTime + "  rep" + repeatTime);
                }));

                CheckCounter(SendDatatCounter);
                isACON = (isACON == true) ? false : true;
                StartWatchControl();
            }
        }