Esempio n. 1
0
        private bool InternalLoad([NotNull][ItemNotNull] IEnumerable <IGrouping <string, ProjectFile> > resourceFilesByDirectory)
        {
            Contract.Requires(resourceFilesByDirectory != null);

            if (!LoadEntities(resourceFilesByDirectory))
            {
                return(false); // nothing has changed, no need to continue
            }
            if (!string.IsNullOrEmpty(_snapshot))
            {
                ResourceEntities.LoadSnapshot(_snapshot);
            }

            var cultureKeys = ResourceEntities
                              .SelectMany(entity => entity.Languages)
                              .Select(lang => lang.CultureKey)
                              .Distinct()
                              .OrderBy(item => item.Culture?.DisplayName)
                              .ToArray();

            Cultures.SynchronizeWith(cultureKeys);

            OnLoaded();

            return(true);
        }
Esempio n. 2
0
 public void ReloadSnapshot()
 {
     if (!string.IsNullOrEmpty(_snapshot))
     {
         ResourceEntities.LoadSnapshot(_snapshot);
     }
 }
Esempio n. 3
0
        private async Task <bool> InternalLoadAsync(ICollection <IGrouping <string, ProjectFile> > resourceFilesByDirectory, CancellationToken?cancellationToken)
        {
            if (!await LoadEntitiesAsync(resourceFilesByDirectory, cancellationToken).ConfigureAwait(true))
            {
                return(false); // nothing has changed, no need to continue
            }
            if (!_snapshot.IsNullOrEmpty())
            {
                ResourceEntities.LoadSnapshot(_snapshot);
            }

            var cultureKeys = ResourceEntities
                              .SelectMany(entity => entity.Languages)
                              .Select(lang => lang.CultureKey)
                              .Distinct()
                              .OrderBy(item => item.Culture?.DisplayName)
                              .ToArray();

            Cultures.SynchronizeWith(cultureKeys);

            OnLoaded();

            return(true);
        }
Esempio n. 4
0
        public void LoadSnapshot(string value)
        {
            ResourceEntities.LoadSnapshot(value);

            _snapshot = value;
        }