Ejemplo n.º 1
0
        /// <summary>
        /// Close the scanner device
        /// </summary>
        public void Close()
        {
            if (timeout != null)
            {
                timeout.Dispose();
            }

            if (scannerStatus == ScannerStatus.Closed)
            {
                return;
            }

            if (reader != null)
            {
                reader.ScannerOn     = false;
                reader.ScannerEnable = false;
                reader.BarcodeRead  -= scanEvent;
                reader.CancelRead(true);
                reader.Dispose();
                reader = null;
            }

            scannedData   = null;
            scannerStatus = ScannerStatus.Closed;
        }
Ejemplo n.º 2
0
 public void DisposeScaner()
 {
     try
     {
         if (bcr != null)
         {
             bcr.Dispose();
             bcr = null;
         }
     }
     catch (Exception exp)
     {
         // MessageBox.Show(exp.Message);
         CLog.WriteException("StartMenu.cs", "DisposeScaner", exp.Message);
     }
 }
Ejemplo n.º 3
0
        //public void SendScanEU(string EU)
        //{
        //    WebReference.WebSDataBrCode test = new WebReference.WebSDataBrCode();
        //    test.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12;
        //    test.BeginScanEU(EU, MyAsyncCallbackMethod, test);

        //}
        //// Целевые методы AsyncCallback должны иметь следующую сигнатуру
        //void MyAsyncCallbackMethod(IAsyncResult res)
        //{
        //    try
        //    {
        //        WebReference.WebSDataBrCode test = res.AsyncState as WebReference.WebSDataBrCode;
        //        // Trace.Assert(test != null, "Неверный тип объекта");
        //        string result = test.EndScanEU(res);
        //        //txtText.Text += Environment.NewLine + result;
        //        //MessageBox.Show(result);

        //        txtText.BeginInvoke(new Action(() =>
        //        {
        //            txtText.Text += Environment.NewLine + result;
        //        }));

        //    }

        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message);
        //    }
        // }



        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (bcr != null)
                {
                    bcr.Dispose();
                    bcr = null;
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }

            this.Close();
        }