Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using DL_uFCoder;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace Test_uFCoder_lib
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
private UFR_STATUS status;
private void prnl(string msg)
{
txtOut.Text += msg;
txtOut.Text += System.Environment.NewLine;
}
private void wr_stat(string msg)
{
string m = msg;
m += " : ";
m += uFCoder.status2str(status);
prnl(m);
}
public MainPage()
{
this.InitializeComponent();
string ver;
try
{
ver = "DLL version= ";
ver += uFCoder.GetLibraryVersion();
}
catch (Exception ee)
{
ver = ee.Message;
}
private void reader_open()
try
{
status = uFCoder.ReaderOpenEx(1, IntPtr.Zero, 1, IntPtr.Zero);
wr_stat("ReaderOpenEx(1, 0, 1, 0)");
}
catch (Exception ee)
{
prnl(ee.Message);
//throw;
}
private void bRdOpen_Click(object sender, RoutedEventArgs e)
{
reader_open();
}
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
private void bRdClose_Click(object sender, RoutedEventArgs e)
{
status = uFCoder.ReaderClose();
wr_stat("ReaderClose()");
}
private void bRdInfo_Click(object sender, RoutedEventArgs e)
{
string reader_dsc = uFCoder.GetDescription();
prnl(reader_dsc);
}
private void bRdSignal_Click(object sender, RoutedEventArgs e)
{
status = uFCoder.ReaderUISignal(3, 3);
wr_stat("ReaderUISignal(3, 3)");
}
private void bRdCardID_Click(object sender, RoutedEventArgs e)
{
CARD_SAK Sak = CARD_SAK.UNKNOWN;
byte[] baUid = new byte[10];
status = uFCoder.GetCardIdEx(ref Sak, ref baUid);
wr_stat("GetCardIdEx()");
if (status == UFR_STATUS.UFR_OK)
{
string s;
string hex = BitConverter.ToString(baUid);
s = "CARD: SAK= " + Sak.ToString() + " | ";
s += "UidSize= " + baUid.Length + " | ";
s += "Uid= " + BitConverter.ToString(baUid);
prnl(s);
}
}
}
}