Esempio n. 1
0
 public ScanToPrintMain()
 {
     InitializeComponent();
     controller = new FacadeController(
         new LocalOLEDBPersistenceStrategiesFactory(GetConnectionStringByName("localDB")),
         new OnlineOLEDBPersistenceStrategiesFactory(GetConnectionStringByName("onlineDB")));
     backgroundQueue = new BackgroundQueue();
     System.Timers.Timer t = new System.Timers.Timer(TimeSpan.FromMinutes(5).TotalMilliseconds);
     t.AutoReset = true;
     t.Elapsed  += new System.Timers.ElapsedEventHandler(SyncData);
     t.Start();
     //this.ShowDialog();
 }
Esempio n. 2
0
        public ScanToPrintMain()
        {
            InitializeComponent();
            controller = new FacadeController(
                new LocalOLEDBPersistenceStrategiesFactory(GetConnectionStringByName("localDB")),
                new OnlineOLEDBPersistenceStrategiesFactory(GetConnectionStringByName("onlineDB")));
            int dataSyncFrequency = 6, focusRestorationFrequency = 16, jobOrderEntryDataSyncFrequency = 61;

            if (ConfigurationManager.AppSettings["DataSyncFrequency"] != null)
            {
                int.TryParse(ConfigurationManager.AppSettings["DataSyncFrequency"], out dataSyncFrequency);
            }

            if (ConfigurationManager.AppSettings["FocusRestorationFrequency"] != null)
            {
                int.TryParse(ConfigurationManager.AppSettings["FocusRestorationFrequency"], out focusRestorationFrequency);
            }

            if (ConfigurationManager.AppSettings["JobOrderEntryDataSyncFrequency"] != null)
            {
                int.TryParse(ConfigurationManager.AppSettings["JobOrderEntryDataSyncFrequency"], out jobOrderEntryDataSyncFrequency);
            }

            backgroundQueue = new BackgroundQueue();
            System.Timers.Timer t = new System.Timers.Timer(TimeSpan.FromMinutes(dataSyncFrequency).TotalMilliseconds);
            t.AutoReset = true;
            t.Elapsed  += new System.Timers.ElapsedEventHandler(SyncData);
            t.Start();

            System.Timers.Timer t_focus = new System.Timers.Timer(TimeSpan.FromSeconds(focusRestorationFrequency).TotalMilliseconds);
            t_focus.AutoReset = true;
            t_focus.Elapsed  += new System.Timers.ElapsedEventHandler(SetFocusOnMainWindown);
            t_focus.Start();

            System.Timers.Timer t_JobOrderEntryData = new System.Timers.Timer(TimeSpan.FromMinutes(jobOrderEntryDataSyncFrequency).TotalMilliseconds);
            t_JobOrderEntryData.AutoReset = true;
            t_JobOrderEntryData.Elapsed  += new System.Timers.ElapsedEventHandler(UpdateJobOrderEntryData);
            t_JobOrderEntryData.Start();

            lastScanings = InitializeScanTimes();
            int.TryParse(ConfigurationManager.AppSettings["WaitingPeriod"], out WaitingTime);
        }