Exemplo n.º 1
0
        static void Main(string[] args)
        {
            ComReader comReader = ComReader.Instance;

            comReader.DataReceived   += ComReader_DataReceived;
            comReader.LostConnection += ComReader_LostConnection;

            Console.WriteLine("Key: '1' - Init, '2' - Start, 3 - 'Stop'");

            while (true)
            {
                var keyInfo = Console.ReadKey();

                switch (keyInfo.KeyChar)
                {
                case '1':
                    comReader.Init();
                    break;

                case '2':
                    comReader.Start();
                    break;

                case '3':
                    comReader.Stop();
                    break;

                default:
                    return;
                }
            }
        }
Exemplo n.º 2
0
        //[TestMethod]
        public void ComReaderTestMethod()
        {
            ComReader comReader = ComReader.Instance;

            if (comReader.Init())
            {
                comReader.Start();
            }
            else
            {
                Debug.WriteLine($"Cant Init ComReader");
            }
            comReader.DataReceived   += ComReader_DataReceived;
            comReader.LostConnection += ComReader_LostConnection;

            while (true)
            {
                var key = Console.ReadKey();
            }
        }