예제 #1
0
        protected virtual IEnumerable <IChangeableData> GetExternalData()
        {
            logger.Debug(MethodBase.GetCurrentMethod().Name);
            logger.InfoFormat(Resources.Info_TimeOut, OperationHangTimeOut);

            using (HangWatcher watcher = new HangWatcher(OperationHangTimeOut))
            {
                watcher.Token.Register(() => ExternalSource.Cancel());
                ExternalSource.ViabilityObserver.SomeBodyStillAlive += (o, e) => watcher.PostPone(OperationHangTimeOut);

                return(ExternalSource.GetData());
            }
        }
        public void FindAndNotify()
        {
            //Get Freash data
            var receivedData = ExternalSource.GetData();

            //Get old data
            var presavedData = DataStorage.GetData();

            if (presavedData != null)
            {
                Analyzer.Analyze(receivedData, presavedData);
                Notify();
            }

            // Clear All old data
            DataStorage.CleanStorage();
            // Save new data
            DataStorage.SaveData(receivedData);
        }