Example #1
0
        public Form1()
        {
            InitializeComponent();
            ReadSettings();
            //this.m_OpcReaJetAdapter = new OpcReaJetAdapter(this._portName, this._baudRate, this._parity, this._dataBits, this._stopBits, this._readTimeOut, this._writeTimeOut,
            //    this._ackTimeOut, this._replyTelegramTimeOut, this._HskInputParam, this._HskTriggerTag, (byte)this._triggerFromValue, (byte)this._triggerToValue, this._HskOutputParamsTag,
            //    this._HskAckTag);

            this.m_sm = new ServiceManager();
        }
Example #2
0
        static void Main(string[] args)
        {
            LogHelperLib.Helper.InitializeLogger(string.Format("ReaJetCommsService"), string.Format("ReaJetCommsServiceLog.sil"));
            CreateLibSessions();

            ServiceManager sm = null;

            SiAuto.Main.EnterProcess("Main");

            try
            {

                sm = new ServiceManager();

                OpcReaJetAdapter opcReaJetAdapter = new OpcReaJetAdapter();

                opcReaJetAdapter.Settings = ReadSettings();

                SingleInstanceServiceWrapper<OpcReaJetAdapter> ControllerLoaderService
                    = new SingleInstanceServiceWrapper<OpcReaJetAdapter>(opcReaJetAdapter);

                sm.Services.Add(ControllerLoaderService);

                sm.InitializeServices();
                sm.ActivateServices();

                Console.WriteLine("Services running");
                Console.WriteLine("Press ENTER to stop services");

                Console.ReadLine();
                sm.DeactivateServices();
            }
            catch (FaultException ex)
            {
                SiAuto.Main.LogException(ex);
            }
            finally
            {
                sm.UninitializeServices();
                SiAuto.Main.LeaveProcess("Main");

            }
        }