public void Dispose() { if (_disposed) { return; } ObjectStateNotifier.RemoveObserver(this); try { Releaseobject(_exchangeClientSiteCode, "_exchangeClientSiteCode"); Releaseobject(_exchangeClientTITOEnDis, "_exchangeClientTITOEnDis"); Releaseobject(_exchangeClientTITOEXP, "_exchangeClientTITOEXP"); Releaseobject(_iExchangeAdminSiteCode, "_iExchangeAdminSiteCode"); Releaseobject(_iExchangeAdminTITOEnDis, "_iExchangeAdminTITOEnDis"); Releaseobject(_iExchangeAdminTITOEXP, "_iExchangeAdminTITOEXP"); LogManager.WriteLog("Dispose | All Objects were released successfully.", LogManager.enumLogLevel.Info); } catch { } _exchangeClientSiteCode = null; _exchangeClientTITOEnDis = null; _exchangeClientTITOEXP = null; _iExchangeAdminSiteCode = null; _iExchangeAdminTITOEnDis = null; _iExchangeAdminTITOEXP = null; GC.SuppressFinalize(this); }
public AutoEnableDisable() { _exchangeClient = new ExchangeClient(); _exchangeClient.ExchangeSectorUpdate += ExchangeClientExchangeSectorUpdate; _exchangeClient.ACK += ExchangeClientAck; _exchangeClient.UDPUpdate += ExchangeClientUDPUpdate; _exchangeClient.ServerUpdate += ExchangeClientServerUpdate; _exchangeClient.InitialiseExchange(0); lock (HoldingObject) { if (MessageStore == null) { MessageStore = new List <MessageStore>(); } if (AFTMessages == null) { AFTMessages = new List <AFTMessages>(); } } _iExchangeAdmin = (IExchangeAdmin)_exchangeClient; ObjectStateNotifier.AddObserver(this); }
public void Dispose() { if (_disposed) return; ObjectStateNotifier.RemoveObserver(this); try { var i = Marshal.ReleaseComObject(_exchangeClient); Thread.Sleep(10); while (i > 0) { LogManager.WriteLog("Number of objects in _exchangeClient = " + i, LogManager.enumLogLevel.Info); i = Marshal.ReleaseComObject(_exchangeClient); } LogManager.WriteLog("|=> _exchangeClient was released successfully.", LogManager.enumLogLevel.Info); i = Marshal.ReleaseComObject(_iExchangeAdmin); Thread.Sleep(10); while (i > 0) { LogManager.WriteLog("Number of objects in _iExchangeAdmin = " + i, LogManager.enumLogLevel.Info); i = Marshal.ReleaseComObject(_iExchangeAdmin); } LogManager.WriteLog("|=> _iExchangeAdmin was released successfully.", LogManager.enumLogLevel.Info); } catch { } _iExchangeAdmin = null; _exchangeClient = null; GC.SuppressFinalize(this); }
public TITO() { _exchangeClientSiteCode = new ExchangeClient(); _exchangeClientSiteCode.OPT_PARAM_ACK += ExchangeClientSiteCodeAck; _exchangeClientSiteCode.InitialiseExchange(0); _exchangeClientTITOEnDis = new ExchangeClient(); _exchangeClientTITOEnDis.TITO_ENDIS_ACK += ExchangeClientTITOAck; _exchangeClientTITOEnDis.InitialiseExchange(0); _exchangeClientTITOEXP = new ExchangeClient(); _exchangeClientTITOEXP.TITO_PARAM_ACK += ExchangeClientVoucherAck; _exchangeClientTITOEXP.InitialiseExchange(0); if (dTITORequest == null) { dTITORequest = new SortedDictionary <int, TITOThreadDataRequest>(); } if (dTicketExpireRequest == null) { dTicketExpireRequest = new SortedDictionary <int, int>(); } if (dSiteCodeRequest == null) { dSiteCodeRequest = new SortedDictionary <int, int>(); } _tmrRequest = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("TITOConfigInterval")) * 1000); _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest); _thAckResponse = new ThreadDispatcher <TITOThreadDataResponse>(1, "_thTITOAckResponse"); _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler <TITOThreadDataResponse>(this.TITOProcessResponse)); _thAckResponse.Initialize(); _thTicketExpireAckResponse = new ThreadDispatcher <TITOThreadDataResponse>(1, "_thTicketExpireAckResponse"); _thTicketExpireAckResponse.AddProcessThreadData(new ProcessThreadDataHandler <TITOThreadDataResponse>(this.TicketExpireProcessResponse)); _thTicketExpireAckResponse.Initialize(); _thSiteCodeAckResponse = new ThreadDispatcher <TITOThreadDataResponse>(1, "_thSiteCodeAckResponse"); _thSiteCodeAckResponse.AddProcessThreadData(new ProcessThreadDataHandler <TITOThreadDataResponse>(this.SiteCodeProcessResponse)); _thSiteCodeAckResponse.Initialize(); _iExchangeAdminSiteCode = (IExchangeAdmin)_exchangeClientSiteCode; _iExchangeAdminTITOEnDis = (IExchangeAdmin)_exchangeClientTITOEnDis; _iExchangeAdminTITOEXP = (IExchangeAdmin)_exchangeClientTITOEXP; ObjectStateNotifier.AddObserver(this); _tmrRequest.Start(); }
public InstantPeriodicIntervalHandler() { _exchangeClient = new ExchangeClient(); _exchangeClient.InitialiseExchange(0); _tmrRequest = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("InstantPeriodicInterval")) * 1000); _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest); _iExchangeAdmin = (IExchangeAdmin)_exchangeClient; ObjectStateNotifier.AddObserver(this); _tmrRequest.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="ThreadDispatcher"/> class. /// </summary> /// <param name="threadCount">The thread count.</param> public ThreadDispatcher(int threadCount, string helperName) { ObjectStateNotifier.AddObserver(this); _threadCount = (threadCount < 0 ? 1 : threadCount); _threadContainers = new SortedDictionary <int, ThreadContainer>(); _threadIndexes = new SortedDictionary <string, int>(StringComparer.InvariantCultureIgnoreCase); _rnd = new Random(_threadCount - 1); _evtInitialize = new ManualResetEvent(false); _closeHandles = new WaitHandle[0]; _helperName = helperName; this.InitSettings(); LogManager.WriteLog("|=> ThreadDispatcher created.", LogManager.enumLogLevel.Info); }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> private void Dispose(bool disposing) { if (!disposed) { if (disposing) { ObjectStateNotifier.RemoveObserver(this); _threadIndexes.Clear(); _threadContainers.Clear(); LogManager.WriteLog("|=> ThreadDispatcher disposed.", LogManager.enumLogLevel.Info); } disposed = true; } }
public AFTEnableDisable() { _exchangeClient = new ExchangeClient(); _exchangeClient.AFTAck += ExchangeClientAck; _exchangeClient.InitialiseExchange(0); if (_requestCollection == null) _requestCollection = new SortedDictionary<int, AFTEnableDisableThreadData>(); _tmrRequest = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("AFTTimeInterval")) * 1000); _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest); _thAckResponse = new ThreadDispatcher<AFTEnableDisableThreadDataResponse>(1, "_thAckResponse_AFTEnableDisable"); _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler<AFTEnableDisableThreadDataResponse>(this.ProcessResponse)); _thAckResponse.Initialize(); _iExchangeAdmin = (IExchangeAdmin)_exchangeClient; ObjectStateNotifier.AddObserver(this); _tmrRequest.Start(); }
public EmployeeMasterCard() { _exchangeClient = new ExchangeClient(); _exchangeClient.EMP_DATA_ACK += new _IExchangeClientEvents_EMP_DATA_ACKEventHandler(_exchangeClient_EMP_DATA_ACK); _exchangeClient.InitialiseExchange(0); if (_requestCollection == null) { _requestCollection = new SortedDictionary <int, EmployeeMasterCardThreadData>(); } _tmrRequest = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("EmployeecardTimeInterval")) * 1000); _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest); _thAckResponse = new ThreadDispatcher <EmployeeMasterCardThreadDataResponse>(1, "_thAckResponse_EmployeeMasterCard"); _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler <EmployeeMasterCardThreadDataResponse>(this.ProcessResponse)); _thAckResponse.Initialize(); _iExchangeAdmin = (IExchangeAdmin)_exchangeClient; ObjectStateNotifier.AddObserver(this); _tmrRequest.Start(); }
public AutoEnableDisable(ThreadDispatcher <MachineConfigThreadData> machineDispatcher) { _machineDispatcher = machineDispatcher; _machineDispatcher.AddProcessThreadData(new ProcessThreadDataHandler <MachineConfigThreadData>(this.OnMachineConfigAction)); ObjectStateNotifier.AddObserver(this); }