public void InitializeFolderSystemOnce()
        {
            if (_initialized)
            {
                return;
            }

            _folderSystem.Initialize();
            _initialized = true;
        }
Пример #2
0
        private void Initialize()
        {
            // check already initialized, or initialization in progress
            if (_initializationState != InitializationState.NotInitialized)
            {
                return;
            }

            _initializationState = InitializationState.Initializing;

            Async.Invoke(this,
                         () => _folderSystem.Initialize(),
                         delegate
            {
                // subscribe to events
                _folderSystem.Folders.ItemAdded       += FolderAddedEventHandler;
                _folderSystem.Folders.ItemRemoved     += FolderRemovedEventHandler;
                _folderSystem.FoldersChanged          += FoldersChangedEventHandler;
                _folderSystem.FoldersInvalidated      += FoldersInvalidatedEventHandler;
                _folderSystem.FolderPropertiesChanged += FolderPropertiesChangedEventHandler;

                // build the initial folder tree, but do not udpate it, as this will be done on demand
                // when this folder system is selected
                BuildFolderTree();

                // this timer is responsible for monitoring the auto-invalidation of all folders
                // in the folder system, and performing the appropriate invalidations
                // bug #6909: increase timer interval from 1 sec to 10 seconds, to reduce lockup issues when time provider can't access network
                _folderInvalidateTimer = new Timer(delegate { AutoInvalidateFolders(); })
                {
                    IntervalMilliseconds = 10000
                };
                _folderInvalidateTimer.Start();

                // notify that this folder system is now initialized
                _initializationState = InitializationState.Initialized;
                EventsHelper.Fire(_intialized, this, EventArgs.Empty);
            });
        }