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); }
public void ReloadSnapshot() { if (!string.IsNullOrEmpty(_snapshot)) { ResourceEntities.LoadSnapshot(_snapshot); } }
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); }
public void LoadSnapshot(string value) { ResourceEntities.LoadSnapshot(value); _snapshot = value; }