public MainWindowViewModel() { _profileManager.ChangedProfilesEvent += UpdateDisplaySettings; _appUpdater.UserRequestsInstallEvent += NumberOfRunningCopies; _settingsViewModel.PropertyChanged += SettingsHaveChanged; _profileManagerViewModel = new ProfileManagerViewModel(_profileManager); foreach (Profile p in _profileManager.Profiles) { FolderManagerViewModel var = new FolderManagerViewModel(p); FolderManagerViewModels.Add(var); CollectionContainer cc = new CollectionContainer(); cc.Collection = var.Assigned; this.Assigned.Add(cc); } }
private void UpdateDisplaySettings() { foreach (FolderManagerViewModel f in FolderManagerViewModels.Reverse()) { if (!_profileManager.Profiles.Any(item => item.Equals(f.Profile))) { FolderManagerViewModels.Remove(f); } } foreach (Profile p in _profileManager.Profiles) { if (!FolderManagerViewModels.Any(item => item.Profile.Equals(p))) { FolderManagerViewModel var = new FolderManagerViewModel(p); var.FolderManager.RefreshFolders(); FolderManagerViewModels.Add(var); CollectionContainer cc = new CollectionContainer(); cc.Collection = var.Assigned; this.Assigned.Add(cc); } } }