Exemple #1
0
        public async Task InitializeAsync()
        {
            if (_isInitialized)
            {
                return;
            }

            _profiles.AddRange(await GetProfilesAsync());

            var activeProfileId = await GetActiveProfileIdAsync();

            _activeProfile.OnNext(_profiles.FirstOrDefault(x => x.Id == activeProfileId) ?? _profiles.First());
            _activeProfile.SubscribeAsync(p => SetActiveProfileIdAsync(p.Id));

            _isInitialized = true;
        }