Beispiel #1
0
 private void FrmETCSetting_Load(object sender, EventArgs e)
 {
     _ETC = ETCSetting.GetSetting();
     if (_ETC != null)
     {
         txtReadSameCardInterval.IntergerValue = _ETC.ReadSameCardInterval;
         ShowDevicesOnGrid(_ETC.Devices);
     }
     chkEnable.Checked = GlobalSettings.Current.Get <OpenCardMessageHandler>().ContainService <ETCSetting>();
 }
Beispiel #2
0
        private void InitOpenCardServices(object obj)
        {
            OpenCardMessageHandler handler = new OpenCardMessageHandler();

            GlobalSettings.Current.Set <OpenCardMessageHandler>(handler);
            GlobalSettings.Current.Set <Dictionary <int, CardEventReport> >(new Dictionary <int, CardEventReport>());
            handler.Debug       = this.chkDebug.Checked;
            handler.OnReadCard += new EventHandler <OpenCardEventArgs>(handler_OnReadCard);
            handler.OnPaying   += new EventHandler <OpenCardEventArgs>(handler_OnPaying);
            handler.OnPaidOk   += new EventHandler <OpenCardEventArgs>(handler_OnPaidOk);
            handler.OnPaidFail += new EventHandler <OpenCardEventArgs>(handler_OnPaidFail);
            handler.OnError    += new EventHandler <OpenCardEventArgs>(handler_OnError);

            SysParaSettingsBll ssb  = new SysParaSettingsBll(AppSettings.CurrentSetting.AvailableParkConnect);
            string             temp = AppSettings.CurrentSetting.GetConfigContent("EnableZST");
            bool enabled            = false;

            if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled)
            {
                ZSTSettings zst = ssb.GetSetting <ZSTSettings>();
                if (zst != null)
                {
                    handler.InitService(zst);
                }
            }

            temp = AppSettings.CurrentSetting.GetConfigContent("EnableYiTingShanFu");
            if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled)
            {
                YiTingShanFuSetting yt = ssb.GetSetting <YiTingShanFuSetting>();
                if (yt != null)
                {
                    AppSettings.CurrentSetting.GetYiTingConfig(yt);
                    handler.InitService(yt);
                }
            }

            temp = AppSettings.CurrentSetting.GetConfigContent("EnableYCT");
            if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled)
            {
                YCTSetting yct = ssb.GetSetting <YCTSetting>();
                if (yct != null)
                {
                    handler.InitService(yct);
                }
            }

            temp = AppSettings.CurrentSetting.GetConfigContent("EnableETC");
            if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled)
            {
                ETCSetting etc = ETCSetting.GetSetting();
                if (etc != null)
                {
                    handler.InitService(etc);
                }
            }

            temp = AppSettings.CurrentSetting.GetConfigContent("EnableLR280");
            if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled)
            {
                Ralid.OpenCard.OpenCardService.LR280.LR280Setting lr280 = ssb.GetSetting <OpenCardService.LR280.LR280Setting>();
                if (lr280 != null)
                {
                    handler.InitService(lr280);
                }
            }
            this.Invoke((Action)(() => { ShowServiceState(); }));
        }