public Program() { BrcScanner = new BarcodeScaner(); BrcScanner.ScanBarcodeEvnt += new BarcodeScanning(evScanbrcode); DimScanner = new DimensionScaner(); WeightScanner = new WeightMeasure(); try { MessageQueue Queue = new MessageQueue(StartProgram.queueName); if (!Queue.CanWrite) { throw new Exception(Resurses.ErrorQueue); } BrcScanner.Open(Settings.Default.PortBarcodeScanner, 9600, 8); DimScanner.Open(Settings.Default.PortDimensionScaner, 9600, 8); WeightScanner.Open(Settings.Default.PortWeighr, 9600, 8); } catch (Exception error) { log.Error("Ошибка запуска программы..." + error.Message); } }
private void MainForm_Load(object sender, EventArgs e) { BrcScanner = new BarcodeScaner(); BrcScanner.ScanBarcodeEvnt += new BarcodeScanning(evScanbrcode); DimScanner = new DimensionScaner(); WeightScanner = new WeightMeasure(); DoMeizure = new CubiscanWeightScan(); checkBox1.Checked = true; // ЛОГИРОВАНИЕ ПОД ApacheMQ //publisher.SendMessage("Hello");*/ try { /*MessageQueue Queue = new MessageQueue(StartProgram.queueName); * if (!Queue.CanWrite) * { * throw new Exception(Resurses.ErrorQueue); * }*/ BrcScanner.Open(Settings.Default.PortBarcodeScanner, 9600, 8); DimScanner.Open(Settings.Default.PortDimensionScaner, 9600, 8); WeightScanner.Open(Settings.Default.PortWeighr, 9600, 8); } catch (Exception error) { log.Error("Ошибка запуска программы..." + error.Message); lblError.Text = error.Message; } }