예제 #1
0
        private void Controller_ScannerStatusChanged(object sender, ScannerStatusEvent e)
        {
            if (this.InvokeRequired)
            {
                var del = new Action(() => Controller_ScannerStatusChanged(sender, e));
                this.BeginInvoke(del);
            }
            else
            {
                switch (e)
                {
                case ScannerStatusEvent.Connected:
                    ScannerStatusLabel.Text      = "Scanner: Connected";
                    ScannerStatusLabel.ForeColor = Color.DarkGreen;
                    break;

                case ScannerStatusEvent.LostConnection:
                    ScannerStatusLabel.Text      = "Scanner: Disconnected";
                    ScannerStatusLabel.ForeColor = Color.DarkRed;
                    break;

                case ScannerStatusEvent.Error:
                    ScannerStatusLabel.Text      = "Scanner: Error!";
                    ScannerStatusLabel.ForeColor = Color.DarkRed;
                    break;
                }
            }
        }
예제 #2
0
 private void OnScannerStatusChanged(ScannerStatusEvent type)
 {
     ScannerStatusChanged?.Invoke(this, type);
 }