/// <summary> /// initializes the form /// </summary> public MainForm() { this.scannerServices = Program.ScannerServicesClient; // initalize UI InitializeComponent(); TitleText = ""; LeftSoftKeyText = "Menu"; RightSoftKeyText = "Force"; menu = new MenuDataList(); menu.ShowIcons = true; //menu.Add(new MenuDataItem("Force Admit", "force", null, Config.EditBitmap)); menu.Add(new MenuDataItem("Save Admits", "save", null, Config.SaveBitmap)); menu.Add(new MenuDataItem("Sales Mode", "sales", null, null)); menu.Add(new MenuDataItem("Exit", "exit", null, Config.CloseBitmap)); readLabelEvent = new ReadLabelEventDelegate(ReadLabelEventCallback); RLHandler = new ScannerServicesClient.ReadLabelHandler(this.ReadLabelEventCallback); this.LeftSoftKeyPressed += new System.EventHandler(this.LeftSoftKeyPressedHandler); this.RightSoftKeyPressed += new System.EventHandler(this.RightSoftKeyPressedHandler); // Display timer clearTimer = new Timer(); clearTimer.Tick += new EventHandler(clearTimer_Tick); clearTimer.Interval = 5000; clearTimer.Enabled = false; // Add event handlers. this.Activated += new EventHandler(FormActivated); this.Deactivate += new EventHandler(FormDeactivated); }
/// <summary> /// Singleton instance constructor /// </summary> protected LEDManager() { this.scannerServices = Program.ScannerServicesClient; if (!this.scannerServices.IsConnected) { throw new Exception("Cannot connect to scanner services, failed!"); } clearLEDTimer = new Timer(); clearLEDTimer.Tick += new EventHandler(clearLEDTimer_Tick); clearLEDTimer.Interval = 5000; clearLEDTimer.Enabled = false; }
static void Main() { // create the scanner services interface if (!ScannerServicesClient.IsServiceRunning) { MsgBox.Show(null, Properties.Resources.StrSUIDScanner, Properties.Resources.StrErrorCannotConnect); return; } ScannerServicesClient = new ScannerServicesClient(); // Test connection.. if (!ScannerServicesClient.Connect(true)) { MsgBox.Show(null, Properties.Resources.StrSUIDScanner, Properties.Resources.StrErrorCannotConnect); return; } if (RESULTCODE.E_OK != ScannerServicesClient.SetMode(SCANNERSVC_MODE.SVC_MODE_DECODE)) { MsgBox.Show(null, Properties.Resources.StrSUIDScanner, Properties.Resources.StrErrorCannotConnect); ScannerServicesClient.Disconnect(); ScannerServicesClient.Dispose(); return; } // run the application SystemMonitor.Start(); Application.Run(new MainForm()); SystemMonitor.Stop(); //Inventory.Save(); // shut down the scanner interface if (ScannerServicesClient != null) { ScannerServicesClient.Connect(false); ScannerServicesClient.Disconnect(); ScannerServicesClient.Dispose(); ScannerServicesClient = null; } }