Esempio n. 1
0
        private void RefreshPinnedDocumentMetadataAndAssignPinOrder()
        {
            PinnedDocumentMetadata.Refresh();

            // Assign PinOrder for each DocumentMetadata, based on the order
            // presented in the refreshed view

            var index = 0;

            foreach (var metadata in PinnedDocumentMetadata.Cast <DocumentMetadata>())
            {
                metadata.PinOrder = index * 2;
                index++;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Sets <see cref="DocumentMetadata.IsActive"/> to true and
        /// <see cref="DocumentMetadata.ActivatedAt"/> to the current time in UTC
        /// for the specified file. Sets <see cref="DocumentMetadata.IsActive"/>
        /// to false for all other files
        /// </summary>
        /// <param name="fullName">Full path and name of document file</param>
        public void Activate(string fullName)
        {
            var activatedDocument = _activeDocumentMetadata.FirstOrDefault(m =>
                                                                           m.IsActive)?.FullName;

            if (fullName == activatedDocument)
            {
                return;
            }

            var activated = false;

            foreach (var metadata in _activeDocumentMetadata)
            {
                metadata.IsActive = _metadataEqualityService.Compare(
                    metadata.FullName,
                    fullName);

                if (metadata.IsActive)
                {
                    var utcNow = _timeProvider.UtcNow;
                    metadata.ActivatedAt = utcNow;
                    activated            = true;
                }
            }

            if (activated)
            {
                _normalizedUsageOrderService.SetUsageOrder(
                    _activeDocumentMetadata,
                    _userPreferences);

                ActiveDocumentMetadata.Refresh();
                PinnedDocumentMetadata.Refresh();
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Updates the DocumentMetadata filter match information.
 /// </summary>
 private void UpdateFilter()
 {
     PinnedDocumentMetadata.Refresh();
     ActiveDocumentMetadata.Refresh();
 }