Ejemplo n.º 1
0
        public static ImportControlSetting GetSettings()
        {
            if (_importControlSetting == null)
            {
                lock (typeof(ImportControlSetting))
                {
                    if (_importControlSetting == null)
                    {
                        _importControlSetting = new ImportControlSetting();
                    }
                }
            }

            if (!File.Exists(FileName))
            {
                return(_importControlSetting);
            }

            {
                using (FileStream fs = new FileStream(FileName, FileMode.Open))
                {
                    XmlSerializer xmlSettings = new XmlSerializer(typeof(ImportControlSetting));
                    _importControlSetting = (ImportControlSetting)xmlSettings.Deserialize(fs);
                    fs.Close();
                }
            }
            return(_importControlSetting);
        }
Ejemplo n.º 2
0
        public ImportController(ImportControlSetting settings)
        {
            _impSettings = settings;
            ImportPath   = _impSettings.ImportPath;

            _timerCheckRunnigProgramm = new Timer()
            {
                Interval  = _impSettings.Interval * 1000,
                Enabled   = _impSettings.WorkIt,
                AutoReset = true
            };
            _timerCheckRunnigProgramm.Elapsed += OnTimerCheckStatus;

            _timerTrackingWorkImport = new Timer()
            {
                Interval  = _impSettings.IntervalLogImport * 1000,
                Enabled   = _impSettings.WorkLogImport,
                AutoReset = true
            };
            _timerTrackingWorkImport.Elapsed += OnTimerWorkStatus;

            CountForRespondToProc = _impSettings.CountForRespondToProc;
            KillNoRespondProc     = _impSettings.KillNoRespondProc;
            CloseCopyImport       = _impSettings.CloseCopyImport;
        }