/// <summary> /// /// </summary> public MainWindow() { InitializeComponent(); Closing += MainWindow_Closing; Log.Init(ASSEMBLY_NAME, LOG_PATH, false, WriteLog); this.spConnection = new SPConnection(); this.spConnection.DataReceivingHandler += DataReceived; }
static void Main(string[] args) { comPort = new SPConnection(); comPort.DataReceivingHandler += DataReceived; gilbarco = new Gilbarco(); gilbarco.POLL_ANSWER[2] += 1; gilbarco.POLL_ANSWER[3] += 6; // do { bool res = false; int comNum; do { Console.WriteLine("Номер COM:"); string com = Console.ReadLine(); res = Int32.TryParse(com, out comNum); } while (!res); comPort.Port.PortName = "COM" + comNum; comPort.OpenPort(); } while (!comPort.IsPortOpened); Console.WriteLine("Порт открыт"); Console.WriteLine("Esc для выхода.."); // while (true) { Thread.Sleep(1000); var key = Console.ReadKey(); if (key.Key == ConsoleKey.Escape) break; } // comPort.ClosePort(); }