123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System;
- using Wayne.Lib;
- #if _SINP
- using Wayne.ForecourtControl.Nfs;
- #endif
- namespace Wayne.ForecourtControl.Fusion
- {
- /// <summary>
- /// </summary>
- public interface ITwin
- {
- /// <summary>
- /// Opens or closes the station.
- /// </summary>
- /// <param name="userToken">A user supplied object that will be returned in the requestCompleted callback</param>
- void OpenMasterAsync(EventHandler<Wayne.Lib.AsyncCompletedEventArgs> requestCompleted, object userToken);
- event EventHandler OnMasterReady;
- }
- public static class FUSIONTwinFactory
- {
- private static FUSIONTwin twin = null;
- public static ITwin CreateTwin(int deviceId)
- {
- twin = new FUSIONTwin(deviceId);
- return twin;
- }
- public static ITwin getTwin()
- { return twin; }
- }
- internal class FUSIONTwin: ITwin
- {
- private FUSIONForecourtControl forecourtControl;
- public FUSIONTwin(int deviceId)
- {
- if (FUSIONFactory.fusionForecourtControlList.ContainsKey(deviceId))
- this.forecourtControl = (FUSIONForecourtControl)(FUSIONFactory.fusionForecourtControlList[deviceId]);
- }
- public event EventHandler OnMasterReady;
- internal void FireOnTwinMasterReady()
- {
- try
- {
- if (this.OnMasterReady != null)
- {
- Trace.WriteLine("init FireOnTwinMasterReady");
- this.OnMasterReady(this, EventArgs.Empty);
- Trace.WriteLine("end FireOnTwinMasterReady");
- }
- else
- Trace.WriteLine("FireOnTwinMasterReady - OnMasterReady is null");
- }
- catch(Exception ex)
- {
- Trace.WriteLine(string.Format("EXCEPTION! Stack chiamate: {0} Messaggio: {1}", ex.StackTrace, ex.Message));
- }
- }
- public void OpenMasterAsync(EventHandler<AsyncCompletedEventArgs> requestCompleted, object userToken)
- {
- this.forecourtControl.manager.ifsfManager.TwinOpenMaster(requestCompleted, userToken, this);
- }
- }
- }
|