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;
            }
        }
Ejemplo n.º 2
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;
            }
        }
    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;
      }
    }