コード例 #1
0
 private static void Console_Execute_GetSensor(DocInterfaceControl _docIntControl)
 {
     //First make sure DocInterfaceControl is initialized
     if (_docIntControl != null)
     {
         if (_docIntControl.IsInitialized)
         {
             Console.WriteLine("");
             docOperationCompleted = false;
             //Start "GetSensor" process
             //  SensorType --> 0xFC = scan all TELID® types
             //  RepeatCount --> 5 (search for transponder 5 times)
             //  DelayBetweenSearchs --> 0 (ms to wait between each search)
             //  NotifySuccessOnly --> false (raise "DocResultChanged" event even if no transponder found)
             _docIntControl.StartGetSensorData(0xFC, 5, 0, false);
             //For demo purposes, just wait blocking execution until DOC process is completed (notified using "DocResultChanged" event, ProcessFinished = true)
             while (!docOperationCompleted)
             {
                 Thread.Sleep(100);
             }
             Console.WriteLine("");
         }
         else
         {
             Console.WriteLine("DocInterfaceControl not initialized!");
         }
     }
 }
        private void Button_GetSensor_Click(object sender, RoutedEventArgs e)
        {
            //GetSensor --> Search for TELID® transponders
            if (m_DocInterface != null)
            {
                if (m_DocInterface.IsInitialized)
                {
                    //This function starts the "GetSensorData" process in a new thread, and reports the result using "DocResultChanged" Event

                    /*
                     * Parameters:
                     *  _repeatCount --> number of times "Identify" will be executed internally
                     *  _delayBetweenSearchMs --> number of milliseconds to wait between internal calls to "Identify"
                     *  _notifySuccessOnly --> if true, "DocResultChanged" Event will only be raised by success on internal "Identify" calls
                     */
                    m_DocInterface.StartGetSensorData(0xFC, 5, 0, false);
                    textBox_ThreadLog.Text += "\n = StartGetSensorData =\n";
                    textBox_ThreadLog.ScrollToEnd();
                    textBox_Result.Text         = "";
                    progressBar.IsIndeterminate = true;
                    mLastDocResultTimestamp     = DateTime.Now;
                }
            }
        }