示例#1
0
        public void Initialize(ConfigEntity config)
        {
            mconfig = config;

            foreach (string antNum in DataCollection.DevInfos.Keys)
            {
                DevInfo dev = DataCollection.DevInfos[antNum];

                if (!DataCollection.MachineList.ContainsKey(antNum))
                {

                    IMachine m =MachineFactory.GetMachine(DataCollection.Config.MachineType,dev.DevIp,dev.DevPort,dev.DevUserName,dev.DevPassWord,dev.AntNo);
                    m.EventVerifyUser += new EventHandler(mprocess.VerifyUserCallBack);
                    m.OnEInputFeaturer = new EventHandler(SwipeFaileHandle.InputUserFeatureCallBack);
                    DataCollection.MachineList.Add(antNum,m);
                }

            }

            // 初始化线程处理类

            // 一分钟执行一次
            DevTimer = new System.Timers.Timer();
            DevTimer.Interval = 60000;
            DevTimer.Elapsed += new System.Timers.ElapsedEventHandler(mprocess.MonitorDevConnectStatus);

            // 5秒执行一次
            PassUserTimer = new System.Timers.Timer();
            PassUserTimer.Interval = 5000*20;
            PassUserTimer.Elapsed += new System.Timers.ElapsedEventHandler(mprocess.PassUser);

            // 1分执行一次
            AutoLeaveTimer = new System.Timers.Timer();
            AutoLeaveTimer.Interval = 1000*30;
            AutoLeaveTimer.Elapsed += new System.Timers.ElapsedEventHandler(mprocess.AutoLeaveUser);

            // 5分钟执行一次
            CopyDataToDBTimer = new System.Timers.Timer();
            CopyDataToDBTimer.Interval = 1000 * 60*5;
            CopyDataToDBTimer.Elapsed += new System.Timers.ElapsedEventHandler(mprocess.CopyDataToDB);

            // 10分钟执行一次
            CopyDataToMemorTimer = new System.Timers.Timer();
            CopyDataToMemorTimer.Interval = 1000 * 60*10;
            CopyDataToMemorTimer.Elapsed += new System.Timers.ElapsedEventHandler(mprocess.CopyDataToMemor);

            // 10分钟执行一次
            CopyDataToDevTimer = new System.Timers.Timer();
            CopyDataToDevTimer.Interval = 1000 * 60 * 10;
            CopyDataToDevTimer.Elapsed += new System.Timers.ElapsedEventHandler(mprocess.CopyDataToDev);
        }
示例#2
0
        /// <summary>
        /// 从配置文件中读取数据
        /// </summary>
        /// <returns></returns>
        public static ConfigEntity LoadConfig()
        {
            ConfigEntity config = new ConfigEntity();

            config.DBName = ConfigurationSettings.AppSettings["DBname"];
            config.DBServer = ConfigurationSettings.AppSettings["DBServer"];
            config.DBUserName= ConfigurationSettings.AppSettings["DBUserName"];
            config.DBPassword = ConfigurationSettings.AppSettings["DBPassword"];
            config.SysLogPath = ConfigurationSettings.AppSettings["SysLogPath"];
            config.InfoLogPath = ConfigurationSettings.AppSettings["InfoLogPath"];
            config.ReportConnectionString = ConfigurationSettings.AppSettings["ReportConnectionString"];
            config.CheckInWell = string.IsNullOrEmpty(ConfigurationSettings.AppSettings["CheckInWell"]) ? 0 : System.Convert.ToInt32(ConfigurationSettings.AppSettings["CheckInWell"]);

            config.CopyDataNow = string.IsNullOrEmpty(ConfigurationSettings.AppSettings["CopyDataNow"]) ? 0 : System.Convert.ToInt32(ConfigurationSettings.AppSettings["CopyDataNow"]);
            config.MachineType = ConfigurationSettings.AppSettings["MachineType"];

            return config;
        }