Simple beginner RFID question: HelloWorld

Supporting Visual Studio on Windows
NielsNiels

Simple beginner RFID question: HelloWorld

Postby NielsNiels » Tue Jun 14, 2011 12:11 pm

Hello everyone,

I'm using the RFID Phidget kit, and I'm trying to display the Tag serial in a textbox. I'm using WPF (XAML + C#)

Code: Select all

using System;

using Phidgets;
using Phidgets.Events;

namespace RFIDTest
{
    /// <summary>
    /// Interaction logic for SurfaceWindow1.xaml
    /// </summary>
    public partial class SurfaceWindow1 : SurfaceWindow
    {
     
        private RFID rfid;

       
        public SurfaceWindow1()
        {
            InitializeComponent();
        }


        private void SurfaceWindow1_Load(object sender, EventArgs e)
        {
            rfid = new RFID();

            rfid.Attach += new AttachEventHandler(rfid_Attach);
            rfid.Detach += new DetachEventHandler(rfid_Detach);
           

            rfid.Tag += new TagEventHandler(rfid_Tag);
            rfid.TagLost += new TagEventHandler(rfid_TagLost);

            rfid.Antenna = true;

            rfid.open();

           
        }

        void rfid_Attach(object sender, AttachEventArgs e)
        {
            RFID attached = (RFID)sender;
        }

        void rfid_Detach(object sender, DetachEventArgs e)
        {
            RFID detached = (RFID)sender;
        }


        void rfid_Tag(object sender, TagEventArgs e)
        {
            tagTxt.Text = e.Tag;       
        }


        void rfid_TagLost(object sender, TagEventArgs e)
        {
            tagTxt.Text = "";
        }
 
    }
}


tagTxt is the name of a TextBox:

Code: Select all

<TextBox Name="tagTxt" Width="60" Height="20"/>


But it doesn't work.. Anyone know what I did wrong?

- Niels

Return to “C#.NET”

Who is online

Users browsing this forum: No registered users and 1 guest