示例#1
0
 public SyncService(ISyncDataService <TLocalData, TSyncData> localDataService, ISyncDataService <TSyncData, TLocalData> syncDataService)
 {
     _localDataService       = localDataService;
     _syncDataService        = syncDataService;
     AllowAutoCreateSyncInfo = false;
     _logger = DependencyResolver.Resolve <ILoggerFactory>().Create(GetType());
 }
示例#2
0
 public DocumentInfoDataService(
     IContentDocumentDataService contentDocumentDataService,
     ISyncDataService syncDataService,
     IContentDistributionDataService contentDistributionDataService)
 {
     _contentDistributionDataService = contentDistributionDataService;
     _contentDocumentDataService     = contentDocumentDataService;
     _syncDataService = syncDataService;
 }
 public DownloadingService(ISyncDataService syncDataService)
 {
     _syncDataService = syncDataService;
     var invokeInterval = TimeSpan.FromMinutes(30).TotalMilliseconds;
     _timer = new Timer(invokeInterval) { AutoReset = true };
     _timer.Elapsed += (sender, eventArgs) =>
     {
         if (!_syncDataService.Locked)
             _syncDataService.Sync();
     };
 }
示例#4
0
 public MobileConfigurationDataService(
     ICategoryInfoDataService categoryInfoDataService,
     ISettingsDataService settingsDataService,
     IMobileAppConfigDataService mobileAppConfigDataService,
     IAttachmentDataService mobileAppConfigAttachmentDataService,
     ISyncDataService syncDataService)
 {
     _syncDataService            = syncDataService;
     _categoryInfoDataService    = categoryInfoDataService;
     _settingsDataService        = settingsDataService;
     _attachmentDataService      = mobileAppConfigAttachmentDataService;
     _mobileAppConfigDataService = mobileAppConfigDataService;
 }
 public PullDataViewModel(IDialogService dialogService, ISettings settings, IDeviceSetupService deviceSetupService, IActivationService activationService, IMetaSyncService metaSyncService, ISyncDataService syncDataService, IFormsSyncService formsSyncService, IStaffSyncService staffSyncService, ICohortSyncService cohortSyncService, IEmrService emrService)
 {
     _dialogService      = dialogService;
     _settings           = settings;
     _deviceSetupService = deviceSetupService;
     _activationService  = activationService;
     _metaSyncService    = metaSyncService;
     _syncDataService    = syncDataService;
     _formsSyncService   = formsSyncService;
     _staffSyncService   = staffSyncService;
     _cohortSyncService  = cohortSyncService;
     _emrService         = emrService;
 }
 public SpotlightDataService(
     ICategoryInfoDataService categoryInfoDataService,
     ISyncDataService syncDataService,
     IContentDocumentDataService contentDocumentDataService,
     IContentDistributionDataService contentDistributionDataService,
     ISettingsDataService settingsDataService,
     INewCategoryContentDataService newCategoryContentDataService)
 {
     _contentDistributionDataService = contentDistributionDataService;
     _categoryInfoDataService        = categoryInfoDataService;
     _syncDataService               = syncDataService;
     _contentDocumentDataService    = contentDocumentDataService;
     _settingsDataService           = settingsDataService;
     _newCategoryContentDataService = newCategoryContentDataService;
 }
        public PosDbSyncProvider(int companyId, string storeId, ISyncDataService syncContext)
        {
            ReadRedisLog = false;
            CompanyId    = companyId;
            StoreId      = storeId;
            _syncContext = syncContext;
            // _store = store;
            var syncTempDirectory = "SyncTemp";
            var syncDirectory     = string.Format(@"{0}{1}\Company{2}strore{3}", AppDomain.CurrentDomain.BaseDirectory, syncTempDirectory, companyId, storeId);

            if (!Directory.Exists(syncDirectory))
            {
                Directory.CreateDirectory(syncDirectory);
            }
            _replicaMetadataFile = string.Format(@"{0}\{1}.Metadata", syncDirectory, syncContext.Name);
            _replicaIdFile       = string.Format(@"{0}\{1}.Replicaid", syncDirectory, syncContext.Name);
            DestinationCallbacks.ProgressChanged += DestinationCallbacks_ProgressChanged;
            _idFormats = new SyncIdFormatGroup();
            _idFormats.ItemIdFormat.IsVariableLength    = false;
            _idFormats.ItemIdFormat.Length              = 16;
            _idFormats.ReplicaIdFormat.IsVariableLength = false;
            _idFormats.ReplicaIdFormat.Length           = 16;
        }
示例#8
0
        private void DoSynchronize(string key, ISyncDataService syncDataService)
        {
            lock (lockobjforadd)
            {
                if (!lockObjects.ContainsKey(key))
                {
                    lockObjects = lockObjects.ToList().Concat(new List <KeyValuePair <string, object> >()
                    {
                        new KeyValuePair <string, object>(key, new object())
                    }).ToDictionary(o => o.Key, o => o.Value);
                }
            }
            try
            {
                var    dict    = lockObjects;//防止并发
                var    lockkv  = dict.First(o => o.Key == key);
                object lockobj = new object();
                if (!lockkv.Equals(default(KeyValuePair <string, object>)) && lockkv.Value != null)
                {
                    lockobj = lockkv.Value;
                }
                lock (lockobj)
                {
                    SyncOrchestrator SyncOrchestrator = new Microsoft.Synchronization.SyncOrchestrator();
                    var temp          = new KeyValuePair <string, ISyncDataService>(key, syncDataService);
                    var localProvider = new PosDbSyncProvider(companyToken, storeId, temp.Value);
                    localProvider.DestinationCallbacks.ProgressChanged += DestinationCallbacks_ProgressChanged;
                    localProvider.ReadRedisLog = true;
                    if (temp.Value.SyncDirectionOrder == SyncDirectionOrder.Download)
                    {
                        localProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.SourceWins;
                    }
                    else
                    {
                        localProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.ApplicationDefined;
                        localProvider.DestinationCallbacks.ItemConflicting  += LocalItemConflicting;
                    }
                    var remoteProvider = new RemoteProviderProxy(companyToken, storeId, endPointConfigurationName, temp.Key);

                    SyncOrchestrator.LocalProvider  = localProvider;
                    SyncOrchestrator.RemoteProvider = remoteProvider;
                    SyncOrchestrator.Direction      = temp.Value.SyncDirectionOrder;
                    try
                    {
                        SyncOperationStatisticsShow(SyncOrchestrator.Synchronize(), temp.Value.SyncDirectionOrder, temp.Key);
                    }
                    catch (Exception ex)
                    {
                        ILog logger = LogManager.GetLogger(Assembly.GetExecutingAssembly().GetName().Name);
                        logger.Error(ex.Message, ex);
                        Console.WriteLine(ex.Message);
                        localProvider.WriteLog(ex.Message + "   正在准备重试,请稍后!");
                        //DO log
                    }
                }
            }
            catch (Exception ex)
            {
                ILog logger = LogManager.GetLogger(Assembly.GetExecutingAssembly().GetName().Name);
                logger.Error(ex.Message, ex);
                Console.WriteLine(ex.Message);
                //DO log
            }
        }
示例#9
0
 public SyncViewModel(ISyncDataService syncService)
 {
     this.syncService = syncService;
 }
示例#10
0
 public BaseViewModel()
 {
     syncService = TinyIOC.Container.Resolve <ISyncDataService>();
 }
示例#11
0
 private void Register(Type syncDataObjectType, ISyncDataService dataService)
 {
     dataServiceDict.Add(syncDataObjectType.ToString(), dataService);
 }
示例#12
0
 private void Register(string syncDataObjectType, ISyncDataService dataService)
 {
     dataServiceDict.Add(syncDataObjectType, dataService);
 }
示例#13
0
 public GoogleTaskSyncService(ISyncDataService <TaskSyncData, GoogleTaskSyncData> localDataService, IGoogleTaskSyncDataService syncDataService)
     : base(localDataService, syncDataService)
 {
     AllowAutoCreateSyncInfo    = true;
     _googleTaskSyncDataService = syncDataService;
 }
示例#14
0
 private SyncHelper()
 {
     syncService = TinyIoC.TinyIoCContainer.Current.Resolve <ISyncDataService>();
 }
 public GoogleCalendarEventSyncService(ISyncDataService <TaskSyncData, GoogleCalendarEventSyncData> localDataService, IGoogleCalendarEventSyncDataService syncDataService)
     : base(localDataService, syncDataService)
 {
     _googleCalendarEventSyncDataService = syncDataService;
 }