using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using FelicaLib;
namespace FelicaTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void buttonStart_Click(object sender, EventArgs e)
{
trace("reading...");
try
{
using (Felica f = new Felica())
{
read(f);
}
}
catch (Exception ex)
{
trace(ex.Message);
}
}
private void read(Felica felica)
{
felica.Polling(0xFFFF);
byte[] data = felica.IDm();
String dataStr = "";
for (int i = 0; i < data.Length; i++)
{
dataStr += data[i].ToString("X2");
}
trace(dataStr);
}
private void trace(String message)
{
Console.WriteLine(message);
try
{
Invoke((MethodInvoker)delegate()
{
textBoxTrace.Text = message + "\r\n" + textBoxTrace.Text;
});
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}