feedback status

This commit is contained in:
Luc Vandenbroucke 2026-08-02 16:00:16 +02:00
parent a41cb2721a
commit df6e5b9502
23 changed files with 911 additions and 115 deletions

View file

@ -7,6 +7,20 @@
#define RxRetryCount 5 #define RxRetryCount 5
#define TxRetryCount 5 #define TxRetryCount 5
#pragma unmanaged #pragma unmanaged
void EpdBase::Epd2U::CancelAll()
{
SetEvent(hCancel);
//Cancel(epdComsHandle);
}
void EpdBase::Epd2U::test()
{
const char* msg = "Processing step test...";
if (progressCallback) {
progressCallback(StepTest, EPDStepResult); // Triggers the callback
}
}
EpdBase::Epd2U::Epd2U(int comport) EpdBase::Epd2U::Epd2U(int comport)
{ {
port = comport; port = comport;
@ -14,6 +28,7 @@ EpdBase::Epd2U::Epd2U(int comport)
isBG = isNG = VersionOK = hasAlarm = false; isBG = isNG = VersionOK = hasAlarm = false;
maxDiscoverTime = 10000; maxDiscoverTime = 10000;
hWaitTimer = CreateWaitableTimer(NULL, TRUE, NULL); hWaitTimer = CreateWaitableTimer(NULL, TRUE, NULL);
hCancel = CreateWaitableTimer(NULL, TRUE, NULL);
if (port == 0) return; if (port == 0) return;
SetAutoCommit(0); SetAutoCommit(0);
Error = 123; Error = 123;
@ -68,8 +83,18 @@ EpdBase::Epd2U::~Epd2U()
{ {
EndCom(); EndCom();
} }
bool EpdBase::Epd2U::isCancelled()
{
return WaitForSingleObject(hCancel, 0) == WAIT_OBJECT_0;
}
int EpdBase::Epd2U::StartDiscover( int EpdTimeoutms) int EpdBase::Epd2U::StartDiscover( int EpdTimeoutms)
{ {
ResetEvent(hCancel);
EPDStep = StepDiscovering;
maxDiscoverTime = EpdTimeoutms; maxDiscoverTime = EpdTimeoutms;
if (port == 0) { if (port == 0) {
DeviceCount = 1; DeviceCount = 1;
@ -91,18 +116,31 @@ int EpdBase::Epd2U::StartDiscover( int EpdTimeoutms)
INT64 t = maxDiscoverTime; t *= (INT64)-10000; INT64 t = maxDiscoverTime; t *= (INT64)-10000;
wt.QuadPart = t; // Int32x32To64(maxDiscoverTime, -10000); //15 seconden proberen wt.QuadPart = t; // Int32x32To64(maxDiscoverTime, -10000); //15 seconden proberen
SetWaitableTimer(hWaitTimer, &wt, 0, NULL, NULL, 0); SetWaitableTimer(hWaitTimer, &wt, 0, NULL, NULL, 0);
while (DeviceCount == 0 && wo != 0) //tries-- > 0 && while (DeviceCount == 0 && wo != 0 && !isCancelled()) //tries-- > 0 &&
{ {
ConnectTries++; ConnectTries++;
DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount); DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
if (DiscRV == 0) { if (DiscRV == 0) {
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
} }
wo = WaitForSingleObject(hWaitTimer, 100); else {
if (wo == 0) {ConnectTimerFired = 1; DiscRV = 1; } HANDLE handles[2];
handles[0] = hWaitTimer;
handles[1] = hCancel;
wo = WaitForMultipleObjects(2, handles, false, 100);
if (wo == 0) { ConnectTimerFired = 1; DiscRV = 1; EPDStepResult = EpdStepResults::OK; }
else if (wo == 1) { //Cancelled
DiscRV = 0; EPDStepResult = EpdStepResults::Error; }
else {
DiscRV = 0; EPDStepResult = EpdStepResults::Error;
}
}
} }
CancelWaitableTimer(hWaitTimer); CancelWaitableTimer(hWaitTimer);
} }
if (progressCallback) progressCallback(EPDStep, EPDStepResult);
return DiscRV; return DiscRV;
} }
@ -211,6 +249,8 @@ void EpdBase::Epd2U::DecodeStatus()
WORD EpdBase::Epd2U::ReadStatus() WORD EpdBase::Epd2U::ReadStatus()
{ {
int rv = 0; int rv = 0;
EPDStep = StepReadStatus;
EPDStepResult = EpdStepResults::Started;
Error = 0; ReadStatusRV = 0; Error = 0; ReadStatusRV = 0;
memset(WearerID, 0, WearerIDLength + 1); memset(WearerID, 0, WearerIDLength + 1);
memset(WearerName, 0, WearerNameLength + 1); memset(WearerName, 0, WearerNameLength + 1);
@ -248,9 +288,11 @@ WORD EpdBase::Epd2U::ReadStatus()
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
ReadStatusRV = ErrorReason; ReadStatusRV = ErrorReason;
rv = ErrorReason; rv = ErrorReason;
EPDStepResult = EpdStepResults::Error;
return rv; return rv;
} }
else { else {
EPDStepResult = EpdStepResults::OK;
CurrentDeviceID = EpdID; CurrentDeviceID = EpdID;
time_t t = RealTime; time_t t = RealTime;
TimeFunctions::UnixTimeToSystemTime(t, &tRealTime); TimeFunctions::UnixTimeToSystemTime(t, &tRealTime);
@ -283,6 +325,7 @@ WORD EpdBase::Epd2U::ReadStatus()
for (int i = 0; i < WearerIDLength; i++) for (int i = 0; i < WearerIDLength; i++)
if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30; if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30;
} }
if (progressCallback) progressCallback(EPDStep, EPDStepResult);
return rv; return rv;
} }
/// <summary> /// <summary>
@ -486,6 +529,9 @@ WORD EpdBase::Epd2U::PrepareForIssue()
int rv = 0; int rv = 0;
if (port == 0) return 0; if (port == 0) return 0;
EPDStep = StepPrepareIssue;
EPDStepResult = EpdStepResults::Started;
CommitRV = WriteConfig(); CommitRV = WriteConfig();
CommitRV = 0; CommitRV = 0;
ClearAlarms(); ClearAlarms();
@ -496,6 +542,10 @@ WORD EpdBase::Epd2U::PrepareForIssue()
if (CommitRV) CommitRV = ClearPeakRates(); if (CommitRV) CommitRV = ClearPeakRates();
if (CommitRV) CommitRV = Commit(); if (CommitRV) CommitRV = Commit();
if (CommitRV) rv = 0; else rv = 1; if (CommitRV) rv = 0; else rv = 1;
EPDStepResult = EpdStepResults::OK;
if (progressCallback) {
progressCallback(EPDStep, EPDStepResult);
}
return rv; return rv;
} }
/// <summary> /// <summary>
@ -630,6 +680,7 @@ int EpdBase::Epd2U::ConnectAndStatus(int tokenSourceTimeoutms)
else if (ReadStatus() != 0) rv = 1; //Read Error else if (ReadStatus() != 0) rv = 1; //Read Error
else rv = 0; else rv = 0;
} }
return rv; return rv;
} }

View file

@ -2,9 +2,12 @@
#pragma unmanaged #pragma unmanaged
#include <windows.h> #include <windows.h>
#include "reader2.h" #include "reader2.h"
#include "../EpdBase3/EpdProgress.h"
#pragma unmanaged #pragma unmanaged
namespace EpdBase namespace EpdBase
{ {
typedef void(*ProgressCallback)(int percentage, const char* message);
class Epd2U class Epd2U
{ {
@ -16,6 +19,8 @@ namespace EpdBase
bool hasFault = false; bool hasFault = false;
public: public:
WORD port = 3; WORD port = 3;
const WORD MaxDevices = 10; const WORD MaxDevices = 10;
WORD DeviceCount = 0; WORD DeviceCount = 0;
@ -253,9 +258,17 @@ namespace EpdBase
int ConnectAndStatus(int tokenSourceTimeout); int ConnectAndStatus(int tokenSourceTimeout);
int IssueAndCheck(float gain); int IssueAndCheck(float gain);
void CancelAll();
bool isCancelled();
public: public:
HANDLE hWaitTimer = 0; HANDLE hWaitTimer = 0;
HANDLE hCancel = 0;
EpdSteps EPDStep;
EpdStepResults EPDStepResult;
typedef void (*ProgressCallback)(EpdSteps percentage, EpdStepResults result);
ProgressCallback progressCallback;
void test();
}; };
} }

View file

@ -236,7 +236,7 @@ void Epd3Base::Epd3U::CancelAll()
void Epd3Base::Epd3U::test() void Epd3Base::Epd3U::test()
{ {
const char* msg = "Processing step test..."; const char* msg = "Processing step test...";
progressCallback(StepTest); // Triggers the callback progressCallback(StepTest, EPDStepResult); // Triggers the callback
} }
DWORD Epd3Base::Epd3U::StartCom() DWORD Epd3Base::Epd3U::StartCom()
{ {
@ -245,7 +245,8 @@ DWORD Epd3Base::Epd3U::StartCom()
OpenRetries = 0; OpenRetries = 0;
int step = 1; int step = 1;
int mx = 10; int mx = 10;
EPDStep = StepStartCom; EPDStep = EpdSteps::StepStartCom;
EPDStepResult = EpdStepResults::Started;
epdComsHandle = nullptr; epdComsHandle = nullptr;
if (port == 0) { if (port == 0) {
CommsInitialized = 1; CommsInitialized = 1;
@ -268,7 +269,7 @@ DWORD Epd3Base::Epd3U::StartCom()
} }
else { else {
EPDStep = StepStartComFailed; EPDStepResult = EpdStepResults::Error;
SetEndReturnValue(-1); SetEndReturnValue(-1);
} }
@ -291,14 +292,14 @@ DWORD Epd3Base::Epd3U::StartCom()
CommsInitialized = 1; CommsInitialized = 1;
Dll3RV = SetMultipleDiscoveryMode(epdComsHandle, false); Dll3RV = SetMultipleDiscoveryMode(epdComsHandle, false);
Dll3RV = SetResponseTimeout(epdComsHandle, ResponseTimeout); Dll3RV = SetResponseTimeout(epdComsHandle, ResponseTimeout);
EPDStep = StepStartComOK; EPDStepResult = EpdStepResults::OK;
} }
} }
else { else {
Dll3RV = r_FunctionFail; Dll3RV = r_FunctionFail;
} }
} }
progressCallback(EPDStep); // Triggers the callback progressCallback(EPDStep, EPDStepResult); // Triggers the callback
if (Dll3RV) goto error; if (Dll3RV) goto error;
return 0; return 0;
error: error:
@ -397,10 +398,10 @@ int Epd3Base::Epd3U::StartDiscover(int tokentimeout)
Dll3RV = Connect3(epdComsHandle, Epd, true); Dll3RV = Connect3(epdComsHandle, Epd, true);
if (Dll3RV != 0) { if (Dll3RV != 0) {
DiscoverError = DiscoverErrorConnecting; DiscoverError = DiscoverErrorConnecting;
EPDStep = StepConnectFailed; EPDStepResult = EpdStepResults::Error;
rv = 2; rv = 2;
} else } else
EPDStep = StepConnected; EPDStepResult = EpdStepResults::OK;
} }
return rv; return rv;
} }
@ -686,10 +687,10 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
rv2 = SetEndReturnValue(rv); rv2 = SetEndReturnValue(rv);
current->StatusDecoded = false; current->StatusDecoded = false;
if (rv != 0) { if (rv != 0) {
EPDStep = StepFailedStatus ; EPDStepResult = EpdStepResults::Error;
goto error; goto error;
} }
progressCallback(EPDStep); if (progressCallback) progressCallback(EPDStep, EPDStepResult);
IssueCount = epd3status.IssueCount; IssueCount = epd3status.IssueCount;
OperatingStatus = epd3status.OperatingStatus; OperatingStatus = epd3status.OperatingStatus;
@ -712,17 +713,18 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
MarkNumber.Major = 0; MarkNumber.Major = 0;
MarkNumber.Minor=0; MarkNumber.Minor=0;
VersionNumber.Major = 0; VersionNumber.Major = 0;
EPDStepResult = EpdStepResults::Started;
SetFunctionReturnValue(ReadEpdIdentities,0); SetFunctionReturnValue(ReadEpdIdentities,0);
token = BeginReadEpdIdentities(epdComsHandle, nullptr); token = BeginReadEpdIdentities(epdComsHandle, nullptr);
rv = CommitAndSetRV(); rv = CommitAndSetRV();
if (!rv) rv = EndReadEpdIdentities(epdComsHandle, token, &EpdID32, (EpdTypes*)&EpdType, &capabilities, &MarkNumber, &VersionNumber, NULL, 0); if (!rv) rv = EndReadEpdIdentities(epdComsHandle, token, &EpdID32, (EpdTypes*)&EpdType, &capabilities, &MarkNumber, &VersionNumber, NULL, 0);
rv = SetEndReturnValue(rv); rv = SetEndReturnValue(rv);
if (rv != 0) { if (rv != 0) {
EPDStep = StepReadIdentitiesFailed;
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
} } else EPDStepResult = EpdStepResults::OK;
progressCallback(EPDStep); if (progressCallback) progressCallback(EPDStep, EPDStepResult);
EpdID = EpdID32; EpdID = EpdID32;
isBG = (EpdType == EpdTypes::Mk2BetaGamma) || (EpdType == EpdTypes::Mk3BetaGamma); isBG = (EpdType == EpdTypes::Mk2BetaGamma) || (EpdType == EpdTypes::Mk3BetaGamma);
@ -741,7 +743,8 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
if (!rv) rv = EndReadCounts(epdComsHandle, token, Counts, MaxCounts, &countsRead, &utc, &seconds); if (!rv) rv = EndReadCounts(epdComsHandle, token, Counts, MaxCounts, &countsRead, &utc, &seconds);
rv2= SetEndReturnValue(rv); rv2= SetEndReturnValue(rv);
if (rv) { if (rv) {
EPDStep = StepReadCountsFailed;
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
} }
@ -761,7 +764,7 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
rv = EndReadRTC(epdComsHandle, token, &utc); //EpdClock for MK2 rv = EndReadRTC(epdComsHandle, token, &utc); //EpdClock for MK2
rv2= SetEndReturnValue(rv); rv2= SetEndReturnValue(rv);
if (rv) { if (rv) {
EPDStep = StepReadRTCFailed; EPDStepResult = EpdStepResults::Error;
goto error; goto error;
} }
@ -791,7 +794,7 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
if (!rv) rv = EndReadWearerId(epdComsHandle, token, &mk3WearerID); if (!rv) rv = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
rv = SetEndReturnValue(rv); rv = SetEndReturnValue(rv);
if (rv != 0) { if (rv != 0) {
EPDStep = StepReadWearerIdFailed; EPDStepResult = EpdStepResults::Error;
goto error; goto error;
} }
@ -806,7 +809,7 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
if (!rv) rv = EndReadWearerId(epdComsHandle, token, &mk3WearerID); if (!rv) rv = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
rv = SetEndReturnValue(rv); rv = SetEndReturnValue(rv);
if (rv != 0) { if (rv != 0) {
EPDStep = StepReadWearerIdFailed; EPDStepResult = EpdStepResults::Error;
goto error; goto error;
} }
@ -816,12 +819,15 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
for (int i = 0; i < mk3WearerID.Length; i++) for (int i = 0; i < mk3WearerID.Length; i++)
if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30; if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30;
} }
EPDStepResult = EpdStepResults::OK;
exitroutine:
exitroutine:
if (progressCallback) progressCallback(EPDStep, EPDStepResult);
return rv; return rv;
error: error:
//Cancel(epdComsHandle); if (progressCallback) progressCallback(EPDStep, EPDStepResult);
Error = rv; Error = rv;
ErrorStep = step; ErrorStep = step;
return rv; return rv;
@ -852,26 +858,28 @@ int Epd3Base::Epd3U::ConnectAndStatus(int tokenSourceTimeout)
if (dllStatus != 1) { if (dllStatus != 1) {
rv = 1; //Connect error rv = 1; //Connect error
EPDStep = StepDiscoverFailed;
EPDStepResult = EpdStepResults::Error;
} }
else if (DeviceCount < 1) { else if (DeviceCount < 1) {
rv = 2; rv = 2;
Error = r_OperationTimeout; Error = r_OperationTimeout;
EPDStep = StepDiscoverFailed; EPDStepResult = EpdStepResults::Error;
} }
else if (isMK3) { else if (isMK3) {
if (ReadStatus(false) != 0) { if (ReadStatus(false) != 0) {
rv = 3; //Read Error rv = 3; //Read Error
EPDStep = StepFailedStatus; EPDStepResult = EpdStepResults::Error;
} }
else else
EPDStep = StepGotStatus; EPDStepResult = EpdStepResults::OK;
rv = 0; rv = 0;
} }
else rv = 0; //MK2 else rv = 0; //MK2
} }
else rv = 1; else rv = 1;
progressCallback(EPDStep);
if (progressCallback) progressCallback(EPDStep, EPDStepResult);
return rv; return rv;
} }
/// <summary> /// <summary>
@ -1360,13 +1368,15 @@ int Epd3Base::Epd3U::ClearAlarms()
Error = rv; Error = rv;
return rv; return rv;
} }
WORD Epd3Base::Epd3U::PrepareForIssue() WORD Epd3Base::Epd3U::PrepareForIssue()
{ {
int rv = 0; int rv = 0;
int step = 0; int step = 0;
if (port == 0) return 0; if (port == 0) return 0;
EPDStep = StepPrepareIssue;
EPDStepResult = EpdStepResults::Started;
step = 2; step = 2;
if (WriteConfig32) { if (WriteConfig32) {
rv = WriteConfig(); rv = WriteConfig();
@ -1378,7 +1388,6 @@ WORD Epd3Base::Epd3U::PrepareForIssue()
if (!isConnected) if (!isConnected)
rv = ReOpenDev(); rv = ReOpenDev();
step = 4; step = 4;
if (!DetectorsOn) { if (!DetectorsOn) {
token = BeginEpdOnOff(epdComsHandle, 1, nullptr); token = BeginEpdOnOff(epdComsHandle, 1, nullptr);
@ -1390,25 +1399,31 @@ WORD Epd3Base::Epd3U::PrepareForIssue()
step = 5; step = 5;
rv = ClearAlarms(); rv = ClearAlarms();
if (rv != 0) if (rv != 0) {
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
}
step = 4; step = 4;
rv = ClearDoses(); rv = ClearDoses();
if (rv != 0) if (rv != 0)
{
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
}
EPDStepResult = EpdStepResults::OK;
OutputDebugStringA("**** After clear ****\n"); OutputDebugStringA("**** After clear ****\n");
Disconnect(epdComsHandle); Disconnect(epdComsHandle);
Sleep(SleepAfterClear); Sleep(SleepAfterClear);
if (progressCallback) progressCallback(EPDStep, EPDStepResult);
return rv; return rv;
error: error:
DebugWrite("**** After clear step %d error %d ****\n", step, rv); DebugWrite("**** After clear step %d error %d ****\n", step, rv);
ErrorStep = step; ErrorStep = step;
Error = rv; Error = rv;
if (progressCallback) progressCallback(EPDStep, EPDStepResult);
return rv; return rv;
} }
WORD Epd3Base::Epd3U::ReadAlarmConfig() { WORD Epd3Base::Epd3U::ReadAlarmConfig() {
@ -1491,6 +1506,8 @@ error:
WORD Epd3Base::Epd3U::DeIssue() WORD Epd3Base::Epd3U::DeIssue()
{ {
int r = 1; int r = 1;
EPDStep = StepDeIssue;
EPDStepResult = EpdStepResults::Started;
if (port == 0) return 0; if (port == 0) return 0;
if (CurrentDeviceID == 0) return 0; if (CurrentDeviceID == 0) return 0;
@ -1585,13 +1602,18 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
if (!PrepareDone) { if (!PrepareDone) {
r = PrepareForIssue(); r = PrepareForIssue();
if (r) if (r)
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
} }
EPDStep = StepIssue;
EPDStepResult = EpdStepResults::Started;
step = 1; step = 1;
if (!isConnected) r = ReOpenDev(); if (!isConnected) r = ReOpenDev();
if (r) if (r) {
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
}
step = 4; step = 4;
@ -1611,10 +1633,14 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
Control = 0; Control = 0;
#endif #endif
step = 2; step = 2;
r = WriteAlarmTresholds(); r = WriteAlarmTresholds();
if (r != 0) if (r != 0)
{
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
}
step = 3; step = 3;
if (!isConnected) if (!isConnected)
@ -1623,7 +1649,10 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
step = 4; step = 4;
r = WriteWearer(); r = WriteWearer();
if (r != 0) if (r != 0)
{
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
}
tries = 1; tries = 1;
SetFunctionReturnValue(eFunctions::IssueEPD,0); SetFunctionReturnValue(eFunctions::IssueEPD,0);
@ -1639,9 +1668,12 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
r = CommitAndEnd2RV(EndIssueEPD, token); r = CommitAndEnd2RV(EndIssueEPD, token);
} }
if (r) if (r)
{
EPDStepResult = EpdStepResults::Error;
goto error; goto error;
}
EPDIssued = 1; EPDIssued = 1;
EPDStepResult = EpdStepResults::OK;
step = 6; step = 6;
if (isMK3) { if (isMK3) {
@ -1649,11 +1681,13 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
} }
step = 7; step = 7;
if (progressCallback) progressCallback(EPDStep, EPDStepResult);
return r; return r;
error: error:
ErrorStep = step; ErrorStep = step;
Error = r; Error = r;
if (progressCallback) progressCallback(EPDStep, EPDStepResult);
return r; return r;
} }
@ -1830,6 +1864,7 @@ int Epd3Base::Epd3U::IssueAndCheck(float gain, float ChirpRate)
if (!isConnected) if (!isConnected)
rv = ReOpenDev(); rv = ReOpenDev();
rv = ReadStatusOnly(); rv = ReadStatusOnly();
if (rv) if (rv)
rv2=1; rv2=1;
@ -2042,7 +2077,7 @@ int Epd3Base::Epd3U::WriteConfig(void)
if (r != 0) if (r != 0)
Error = r; Error = r;
Error = r;
} }
else else
Error = r; Error = r;

View file

@ -7,6 +7,7 @@
#include "EpdCommon.h" #include "EpdCommon.h"
#include "Epd3.h" #include "Epd3.h"
#include "Epd2.h" #include "Epd2.h"
#include "EpdProgress.h"
#pragma unmanaged #pragma unmanaged
@ -41,31 +42,7 @@ namespace Epd3Base {
}; };
typedef void(*ProgressCallback)(int percentage, const char* message); typedef void(*ProgressCallback)(int percentage, const char* message);
enum EpdSteps
{
StepTest,
StepStartCom,
StepStartComFailed,
StepStartComOK,
StepInitialized,
StepDiscovering,
StepDiscoverFailed,
StepDiscovered,
StepConnecting,
StepConnected,
StepConnectFailed,
StepReadStatus,
StepGotStatus,
StepFailedStatus,
StepReadIdentities,
StepReadIdentitiesFailed,
StepReadCounts,
StepReadCountsFailed,
StepReadRTC,
StepReadRTCFailed,
StepReadWearerId,
StepReadWearerIdFailed
};
class Epd3U class Epd3U
{ {
@ -129,6 +106,7 @@ namespace Epd3Base {
DiscoverErrorCodes DiscoverError; DiscoverErrorCodes DiscoverError;
EpdSteps EPDStep; EpdSteps EPDStep;
EpdStepResults EPDStepResult;
//OperatingStatus //OperatingStatus
BYTE DetectorsOn = 0; BYTE DetectorsOn = 0;
@ -388,7 +366,7 @@ namespace Epd3Base {
public: public:
char DiagnosticsWrite[DiagnosticsWriteSize]; char DiagnosticsWrite[DiagnosticsWriteSize];
typedef void (*ProgressCallback)(EpdSteps percentage); typedef void (*ProgressCallback)(EpdSteps percentage, EpdStepResults result);
ProgressCallback progressCallback; ProgressCallback progressCallback;
void test(); void test();
}; };

View file

@ -163,6 +163,7 @@
<ClInclude Include="Epd3.h" /> <ClInclude Include="Epd3.h" />
<ClInclude Include="Epd3Base.h" /> <ClInclude Include="Epd3Base.h" />
<ClInclude Include="EpdCommon.h" /> <ClInclude Include="EpdCommon.h" />
<ClInclude Include="EpdProgress.h" />
<ClInclude Include="framework.h" /> <ClInclude Include="framework.h" />
<ClInclude Include="Mk3Types.h" /> <ClInclude Include="Mk3Types.h" />
<ClInclude Include="pch.h" /> <ClInclude Include="pch.h" />

View file

@ -42,6 +42,9 @@
<ClInclude Include="TimeFunctions.h"> <ClInclude Include="TimeFunctions.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="EpdProgress.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="pch.cpp"> <ClCompile Include="pch.cpp">

29
EpdBase3/EpdProgress.h Normal file
View file

@ -0,0 +1,29 @@
#pragma once
enum EpdSteps
{
StepTest=0,
StepStartCom=1,
StepInitialized=2,
StepDiscovering=3,
StepConnecting=4,
StepReadStatus=5,
StepReadIdentities=6,
StepReadCounts=7,
StepReadRTC=8 ,
StepReadWearerId=9,
StepPrepareIssue = 10,
StepIssue=11,
StepDeIssue=12
};
enum EpdStepResults
{
None=0,
Started=1,
OK=2,
Error
};

View file

@ -8,8 +8,9 @@ typedef void (*ProgressCallback)(int percentage, const char* message);
void EpdBaseClr::Epd2::OnCancelRequested() void EpdBaseClr::Epd2::OnCancelRequested()
{ {
if (epd3 != nullptr) epd3->CancelAll(); if (epd3 != nullptr) epd3->CancelAll();
//if (epd != nullptr) epd->Cancel(); if (epd != nullptr) epd->CancelAll();
} }
bool EpdBaseClr::Epd2::HasStepError() bool EpdBaseClr::Epd2::HasStepError()
{ {
return (bool)epd3->HasStepError; return (bool)epd3->HasStepError;
@ -33,11 +34,13 @@ int EpdBaseClr::Epd2::GetSteps()
return nsteps; return nsteps;
} }
void EpdBaseClr::Epd2::OnProgress(Epd3Base::EpdSteps step) void EpdBaseClr::Epd2::OnProgress(EpdSteps step, EpdStepResults result)
{ {
// Handle the progress info here (e.g., print or log it) // Handle the progress info here (e.g., print or log it)
System::Console::WriteLine("Step: " + ((int)step).ToString() ); System::Console::WriteLine("Step: " + ((int)step).ToString() + ", Result: " + ((int)result).ToString());
if (_EpdProgress) _EpdProgress(this,step); if (_EpdProgress) {
_EpdProgress(this, step, result);Sleep(100);
}
} }
EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2) EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2)
@ -67,6 +70,10 @@ EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2)
epd3->progressCallback = static_cast<Epd3Base::Epd3U::ProgressCallback>(ip.ToPointer()); epd3->progressCallback = static_cast<Epd3Base::Epd3U::ProgressCallback>(ip.ToPointer());
epd3->test(); epd3->test();
} }
if (epd != nullptr) {
epd->progressCallback = static_cast<EpdBase::Epd2U::ProgressCallback>(ip.ToPointer());
epd->test();
}
} }
EpdBaseClr::Epd2::~Epd2() EpdBaseClr::Epd2::~Epd2()
@ -1072,7 +1079,6 @@ void EpdBaseClr::Epd2::WaitEnd()
delete waitTask; delete waitTask;
waitTask = nullptr; waitTask = nullptr;
} }
Close(); Close();
} }
} }

View file

@ -14,7 +14,7 @@ namespace EpdBaseClr {
[UnmanagedFunctionPointer(CallingConvention::Cdecl)] [UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate void ProgressCallbackDelegate(Epd3Base::EpdSteps step); public delegate void ProgressCallbackDelegate(EpdSteps step, EpdStepResults result);
const char* cEpdError = "Setreader Error"; const char* cEpdError = "Setreader Error";
ref class Epd2; ref class Epd2;
@ -141,12 +141,12 @@ namespace EpdBaseClr {
const wchar_t* tHp10G = L"HP10G"; const wchar_t* tHp10G = L"HP10G";
public: public:
void OnProgress(Epd3Base::EpdSteps step); void OnProgress(EpdSteps step, EpdStepResults result);
ProgressCallbackDelegate^ progressDelegate; ProgressCallbackDelegate^ progressDelegate;
delegate void dEpdRead(Epd2^ Sender, EpdEventArgs^ e); delegate void dEpdRead(Epd2^ Sender, EpdEventArgs^ e);
delegate void dEpdTO(Epd2^ Sender, EpdTOEventArgs^ e); delegate void dEpdTO(Epd2^ Sender, EpdTOEventArgs^ e);
delegate void dEpdError(Epd2^ Sender, EpdErrorEventArgs^ e); delegate void dEpdError(Epd2^ Sender, EpdErrorEventArgs^ e);
delegate void dEpdProgress(Epd2^ Sender, int step); delegate void dEpdProgress(Epd2^ Sender, int step, int result);
dEpdRead^ _EpdRead; dEpdRead^ _EpdRead;
dEpdTO^ _EpdTO; dEpdTO^ _EpdTO;
@ -421,32 +421,28 @@ namespace EpdBaseClr {
public ref class EpdHelpers public ref class EpdHelpers
{ {
public: public:
static System::String^ EpdStepToString(Epd3Base::EpdSteps step) static System::String^ EpdStepToString(EpdSteps step)
{ {
switch (step) switch (step)
{ {
case Epd3Base::StepTest: return L"Test"; case StepTest: return L"Test";
case Epd3Base::StepStartCom: return L"StartCom"; case StepStartCom: return L"StartCom";
case Epd3Base::StepStartComFailed: return L"StartCom Failed";
case Epd3Base::StepStartComOK: return L"StartCom OK"; case StepInitialized: return L"Initialized";
case Epd3Base::StepInitialized: return L"Initialized"; case StepDiscovering: return L"Discovering";
case Epd3Base::StepDiscovering: return L"Discovering";
case Epd3Base::StepDiscoverFailed: return L"Discover Failed"; case StepConnecting: return L"Connecting";
case Epd3Base::StepDiscovered: return L"Discovered";
case Epd3Base::StepConnecting: return L"Connecting"; case StepReadStatus: return L"ReadStatus";
case Epd3Base::StepConnected: return L"Connected";
case Epd3Base::StepConnectFailed: return L"Connect Failed"; case StepReadIdentities: return L"Read Identities";
case Epd3Base::StepReadStatus: return L"ReadStatus";
case Epd3Base::StepGotStatus: return L"Got Status"; case StepReadCounts: return L"Read Counts";
case Epd3Base::StepFailedStatus: return L"Failed Status";
case Epd3Base::StepReadIdentities: return L"Read Identities"; case StepReadRTC: return L"Read RTC";
case Epd3Base::StepReadIdentitiesFailed: return L"Read Identities Failed";
case Epd3Base::StepReadCounts: return L"Read Counts"; case StepReadWearerId: return L"Read WearerId";
case Epd3Base::StepReadCountsFailed: return L"Read Counts Failed";
case Epd3Base::StepReadRTC: return L"Read RTC";
case Epd3Base::StepReadRTCFailed: return L"Read RTC Failed";
case Epd3Base::StepReadWearerId: return L"Read WearerId";
case Epd3Base::StepReadWearerIdFailed: return L"Read WearerId Failed";
default: return L"Unknown"; default: return L"Unknown";
} }
} }

View file

@ -0,0 +1,199 @@
<UserControl x:Class="eDosStation.DosimeterDisplay"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
FontSize="20">
<!-- Global baseline font size for high readability -->
<UserControl.Resources>
<!-- Reusable styles tuned for Kiosk touch/view distance -->
<Style TargetType="TextBlock" x:Key="LabelStyle">
<Setter Property="Foreground" Value="#555555" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontSize" Value="20" />
<!-- Increased from 14 -->
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0,8,16,8" />
</Style>
<Style TargetType="TextBlock" x:Key="ValueStyle">
<Setter Property="Foreground" Value="#111111" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="22" />
<!-- Increased from 14 -->
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0,8,0,8" />
</Style>
<Style TargetType="TextBlock" x:Key="SectionHeaderStyle">
<Setter Property="FontSize" Value="24" />
<!-- Increased from 16 -->
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="#2A5298" />
<Setter Property="Margin" Value="0,0,0,16" />
</Style>
<Style TargetType="Border" x:Key="CardStyle">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="#D0D0D0" />
<Setter Property="BorderThickness" Value="1.5" />
<Setter Property="CornerRadius" Value="10" />
<Setter Property="Padding" Value="24" />
<!-- Roomier padding for touch UI -->
<Setter Property="Margin" Value="0,0,0,20" />
</Style>
</UserControl.Resources>
<ScrollViewer VerticalScrollBarVisibility="Auto" Focusable="False">
<!-- MaxWidth increased to allow larger text to breathe in Maximized mode -->
<StackPanel Margin="24" MaxWidth="1200" HorizontalAlignment="Center">
<!-- SECTION 1: Device & Wearer Metadata -->
<Border Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock Text="Device &amp; Wearer Details" Style="{StaticResource SectionHeaderStyle}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Row 0 -->
<TextBlock Grid.Row="0" Grid.Column="0" Text="EPD ID:" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="epdid" Text="..." Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="0" Grid.Column="2" Text="Type:" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="0" Grid.Column="3" x:Name="epdtype" Text="..." Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="0" Grid.Column="4" Text="Version:" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="0" Grid.Column="5" x:Name="HardVersion" Text="..." Style="{StaticResource ValueStyle}" />
<!-- Row 1 -->
<TextBlock Grid.Row="1" Grid.Column="0" Text="Pers ID:" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="Wearer" Text="..." Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="1" Grid.Column="2" Text="Visit #:" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="1" Grid.Column="3" x:Name="EpdVisit" Text="..." Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="1" Grid.Column="4" Text="User Margin:" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="1" Grid.Column="5" x:Name="epdUserMargin" Text="..." Style="{StaticResource ValueStyle}" />
<!-- Row 2 -->
<TextBlock Grid.Row="2" Grid.Column="0" Text="Issued:" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="isIssued" Text="..." Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="2" Grid.Column="2" x:Name="lNGain" Text="Gain:" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="2" Grid.Column="3" x:Name="NGain" Text="..." Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="2" Grid.Column="4" Text="Alarm:" Style="{StaticResource LabelStyle}" />
<StackPanel Grid.Row="2" Grid.Column="5" Orientation="Horizontal">
<TextBlock x:Name="hasAlarm" Text="..." Style="{StaticResource ValueStyle}" />
<StackPanel x:Name="sAlarm" Margin="12,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</Grid>
</StackPanel>
</Border>
<!-- SECTION 2: Measurements & Thresholds -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Doses Card -->
<Border Grid.Column="0" Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock Text="Dose Measurements" Style="{StaticResource SectionHeaderStyle}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" x:Name="HpDose07l" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="HpDose07" Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="HpPeak07l" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="HpPeak07" Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="2" Grid.Column="0" x:Name="HpDose10l" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="HpDose10" Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="3" Grid.Column="0" x:Name="HpPeak10l" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="3" Grid.Column="1" x:Name="HpPeak10" Style="{StaticResource ValueStyle}" />
</Grid>
</StackPanel>
</Border>
<!-- Dose Thresholds Card -->
<Border Grid.Column="2" Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock Text="Dose Thresholds" Style="{StaticResource SectionHeaderStyle}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" x:Name="HP07AlarmDosel" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="HP07AlarmDose" Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="HP10AlarmDose1l" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="HP10AlarmDose1" Style="{StaticResource ValueStyle}" />
<TextBlock Grid.Row="2" Grid.Column="0" x:Name="HP10AlarmDose2l" Style="{StaticResource LabelStyle}" />
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="HP10AlarmDose2" Style="{StaticResource ValueStyle}" />
</Grid>
</StackPanel>
</Border>
</Grid>
<!-- SECTION 3: Progress & Touch Controls -->
<Border Style="{StaticResource CardStyle}">
<StackPanel>
<Grid Margin="0,0,0,24">
<telerik:RadProgressBar x:Name="Progress" Height="36" Style="{StaticResource styleTTOProgessBar}" />
<TextBlock x:Name="ProgressText" Text="100%" Foreground="White" FontWeight="Bold" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
<telerik:RadStepProgressBar x:Name="stepEPD" Margin="0,0,0,24" HorizontalAlignment="Center">
<telerik:RadStepProgressBarItem Content="Connect" />
<telerik:RadStepProgressBarItem Content="Status" />
</telerik:RadStepProgressBar>
<StackPanel HorizontalAlignment="Center" Margin="0,12,0,0">
<!-- Enlarged touch target for kiosk button -->
<telerik:RadButton x:Name="bEpdCancel" Content="Close" Style="{StaticResource OkCancelButton}" MinWidth="180" Height="50" FontSize="20" Click="RadButton_Click" />
<TextBlock x:Name="tWaitFor" Text="" Style="{StaticResource ValueStyle}" HorizontalAlignment="Center" Margin="0,12,0,0" />
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</UserControl>

View file

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace eDosStation
{
/// <summary>
/// Interaction logic for DosimeterDisplay.xaml
/// </summary>
public partial class DosimeterDisplay : UserControl
{
public static readonly RoutedEvent CloseClickedEvent =
EventManager.RegisterRoutedEvent(
nameof(CloseClicked),
RoutingStrategy.Bubble,
typeof(RoutedEventHandler),
typeof(DosimeterDisplay));
public event RoutedEventHandler CloseClicked
{
add => AddHandler(CloseClickedEvent, value);
remove => RemoveHandler(CloseClickedEvent, value);
}
public DosimeterDisplay()
{
InitializeComponent();
}
private void RadButton_Click(object sender, RoutedEventArgs e)
{
// Raise the event so parent controls/windows know "Close" was clicked
RaiseEvent(new RoutedEventArgs(CloseClickedEvent));
}
}
}

View file

@ -299,6 +299,7 @@
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="20" /> <RowDefinition Height="20" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Grid.Row="0" Name="panelWait" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Vertical" Visibility="Collapsed" > <StackPanel Grid.Row="0" Name="panelWait" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Vertical" Visibility="Collapsed" >
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
@ -382,6 +383,11 @@
<TextEffect Foreground="#FFE66464"/> <TextEffect Foreground="#FFE66464"/>
</TextBlock.TextEffects> </TextBlock.TextEffects>
</TextBlock> </TextBlock>
<telerik:RadStepProgressBar Grid.Row="5" x:Name="stepEPD" Margin="10,0,10,10" >
<telerik:RadStepProgressBarItem Content="Connect" />
<telerik:RadStepProgressBarItem Content="Status" />
<telerik:RadStepProgressBarItem Content="Issue" />
</telerik:RadStepProgressBar>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Name="tbNotAllowed"> <TabItem Name="tbNotAllowed">

View file

@ -9,11 +9,13 @@ using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Resources; using System.Windows.Resources;
using System.Windows.Threading; using System.Windows.Threading;
using Telerik.Windows.Controls;
namespace eDosStation namespace eDosStation
{ {
/// <summary> /// <summary>
/// Interaction logic for EntryBadge.xaml /// Interaction logic for EntryBadge.xaml
/// startEPDRead
/// </summary> /// </summary>
/// ///
@ -979,6 +981,7 @@ namespace eDosStation
ep.EpdRead += Ep_EpdRead; ep.EpdRead += Ep_EpdRead;
ep.EpdError += Ep_EpdError; ep.EpdError += Ep_EpdError;
ep.EpdTO += Ep_EpdTO; ep.EpdTO += Ep_EpdTO;
ep.EpdProgress += Ep_EpdProgress;
} }
catch (System.Exception ex) catch (System.Exception ex)
{ {
@ -1017,10 +1020,36 @@ namespace eDosStation
} }
} }
private void Ep_EpdProgress(EpdBaseClr.Epd2 Sender, int step, int result)
{
System.Diagnostics.Debug.WriteLine($"EPD Progress step:{step} result:{result}");
int index = -1;
switch (step)
{
case 4: index = 0; break;
case 5: index = 1; break;
case 10: index = 2; break;
}
if (index >= 0 && index < stepEPD.Items.Count)
{
this.Dispatcher.Invoke(() =>
{
stepEPD.SelectedIndex = index;
// Optional: Force the progress step visual item to update status if needed
if (stepEPD.ItemContainerGenerator.ContainerFromIndex(index) is FrameworkElement container)
{
container.UpdateLayout();
}
}, System.Windows.Threading.DispatcherPriority.Normal);
}
}
private void Pelatec_DataReceived(int PersID) private void Pelatec_DataReceived(int PersID)
{ {
this.Dispatcher.InvokeAsync(new Action(() => showBadge(PersID, null)), DispatcherPriority.Background); this.Dispatcher.InvokeAsync(new Action(() => showBadge(PersID, null)), DispatcherPriority.Background);
} }
//private void Pelatec_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) //private void Pelatec_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
//{ //{
// var v = elatecReader.ReadLine(); // var v = elatecReader.ReadLine();

View file

@ -28,6 +28,7 @@
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="100" /> <ColumnDefinition Width="100" />
@ -39,6 +40,13 @@
<Image Grid.Row="1" Grid.ColumnSpan="2" Source="/Images/Mk2OnReader.jpg" Width="300" Margin="10,10,10,50"/> <Image Grid.Row="1" Grid.ColumnSpan="2" Source="/Images/Mk2OnReader.jpg" Width="300" Margin="10,10,10,50"/>
<telerik:RadProgressBar Grid.Row="2" Grid.ColumnSpan="2" Name="Progress" Style="{StaticResource styleTTOProgessBar}" HorizontalAlignment="Stretch" /> <telerik:RadProgressBar Grid.Row="2" Grid.ColumnSpan="2" Name="Progress" Style="{StaticResource styleTTOProgessBar}" HorizontalAlignment="Stretch" />
<telerik:RadButton Grid.Row="3" Grid.ColumnSpan="2" Name="bCancel" Content="Cancel" Click="BCloseExit_Click" Style="{DynamicResource OkCancelButton}" /> <telerik:RadButton Grid.Row="3" Grid.ColumnSpan="2" Name="bCancel" Content="Cancel" Click="BCloseExit_Click" Style="{DynamicResource OkCancelButton}" />
<telerik:RadStepProgressBar Grid.Row="4" Grid.ColumnSpan="2" x:Name="stepEPD" Margin="10,0,10,10" FontSize="24" >
<telerik:RadStepProgressBarItem Content="Connect" />
<telerik:RadStepProgressBarItem Content="Status" />
<telerik:RadStepProgressBarItem Content="DeIssue" />
</telerik:RadStepProgressBar>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Name="ok" VerticalAlignment="Center" HorizontalContentAlignment="Center" > <TabItem Name="ok" VerticalAlignment="Center" HorizontalContentAlignment="Center" >

View file

@ -59,6 +59,32 @@ namespace eDosStation
Dispatcher.InvokeAsync(() => LoadDoses()); Dispatcher.InvokeAsync(() => LoadDoses());
} }
private void Ep_EpdProgress(EpdBaseClr.Epd2 Sender, int step, int result)
{
System.Diagnostics.Debug.WriteLine($"EPD Progress step:{step} result:{result}");
int index = -1;
switch (step)
{
case 4: index = 0; break;
case 5: index = 1; break;
case 12: index = 2; break;
}
if (index >= 0 && index < stepEPD.Items.Count)
{
this.Dispatcher.Invoke(() =>
{
stepEPD.SelectedIndex = index;
// Optional: Force the progress step visual item to update status if needed
if (stepEPD.ItemContainerGenerator.ContainerFromIndex(index) is FrameworkElement container)
{
container.UpdateLayout();
}
}, System.Windows.Threading.DispatcherPriority.Normal);
}
}
private void startEPDRead() private void startEPDRead()
{ {
EpdReading = true; bCancel.IsEnabled = false; EpdReading = true; bCancel.IsEnabled = false;
@ -228,6 +254,7 @@ namespace eDosStation
epdDevice.EpdRead += Ep_EpdRead; epdDevice.EpdRead += Ep_EpdRead;
epdDevice.EpdError += Ep_EpdError; epdDevice.EpdError += Ep_EpdError;
epdDevice.EpdTO += Ep_EpdTO; epdDevice.EpdTO += Ep_EpdTO;
epdDevice.EpdProgress += Ep_EpdProgress;
} }
catch (System.Exception ex) catch (System.Exception ex)
{ {

View file

@ -19,7 +19,7 @@ namespace eDosStation
EpdBaseClr.Epd2 ep; EpdBaseClr.Epd2 ep;
DispatcherTimer dispatcherTimer; DispatcherTimer dispatcherTimer;
private DateTime ResultTime; private DateTime ResultTime;
private User thisUser; //private User thisUser;
#pragma warning disable CS0414 // The field 'ShowEPDDose.EpdReading' is assigned but its value is never used #pragma warning disable CS0414 // The field 'ShowEPDDose.EpdReading' is assigned but its value is never used
private bool EpdReading; private bool EpdReading;
#pragma warning restore CS0414 // The field 'ShowEPDDose.EpdReading' is assigned but its value is never used #pragma warning restore CS0414 // The field 'ShowEPDDose.EpdReading' is assigned but its value is never used

View file

@ -42,7 +42,7 @@ namespace eDosStation
{ {
thisStation.DeviceRestart(); thisStation.DeviceRestart();
} }
var w = new ShowEPDDose(thisStation); var w = new ShowEPDDose2(thisStation);
w.ShowDialog(); w.ShowDialog();

View file

@ -1 +1 @@
Sat 08/01/2026 17:11:30.39 Sun 08/02/2026 15:56:50.38

View file

@ -105,8 +105,18 @@
</StackPanel> </StackPanel>
<Grid Grid.Row="8" Grid.ColumnSpan="6" > <Grid Grid.Row="8" Grid.ColumnSpan="6" >
<telerik:RadProgressBar Name="Progress" Style="{StaticResource styleTTOProgessBar}" /> <Grid.RowDefinitions>
<TextBlock Name="ProgressText" Text="100" Foreground="White" FontSize="20" HorizontalAlignment="Center" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<telerik:RadProgressBar Name="Progress" Style="{StaticResource styleTTOProgessBar}" Grid.Row="0" />
<TextBlock Name="ProgressText" Text="100" Foreground="White" FontSize="20" HorizontalAlignment="Center" Grid.Row="1" />
<telerik:RadStepProgressBar Grid.Row="2" x:Name="stepEPD" Margin="10,0,10,10" >
<telerik:RadStepProgressBarItem Content="Connect" />
<telerik:RadStepProgressBarItem Content="Status" />
</telerik:RadStepProgressBar>
</Grid> </Grid>
<StackPanel Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="6" HorizontalAlignment="Center" VerticalAlignment="Center" > <StackPanel Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="6" HorizontalAlignment="Center" VerticalAlignment="Center" >

View file

@ -58,7 +58,8 @@ namespace eDosStation
private void Ep_EpdError(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdErrorEventArgs e) private void Ep_EpdError(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdErrorEventArgs e)
{ {
System.Diagnostics.Debug.WriteLine("ERROR "); System.Diagnostics.Debug.WriteLine("ERROR ");
Dispatcher.InvokeAsync(() => { Dispatcher.InvokeAsync(() =>
{
MessageBox.Show($"EPD Error {e.returnValue} {e.ErrorRV} {e.ErrorStep}"); MessageBox.Show($"EPD Error {e.returnValue} {e.ErrorRV} {e.ErrorStep}");
Dispatcher.InvokeAsync(() => { SetTimedOutAndEnd(); }); Dispatcher.InvokeAsync(() => { SetTimedOutAndEnd(); });
}); });
@ -70,6 +71,21 @@ namespace eDosStation
dispatcherTimer?.Stop(); dispatcherTimer?.Stop();
Dispatcher.InvokeAsync(() => LoadDoses()); Dispatcher.InvokeAsync(() => LoadDoses());
} }
private void Ep_EpdProgress(EpdBaseClr.Epd2 Sender, int step, int result)
{
System.Diagnostics.Debug.WriteLine($"EPD Progress step:{step} result:{result}");
int index = -1;
switch (step)
{
case 4: index = 0; break;
case 5: index = 1; break;
case 10: index = 2; break;
}
if (index >= 0 && index < stepEPD.Items.Count)
{
this.Dispatcher.InvokeAsync(new Action(() => stepEPD.SelectedIndex = 1), DispatcherPriority.Render);
}
}
#endregion #endregion
@ -90,7 +106,8 @@ namespace eDosStation
if (ep.eDoshasAlarm) if (ep.eDoshasAlarm)
{ {
hasAlarm.Text = "Yes"; hasAlarm.Text = "Yes";
} else }
else
hasAlarm.Text = "No"; hasAlarm.Text = "No";
epdid.Text = ep.EpdID.ToString(); epdid.Text = ep.EpdID.ToString();
@ -107,24 +124,27 @@ namespace eDosStation
HpDose07.Text = $"{ep.Hp07:0.00} µSv"; HpDose07.Text = $"{ep.Hp07:0.00} µSv";
HpDose10.Text = $"{ep.Hp10:0.00} µSv"; HpDose10.Text = $"{ep.Hp10:0.00} µSv";
HP10AlarmDose1l.Text = "Warning "+ ep.Hp10Name; HP10AlarmDose1l.Text = "Warning " + ep.Hp10Name;
HP10AlarmDose2l.Text = "Alarm "+ ep.Hp10Name; HP10AlarmDose2l.Text = "Alarm " + ep.Hp10Name;
HP07AlarmDosel.Text = "Alarm "+ ep.Hp07Name; HP07AlarmDosel.Text = "Alarm " + ep.Hp07Name;
HP10AlarmDose1.Text = $"{ep.Hp10THDose1:0.00} µSv"; HP10AlarmDose1.Text = $"{ep.Hp10THDose1:0.00} µSv";
HP10AlarmDose2.Text = $"{ep.Hp10THDose2:0.00} µSv"; HP10AlarmDose2.Text = $"{ep.Hp10THDose2:0.00} µSv";
HP07AlarmDose.Text = $"{ep.Hp07THDose:0.00} µSv"; HP07AlarmDose.Text = $"{ep.Hp07THDose:0.00} µSv";
HpPeak07l.Text = ep.Hp07Name +" Peak"; HpPeak07l.Text = ep.Hp07Name + " Peak";
HpPeak07.Text = $"{ep.Hp07Peak:0.00} µSv {ep.Hp07PeakTime:yyyy-MM-dd HH:mm} "; HpPeak07.Text = $"{ep.Hp07Peak:0.00} µSv {ep.Hp07PeakTime:yyyy-MM-dd HH:mm} ";
HpPeak10l.Text = ep.Hp10Name + " Peak"; HpPeak10l.Text = ep.Hp10Name + " Peak";
HpPeak10.Text = $"{ep.Hp10Peak:0.00} µSv {ep.Hp10PeakTime:yyyy-MM-dd HH:mm} "; HpPeak10.Text = $"{ep.Hp10Peak:0.00} µSv {ep.Hp10PeakTime:yyyy-MM-dd HH:mm} ";
if (ep.isNG) { if (ep.isNG)
{
lNGain.Visibility = NGain.Visibility = Visibility.Visible; lNGain.Visibility = NGain.Visibility = Visibility.Visible;
NGain.Text = ep.NGgain.ToString("#.##"); NGain.Text = ep.NGgain.ToString("#.##");
} else { }
else
{
lNGain.Visibility = NGain.Visibility = Visibility.Hidden; lNGain.Visibility = NGain.Visibility = Visibility.Hidden;
} }
@ -132,7 +152,7 @@ namespace eDosStation
{ {
try try
{ {
thisUser = thisStation.dataInterface.GetUser(string.Empty, sPersID,false); thisUser = thisStation.dataInterface.GetUser(string.Empty, sPersID, false);
epdUserMargin.Text = thisUser.Margin.ToString(); epdUserMargin.Text = thisUser.Margin.ToString();
} }
catch catch
@ -151,11 +171,12 @@ namespace eDosStation
FinalTimeOut = false; FinalTimeOut = false;
EpdReading = false; EpdReading = false;
ep = new EpdBaseClr.Epd2(thisStation.ComPort,thisStation.OnlyMK2); ep = new EpdBaseClr.Epd2(thisStation.ComPort, thisStation.OnlyMK2);
ep.SetFeedbackSound(thisStation.useBeep, thisStation.useBeepMK3()); ep.SetFeedbackSound(thisStation.useBeep, thisStation.useBeepMK3());
ep.EpdRead += Ep_EpdRead; ep.EpdRead += Ep_EpdRead;
ep.EpdError += Ep_EpdError; ep.EpdError += Ep_EpdError;
ep.EpdTO += Ep_EpdTO; ep.EpdTO += Ep_EpdTO;
ep.EpdProgress += Ep_EpdProgress;
dispatcherTimer = new DispatcherTimer(DispatcherPriority.Background); dispatcherTimer = new DispatcherTimer(DispatcherPriority.Background);
dispatcherTimer.Interval = thisStation.ScreenProgressBarInterval; dispatcherTimer.Interval = thisStation.ScreenProgressBarInterval;
@ -172,6 +193,10 @@ namespace eDosStation
//Dispatcher.InvokeAsync(() => ep.Wait(thisStation.EPDTimeOut, 1),DispatcherPriority.Background); //Dispatcher.InvokeAsync(() => ep.Wait(thisStation.EPDTimeOut, 1),DispatcherPriority.Background);
//dispatcherTimer.Start(); //dispatcherTimer.Start();
} }
private void startEPDRead() private void startEPDRead()
{ {
EpdReading = true; bEpdCancel.IsEnabled = false; EpdReading = true; bEpdCancel.IsEnabled = false;
@ -233,5 +258,11 @@ namespace eDosStation
System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(ex.Message);
} }
} }
private void DosimeterView_CloseClicked(object sender, RoutedEventArgs e)
{
this.Close();
}
} }
} }

View file

@ -0,0 +1,26 @@
<Window x:Class="eDosStation.ShowEPDDose2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:eDosStation"
mc:Ignorable="d"
Title="Show EPD Dose" Height="620" Width="785"
Loaded="Window_Loaded"
WindowStartupLocation="CenterScreen"
FontFamily="Segoe UI"
WindowStyle="None" Closing="Window_Closing" WindowState="Maximized">
<DockPanel>
<!-- Status Bar anchored at the bottom -->
<StatusBar DockPanel.Dock="Bottom">
<StatusBarItem x:Name="statusEPD" Content="Epd" />
</StatusBar>
<!-- Main UserControl occupying the remaining window area -->
<local:DosimeterDisplay x:Name="DosimeterView"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CloseClicked="DosimeterView_CloseClicked"/>
</DockPanel>
</Window>

View file

@ -0,0 +1,287 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace eDosStation
{
/// <summary>
/// Interaction logic for ShowEPDDose2.xaml
/// </summary>
public partial class ShowEPDDose2 : Window
{
private enum eEntryState { none, getepd, epdtimeout, epdError, epdOK, final };
#pragma warning disable CS0414 // The field 'ShowEPDDose.EntryState' is assigned but its value is never used
private eEntryState EntryState;
#pragma warning restore CS0414 // The field 'ShowEPDDose.EntryState' is assigned but its value is never used
Station thisStation;
EpdBaseClr.Epd2 ep;
DispatcherTimer dispatcherTimer;
private DateTime ResultTime;
private User thisUser;
#pragma warning disable CS0414 // The field 'ShowEPDDose.EpdReading' is assigned but its value is never used
private bool EpdReading;
#pragma warning restore CS0414 // The field 'ShowEPDDose.EpdReading' is assigned but its value is never used
private bool FinalTimeOut;
public ShowEPDDose2(Station curStation)
{
InitializeComponent();
thisStation = curStation;
EpdReading = false;
FinalTimeOut = false;
EntryState = eEntryState.none;
}
private void CountDown(object sender, EventArgs e)
{
double v = (ResultTime - DateTime.Now).TotalSeconds;
if (v > DosimeterView.Progress.Minimum)
{
DosimeterView.Progress.Value = v;
DosimeterView.ProgressText.Text = ((int)v).ToString();
}
else
{
SetTimedOutAndEnd();
}
}
#region EPD Callback
private void Ep_EpdTO(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdTOEventArgs e)
{
System.Diagnostics.Debug.WriteLine("TIME OUT");
DosimeterView.Dispatcher.InvokeAsync(() => { SetTimedOutAndEnd(); });
}
private void Ep_EpdError(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdErrorEventArgs e)
{
System.Diagnostics.Debug.WriteLine("ERROR ");
DosimeterView.Dispatcher.InvokeAsync(() => {
MessageBox.Show($"EPD Error {e.returnValue} {e.ErrorRV} {e.ErrorStep}");
DosimeterView.Dispatcher.InvokeAsync(() => { SetTimedOutAndEnd(); });
});
}
private void Ep_EpdRead(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdEventArgs e)
{
EpdReading = false;
dispatcherTimer?.Stop();
DosimeterView.Dispatcher.InvokeAsync(() => LoadDoses());
}
private void Ep_EpdProgress(EpdBaseClr.Epd2 Sender, int step, int result)
{
System.Diagnostics.Debug.WriteLine($"EPD Progress step:{step} result:{result}");
int index = -1;
switch (step)
{
case 4: index = 0; break;
case 5: index = 1; break;
case 10: index = 2; break;
}
if (index >= 0 && index <= DosimeterView.stepEPD.Items.Count)
{
this.Dispatcher.Invoke(() =>
{
DosimeterView.stepEPD.SelectedIndex = index;
// Optional: Force the progress step visual item to update status if needed
if (DosimeterView.stepEPD.ItemContainerGenerator.ContainerFromIndex(index) is FrameworkElement container)
{
container.UpdateLayout();
}
}, System.Windows.Threading.DispatcherPriority.Normal);
}
}
#endregion
private void LoadDoses()
{
int rv = 0;
if (ep == null) return;
rv = ep.GetAll(true);
if (rv != 0) MessageBox.Show("Communication error");
DosimeterView.isIssued.Text = ep.EPDIssued ? "Yes" : "no";
string sPersID = ep.WearerName.Trim();
DosimeterView.Wearer.Text = sPersID;
DosimeterView.EpdVisit.Text = ep.WearerID.ToString();
DosimeterView.HardVersion.Text = ep.HardVersion.ToString() + '.' + ep.HardVersionMinor.ToString(); // ep.SoftVersion.ToString();
if (ep.eDoshasAlarm)
{
DosimeterView.hasAlarm.Text = "Yes";
}
else
DosimeterView.hasAlarm.Text = "No";
DosimeterView.epdid.Text = ep.EpdID.ToString();
var stype = new StringBuilder();
if (ep.isMK3) stype.Append("MK3 "); else stype.Append("MK2 ");
if (ep.isBG) stype.Append(" BG"); else stype.Append(" NG");
DosimeterView.epdtype.Text = stype.ToString();
Decoder.AlarmToTextBox(DosimeterView.sAlarm, ep);
DosimeterView.HpDose07l.Text = ep.Hp07Name;
DosimeterView.HpDose10l.Text = ep.Hp10Name;
DosimeterView.HpDose07.Text = $"{ep.Hp07:0.00} µSv";
DosimeterView.HpDose10.Text = $"{ep.Hp10:0.00} µSv";
DosimeterView.HP10AlarmDose1l.Text = "Warning " + ep.Hp10Name;
DosimeterView.HP10AlarmDose2l.Text = "Alarm " + ep.Hp10Name;
DosimeterView.HP07AlarmDosel.Text = "Alarm " + ep.Hp07Name;
DosimeterView.HP10AlarmDose1.Text = $"{ep.Hp10THDose1:0.00} µSv";
DosimeterView.HP10AlarmDose2.Text = $"{ep.Hp10THDose2:0.00} µSv";
DosimeterView.HP07AlarmDose.Text = $"{ep.Hp07THDose:0.00} µSv";
DosimeterView.HpPeak07l.Text = ep.Hp07Name + " Peak";
DosimeterView.HpPeak07.Text = $"{ep.Hp07Peak:0.00} µSv {ep.Hp07PeakTime:yyyy-MM-dd HH:mm} ";
DosimeterView.HpPeak10l.Text = ep.Hp10Name + " Peak";
DosimeterView.HpPeak10.Text = $"{ep.Hp10Peak:0.00} µSv {ep.Hp10PeakTime:yyyy-MM-dd HH:mm} ";
if (ep.isNG)
{
DosimeterView.lNGain.Visibility = DosimeterView.NGain.Visibility = Visibility.Visible;
DosimeterView.NGain.Text = ep.NGgain.ToString("#.##");
}
else
{
DosimeterView.lNGain.Visibility = DosimeterView.NGain.Visibility = Visibility.Hidden;
}
if (!string.IsNullOrEmpty(sPersID))
{
try
{
thisUser = thisStation.dataInterface.GetUser(string.Empty, sPersID, false);
DosimeterView.epdUserMargin.Text = thisUser.Margin.ToString();
}
catch
{
}
}
else
DosimeterView.epdUserMargin.Text = "--";
DosimeterView.Progress.Visibility = Visibility.Collapsed;
DosimeterView.bEpdCancel.IsEnabled = true;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
FinalTimeOut = false;
EpdReading = false;
ep = new EpdBaseClr.Epd2(thisStation.ComPort, thisStation.OnlyMK2);
ep.SetFeedbackSound(thisStation.useBeep, thisStation.useBeepMK3());
ep.EpdRead += Ep_EpdRead;
ep.EpdError += Ep_EpdError;
ep.EpdTO += Ep_EpdTO;
ep.EpdProgress += Ep_EpdProgress;
dispatcherTimer = new DispatcherTimer(DispatcherPriority.Background);
dispatcherTimer.Interval = thisStation.ScreenProgressBarInterval;
dispatcherTimer.Tick += CountDown;
ResultTime = DateTime.Now.AddSeconds(thisStation.ScreenEPDTimeout);
DosimeterView.Progress.Value = DosimeterView.Progress.Maximum = thisStation.ScreenEPDTimeout;
dispatcherTimer.Start();
startEPDRead();
//dispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal);
//dispatcherTimer.Interval = TimeSpan.FromMilliseconds(thisStation.EPDTimeOut / 10);
//Progress.Maximum = Progress.Value = dispatcherTimer.Interval.TotalSeconds * 10;
//dispatcherTimer.Tick += CountDown;
//Dispatcher.InvokeAsync(() => ep.Wait(thisStation.EPDTimeOut, 1),DispatcherPriority.Background);
//dispatcherTimer.Start();
}
private void startEPDRead()
{
EpdReading = true; DosimeterView.bEpdCancel.IsEnabled = false;
DosimeterView.Dispatcher.InvokeAsync(new Action(() => { ep.Wait(thisStation.EPDTimeOut, thisStation.EPDRetries); }), DispatcherPriority.Background);
}
private void SetTimedOutAndEnd()
{
if (!FinalTimeOut)
{
DosimeterView.bEpdCancel.IsEnabled = true;
FinalTimeOut = true;
dispatcherTimer?.Stop();
DosimeterView.Progress.Value = 0;
DosimeterView.Progress.Background = System.Windows.Media.Brushes.Red;
statusEPD.Content = "Time out";
DosimeterView.tWaitFor.Text = "Lezer niet gevonden !";
dispatcherTimer = new DispatcherTimer(DispatcherPriority.Background);
dispatcherTimer.Tick += ShowAndEnd;
dispatcherTimer.Interval = thisStation.ShowTimeoutTime;
dispatcherTimer.Start();
}
}
private void ShowAndEnd(object sender, EventArgs e)
{
dispatcherTimer?.Stop();
dispatcherTimer = null;
endPage();
}
private void endPage()
{
this.Close();
}
private void DosimeterView_CloseClicked(object sender, RoutedEventArgs e)
{
endPage();
}
private void RadButton_Click(object sender, RoutedEventArgs e)
{
endPage();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
dispatcherTimer?.Stop();
dispatcherTimer = null;
EpdReading = true;
try
{
if (ep != null)
{
ep.WaitEnd();
ep.Dispose();
ep = null;
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
}
}

View file

@ -188,6 +188,9 @@
<Compile Include="Decoder.cs" /> <Compile Include="Decoder.cs" />
<Compile Include="cDevCon.cs" /> <Compile Include="cDevCon.cs" />
<Compile Include="DecodeResults.cs" /> <Compile Include="DecodeResults.cs" />
<Compile Include="DosimeterDisplay.xaml.cs">
<DependentUpon>DosimeterDisplay.xaml</DependentUpon>
</Compile>
<Compile Include="EntryBadge.xaml.cs"> <Compile Include="EntryBadge.xaml.cs">
<DependentUpon>EntryBadge.xaml</DependentUpon> <DependentUpon>EntryBadge.xaml</DependentUpon>
</Compile> </Compile>
@ -209,6 +212,9 @@
<Compile Include="ShowEPDDose.xaml.cs"> <Compile Include="ShowEPDDose.xaml.cs">
<DependentUpon>ShowEPDDose.xaml</DependentUpon> <DependentUpon>ShowEPDDose.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="ShowEPDDose2.xaml.cs">
<DependentUpon>ShowEPDDose2.xaml</DependentUpon>
</Compile>
<Compile Include="SimulateData.cs" /> <Compile Include="SimulateData.cs" />
<Compile Include="SqlLog.cs" /> <Compile Include="SqlLog.cs" />
<Compile Include="Station.cs" /> <Compile Include="Station.cs" />
@ -233,6 +239,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="DosimeterDisplay.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="eDosDict.xaml"> <Page Include="eDosDict.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@ -283,6 +293,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<TransformOnBuild>true</TransformOnBuild> <TransformOnBuild>true</TransformOnBuild>
</Page> </Page>
<Page Include="ShowEPDDose2.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TimeColor.xaml"> <Page Include="TimeColor.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>