Ejemplo n.º 1
0
    /// <summary>
    /// Stop reading and disable/close reader
    /// </summary>
    private void TermReader()
    {
        // If we have a reader
        if (this.MyReader != null)
        {
            //Disable the reader
            this.MyReader.Actions.Disable();

            //Free it up
            this.MyReader.Dispose();

            //Indicate we no longer have one
            this.MyReader = null;
        }

        // If we have a reader data
        if (this.MyReaderData != null)
        {
            //Free it up
            this.MyReaderData.Dispose();

            //Indicate we no longer have one
            this.MyReaderData = null;
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Read complete or failure notification
    /// </summary>
    private void MyReader_ReadNotify(object sender, EventArgs e)
    {
        PT.Barcode.ReaderData TheReaderData = this.MyReader.GetNextReaderData();

        // Handle the data from this read
        this.HandleData(TheReaderData);

        // Start the next read
        //this.StartRead();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Handle data from the reader
    /// </summary>
    private void HandleData(PT.Barcode.ReaderData TheReaderData)
    {
        //string MessageToDisplay;// = TheReaderData.Source;
        //MessageToDisplay = TheReaderData.Source + ": " + TheReaderData.Text;
        //ReaderDataListBox.Items.Add(MessageToDisplay);

        if (TheReaderData.Result == PT.Results.SUCCESS)
        {
            varCallBackBarcode(TheReaderData.Text);
        }
    }
Ejemplo n.º 4
0
    public override bool init()
    {
        try
        {
            //If reader is already present then fail initalize
            if (this.MyReader != null)
            {
                return(false);
            }

            //Create new reader, first available reader will be used.
            this.MyReader = new PT.Barcode.Reader();

            //Create reader data
            this.MyReaderData = new PT.Barcode.ReaderData(
                PT.Barcode.ReaderDataTypes.Text,
                PT.Barcode.ReaderDataLengths.MaximumLabel);

            //Create event handler delegate
            this.MyEventHandler = new EventHandler(MyReader_ReadNotify);

            //Enable reader
            this.MyReader.Actions.Enable();

            this.MyReader.Actions.ToggleSoftTrigger();
            StartRead();
            //Success Init Complete
            // return true;
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
            return(false);
        }
        return(true);
    }