central dll
This commit is contained in:
parent
825437f73d
commit
cbd8026547
10 changed files with 52 additions and 17 deletions
|
|
@ -6,10 +6,18 @@ EpdBase::Epd2U::Epd2U(int comport)
|
|||
port = comport;
|
||||
SetAutoCommit(0);
|
||||
Error = 123;
|
||||
//LoadLibrary((LPWSTR)L"Reader2.dll");
|
||||
//SetTimeouts(port, 20, 1000, 1000);
|
||||
//SetDiscoveryExpirationPeriod(port, 5000);
|
||||
InitRv= InitComms(port, 9600, 8, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
DWORD EpdBase::Epd2U::StartCom()
|
||||
{
|
||||
Error = 0;
|
||||
InitRv = InitComms(port, 9600, 8, 0, 0);
|
||||
if (InitRv == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return Error;
|
||||
}
|
||||
|
||||
EpdBase::Epd2U::~Epd2U()
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ namespace EpdBase
|
|||
void DecodeStatus();
|
||||
|
||||
Epd2U(int comport);
|
||||
DWORD StartCom();
|
||||
WORD ReadStatus();
|
||||
WORD EPDReadExtraStatus();
|
||||
WORD EPDReadConfig();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
EpdBaseClr::Epd2::Epd2(int port)
|
||||
{
|
||||
//LoadLibrary((LPCWSTR)L"reader2.dll");
|
||||
epd = new EpdBase::Epd2U(port);
|
||||
b = gcnew sEpdBase();
|
||||
this->InitRV = epd->InitRv;
|
||||
|
|
@ -13,6 +14,7 @@ EpdBaseClr::Epd2::Epd2(int port)
|
|||
EpdBaseClr::Epd2::~Epd2()
|
||||
{
|
||||
delete b;
|
||||
delete epd;
|
||||
this->!Epd2();
|
||||
}
|
||||
|
||||
|
|
@ -22,6 +24,7 @@ EpdBaseClr::Epd2::!Epd2()
|
|||
|
||||
int EpdBaseClr::Epd2::Connect()
|
||||
{
|
||||
epd->StartCom();
|
||||
b->CurrentDeviceID = 0;
|
||||
epd->StartDiscover();
|
||||
DiscRV = epd->DeviceCount;
|
||||
|
|
@ -34,7 +37,7 @@ int EpdBaseClr::Epd2::Close()
|
|||
{
|
||||
b->CurrentDeviceID = 0;
|
||||
epd->Close();
|
||||
delete epd;
|
||||
//delete epd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:eDosStation"
|
||||
StartupUri="MainWindow.xaml">
|
||||
StartupUri="MainWindow.xaml" Startup="Application_Startup">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
|
|
|||
|
|
@ -3,15 +3,29 @@ using System.Collections.Generic;
|
|||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace eDosStation
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
|
||||
//LoadLibrary("Reader2.dll");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,9 @@ namespace eDosStation
|
|||
|
||||
DataSet1.GetTaskInfoRow CurTaskRow;
|
||||
|
||||
public EntryBadge(Station curStation)
|
||||
public EntryBadge(EpdBaseClr.Epd2 curEP, Station curStation)
|
||||
{
|
||||
ep=curEP;
|
||||
thisStation = curStation;
|
||||
InitializeComponent();
|
||||
_User = null;
|
||||
|
|
@ -182,7 +183,7 @@ namespace eDosStation
|
|||
{
|
||||
if (_User == null || CurTaskRow == null) return;
|
||||
|
||||
ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
//ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
ep.Connect();
|
||||
if (ep.DeviceCount == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,14 +30,13 @@ namespace eDosStation
|
|||
SolidColorBrush GreenBrush = new SolidColorBrush(Colors.LightGreen);
|
||||
SolidColorBrush AlarmBrush = new SolidColorBrush(Colors.LightCoral);
|
||||
|
||||
|
||||
public EpdExit(Station curStation)
|
||||
public EpdExit(EpdBaseClr.Epd2 curEP, Station curStation)
|
||||
{
|
||||
InitializeComponent();
|
||||
ep = curEP;
|
||||
thisStation = curStation;
|
||||
}
|
||||
|
||||
|
||||
private void ShowAlarm()
|
||||
{
|
||||
|
||||
|
|
@ -157,7 +156,7 @@ namespace eDosStation
|
|||
|
||||
private void StartScan()
|
||||
{
|
||||
ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
//ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
ep.Connect();
|
||||
if (ep.DeviceCount == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ namespace eDosStation
|
|||
public partial class MainWindow : Window
|
||||
{
|
||||
public Station thisStation = new Station("");
|
||||
public EpdBaseClr.Epd2 ep=null;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
|
|
@ -29,19 +30,19 @@ namespace eDosStation
|
|||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var w = new ShowEPDDose(thisStation);
|
||||
var w = new ShowEPDDose(ep, thisStation);
|
||||
w.ShowDialog();
|
||||
}
|
||||
|
||||
private void BEntry_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var w = new EntryBadge(thisStation);
|
||||
var w = new EntryBadge(ep, thisStation);
|
||||
w.ShowDialog();
|
||||
}
|
||||
|
||||
private void BExit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var w = new EpdExit(thisStation);
|
||||
var w = new EpdExit(ep, thisStation);
|
||||
w.ShowDialog();
|
||||
}
|
||||
|
||||
|
|
@ -54,6 +55,7 @@ namespace eDosStation
|
|||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
thisStation = new Station("");
|
||||
ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,10 @@ namespace eDosStation
|
|||
DispatcherTimer dispatcherTimer;
|
||||
int Search;
|
||||
|
||||
public ShowEPDDose(Station curStation)
|
||||
public ShowEPDDose(EpdBaseClr.Epd2 curEP, Station curStation)
|
||||
{
|
||||
InitializeComponent();
|
||||
ep = curEP;
|
||||
thisStation = curStation;
|
||||
}
|
||||
|
||||
|
|
@ -60,8 +61,14 @@ namespace eDosStation
|
|||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(thisStation.ComPort.ToString());
|
||||
ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
ep.Connect();
|
||||
try
|
||||
{
|
||||
//ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
ep.Connect();
|
||||
} catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error loading dll's");
|
||||
}
|
||||
if (ep.DeviceCount == 1 )
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("found");
|
||||
|
|
@ -107,7 +114,7 @@ namespace eDosStation
|
|||
private void Window_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
dispatcherTimer?.Stop();
|
||||
ep.Dispose();
|
||||
ep.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue