コード例 #1
0
        public void UpdateOptions(Options options, bool checkIfOnline)
        {
            _pendingOutlookItems.Clear();
            _fullSyncPending = false;

            _profileName   = options.Name;
            _profileId     = options.Id;
            _proxyOptions  = options.ProxyOptions;
            _synchronizer  = options.Inactive ? NullOutlookSynchronizer.Instance : _synchronizerFactory.CreateSynchronizer(options);
            _interval      = TimeSpan.FromMinutes(options.SynchronizationIntervalInMinutes);
            _inactive      = options.Inactive;
            _checkIfOnline = checkIfOnline;

            if (_folderChangeWatcher != null)
            {
                _folderChangeWatcher.ItemSavedOrDeleted -= FolderChangeWatcher_ItemSavedOrDeleted;
                _folderChangeWatcher.Dispose();
                _folderChangeWatcher = null;
            }

            if (!_inactive && options.EnableChangeTriggeredSynchronization)
            {
                _folderChangeWatcher =
                    _folderChangeWatcherFactory.Create(options.OutlookFolderEntryId, options.OutlookFolderStoreId);
                _folderChangeWatcher.ItemSavedOrDeleted += FolderChangeWatcher_ItemSavedOrDeleted;
            }
        }
コード例 #2
0
    public void UpdateOptions (Options options)
    {
      _pendingOutlookItems.Clear();
      _fullSyncPending = false;

      _profileName = options.Name;
      _synchronizer = _synchronizerFactory.CreateSynchronizer (options);
      _interval = TimeSpan.FromMinutes (options.SynchronizationIntervalInMinutes);
      _inactive = options.Inactive;
      _changeTriggeredSynchronizationEnabled = options.EnableChangeTriggeredSynchronization;
    }
        async Task SetupSynchronizerFactory(IOutlookSynchronizer synchronizer)
        {
            var options = new Options {
                SynchronizationIntervalInMinutes = 1, Name = "TestProfile"
            };
            var generalOptions = new GeneralOptions {
                MaxSucessiveWarnings = MaxSucessiveWarnings
            };

            _synchronizerFactory.Expect(f => f.CreateSynchronizer(options, generalOptions)).Return(Task.FromResult <IOutlookSynchronizer>(synchronizer));
            await _synchronizationProfileRunner.UpdateOptions(options, generalOptions);
        }
        public void UpdateOptions(Options options, bool checkIfOnline)
        {
            _pendingOutlookItems.Clear();
            _fullSyncPending = false;

            _profileName  = options.Name;
            _profileId    = options.Id;
            _synchronizer = _synchronizerFactory.CreateSynchronizer(options);
            _interval     = TimeSpan.FromMinutes(options.SynchronizationIntervalInMinutes);
            _inactive     = options.Inactive;
            _changeTriggeredSynchronizationEnabled = options.EnableChangeTriggeredSynchronization;
            _checkIfOnline = checkIfOnline;
        }
コード例 #5
0
            public ProfileData(bool inactive, string profileName, bool checkIfOnline, TimeSpan interval, ProxyOptions proxyOptionsOrNull, IOutlookSynchronizer synchronizer, IItemCollectionChangeWatcher folderChangeWatcher)
            {
                if (profileName == null)
                {
                    throw new ArgumentNullException(nameof(profileName));
                }
                if (synchronizer == null)
                {
                    throw new ArgumentNullException(nameof(synchronizer));
                }
                if (folderChangeWatcher == null)
                {
                    throw new ArgumentNullException(nameof(folderChangeWatcher));
                }

                Inactive            = inactive;
                ProfileName         = profileName;
                CheckIfOnline       = checkIfOnline;
                Interval            = interval;
                ProxyOptionsOrNull  = proxyOptionsOrNull;
                Synchronizer        = synchronizer;
                FolderChangeWatcher = folderChangeWatcher;
            }
        public async Task UpdateOptions(Options options, GeneralOptions generalOptions)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }

            _pendingOutlookItems.Clear();
            _fullSyncPending = false;

            _profileName  = options.Name;
            _profileId    = options.Id;
            _proxyOptions = options.ProxyOptions;
            _synchronizer = options.Inactive ? NullOutlookSynchronizer.Instance : await _synchronizerFactory.CreateSynchronizer(options, generalOptions);

            _interval      = TimeSpan.FromMinutes(options.SynchronizationIntervalInMinutes);
            _inactive      = options.Inactive;
            _checkIfOnline = generalOptions.CheckIfOnline;

            if (_folderChangeWatcher != null)
            {
                _folderChangeWatcher.ItemSavedOrDeleted -= FolderChangeWatcher_ItemSavedOrDeleted;
                _folderChangeWatcher.Dispose();
                _folderChangeWatcher = null;
            }

            if (!_inactive && options.EnableChangeTriggeredSynchronization)
            {
                _folderChangeWatcher =
                    _folderChangeWatcherFactory.Create(options.OutlookFolderEntryId, options.OutlookFolderStoreId);
                _folderChangeWatcher.ItemSavedOrDeleted += FolderChangeWatcher_ItemSavedOrDeleted;
            }
        }
コード例 #7
0
 public async Task Initialize()
 {
     Synchronizer = await InitializeOverride();
 }
    public async Task UpdateOptions (Options options, GeneralOptions generalOptions)
    {
      if (options == null)
        throw new ArgumentNullException (nameof (options));
      if (generalOptions == null)
        throw new ArgumentNullException (nameof (generalOptions));

      _pendingOutlookItems.Clear();
      _fullSyncPending = false;

      _profileName = options.Name;
      _profileId = options.Id;
      _proxyOptions = options.ProxyOptions;
      _synchronizer = options.Inactive ? NullOutlookSynchronizer.Instance : await _synchronizerFactory.CreateSynchronizer (options, generalOptions);
      _interval = TimeSpan.FromMinutes (options.SynchronizationIntervalInMinutes);
      _inactive = options.Inactive;
      _checkIfOnline = generalOptions.CheckIfOnline;

      if (_folderChangeWatcher != null)
      {
        _folderChangeWatcher.ItemSavedOrDeleted -= FolderChangeWatcher_ItemSavedOrDeleted;
        _folderChangeWatcher.Dispose();
        _folderChangeWatcher = null;
      }

      if (!_inactive && options.EnableChangeTriggeredSynchronization)
      {
        _folderChangeWatcher =
            _folderChangeWatcherFactory.Create (options.OutlookFolderEntryId, options.OutlookFolderStoreId);
        _folderChangeWatcher.ItemSavedOrDeleted += FolderChangeWatcher_ItemSavedOrDeleted;
      }
    }