private void button1_Click(object sender, EventArgs e) { _isStarted = !_isStarted; btnStart.Text = (_isStarted) ? "Стоп" : "Старт"; txtResult.Text = String.Empty; Foo(); try { using (IListenerBoard board = GetListenerBoard()) { for (int i = 0; i < 100; i++) { var results = board.ReadBuffer(); var toShow = String.Join(",", results); txtResult.Text += toShow; //await Task.Delay(100).ConfigureAwait(false); } } } catch (Exception err) { txtResult.Text = err.Message; } _isStarted = !_isStarted; btnStart.Text = (_isStarted) ? "Стоп" : "Старт"; }
static void Main(string[] args) { using (IListenerBoard board = GetListenerBoard()) { for (int i = 0; i < 100; i++) { var results = board.ReadBuffer(); } } //board.Dispose(); }
static void Main(string[] args) { //"using" is recommended for correct usage of IDisposable interface using (IListenerBoard board = GetListenerBoard()) //expected listener board is piso-813 analog input card, expected output card is piso-da2/da2u { var boardId = board.CardSearch(); Console.WriteLine($"BoardId={boardId}"); var cardResult = board.CardPoll(); Console.WriteLine($"card result={cardResult}"); Console.ReadLine(); } outputBoard = new OutputBoard(); //remove comments and set as startup for enabling console mode outputBoard.BoardPushValue(2); }
public void Start() { _board = GetListenerBoard(); _cardPollTimer.Start(); _outputBoard = GetOutputBoard(); }