示例#1
0
 private bool ContainsNotSyncedData()
 {
     using (var cached = _cachedProfiles.ProfileData())
     {
         return(cached.Sync.Any());
     }
 }
示例#2
0
        public Profile WithUniqueName(Profile profile)
        {
            if (profile == null)
            {
                return(null);
            }

            using (var cached = _cachedProfiles.ProfileData())
            {
                var local = cached.Local.Where(x => x.Status != ProfileStatus.Deleted).ToList();
                var sync  = cached.Local.Where(x => x.Status != ProfileStatus.Deleted).ToList();
                var p     = profile.WithUniqueNameCandidate(_appConfig.MaxProfileNameLength);
                while (ContainsOtherWithSameName(local, p) ||
                       ContainsOtherWithSameName(sync, p) ||
                       ContainsOtherWithSameName(cached.External, p))
                {
                    p = p.WithNextUniqueNameCandidate(_appConfig.MaxProfileNameLength);
                }

                return(p);
            }
        }
示例#3
0
        public Task <IReadOnlyList <Profile> > GetAll()
        {
            var predefinedProfiles = _predefinedProfiles.GetAll();

            using (var cached = _cachedProfiles.ProfileData())
            {
                var cachedProfiles = cached.Local
                                     .Union(cached.Sync, ProfileIdEqualityComparer)
                                     .Union(cached.External, ProfileIdEqualityComparer)
                                     .Where(p => p.Status != ProfileStatus.Deleted);

                IReadOnlyList <Profile> profiles = predefinedProfiles
                                                   .Concat(cachedProfiles)
                                                   .ToList();

                return(Task.FromResult(profiles));
            }
        }