private void OnProfileChanged(object sender, BaseEventArgs e) { GameModel model = ProfileManager.CurrentProfile.GameModel; bool gameAvailable = ConfigurationManager.CheckGame(model); if (Community != null) { Community.IsEnabled = ConfigurationManager.GetConfiguration(model).IsWebAvailable; } if (Gallery != null) { Gallery.IsEnabled = gameAvailable; } if (Personalization != null) { Personalization.IsEnabled = gameAvailable; } }
private void ApplyChanges(ICollection <Profile> profiles, int defaultProfileId) { if (profiles == null) { throw new ArgumentException("profiles argument cannot be null"); } this.Profiles.Clear(); //Add clones of instances foreach (Profile p in profiles) { Profile newProfile = new Profile(p); IConfiguration config = ConfigurationManager.GetConfiguration(p.GameModel); if (config == null) { newProfile.GameModel.Type = ConfigurationManager.First().GameType; } Profiles.Add(newProfile); } DefaultProfile = Profiles.FirstOrDefault(i => i.Id == defaultProfileId); if (DefaultProfile == null) { DefaultProfile = Profiles.First(); } if (_CurrentProfile != null) { _CurrentProfile = Profiles.FirstOrDefault(i => i.Id == _CurrentProfile.Id); } if (_CurrentProfile == null) { _CurrentProfile = DefaultProfile; } if (_CurrentProfile == null) { _CurrentProfile = Profiles.First(); } OnCollectionChanged(); OnCurrentChanged(); }