#pragma once
#include "MK3.h"

#pragma managed
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Runtime::InteropServices;
#include <msclr\marshal.h>
#include <msclr\marshal_cppstd.h>



namespace MK3 {
	const char* cEpdError = "Setreader Error";
	public ref class sEpdBase
	{
	public:
		int CurrentDeviceID;
		bool isIssued;
		bool isBG;
		bool isMK3;
		Epd2^ par;

	public:
		sEpdBase(Epd2^ p);
		delegate void dEpdRead(sEpdBase^ Sender, EpdEventArgs^ e);
		delegate void dEpdTO(sEpdBase^ Sender, EventArgs^ e);
		delegate void dEpdError(sEpdBase^ Sender, EpdErrorEventArgs^ e);

	public:
		dEpdRead^ _EpdRead;
		dEpdTO^ _EpdTO;
		dEpdError^ _EpdError;

	public:
		/*event dEpdRead^ EpdRead
		{
			void add(dEpdRead^ handler)
			{
				_EpdRead += handler;
			}

			void remove(dEpdRead^ handler)
			{
				_EpdRead -= handler;
			}
		}
		event dEpdError^ EpdError
		{
			void add(dEpdError^ handler)
			{
				_EpdError += handler;
			}

			void remove(dEpdError^ handler)
			{
				_EpdError -= handler;
			}
		}
		event dEpdTO^ EpdTO
		{
			void add(dEpdTO^ handler)
			{
				_EpdTO += handler;
			}

			void remove(dEpdTO^ handler)
			{
				_EpdTO -= handler;
			}
		}*/

	};
	public ref class EpdEventArgs :  EventArgs
	{
	public:
		int deviceID;
		bool isIssued, isBG, isMK3;

		EpdEventArgs(sEpdBase^ eb) : EventArgs()
		{
			this->deviceID = eb->CurrentDeviceID;
			this->isIssued = eb->isIssued;
			this->isBG = eb->isBG;
			this->isMK3 = eb->isMK3;
		}

	};
	public ref struct EpdException : System::Exception
	{
	public:
		int errorCode;
		EpdException(int r) : System::Exception(gcnew String(cEpdError))
		{
			this->errorCode = r;
		}
	};
	public ref class EpdErrorEventArgs : EventArgs
	{
	public:
		int returnValue;

		EpdErrorEventArgs(int ReturnValue) : EventArgs()
		{
			this->returnValue = ReturnValue;
		}

	};
}