/// <summary> /// Initializes a new instance of the ReeducationKidWizardSelectExViewModel class. /// </summary> public ExercicesReeducationMouvement(ObservableCollection <ExerciceReeducation> Exercices) // TODO : chargement des themes en async ! { try { this._ItemCount = 0; //this.db = new ThemesModel(); this.Exercices = Exercices; this.themes = new ObservableCollection <ThemeModel>(); //Parallel.ForEach(this.db.Themes, theme => // Bibliothèque parallèle de tâches, ForEach définit une boucle dans laquelle les itérations peuvent s’exécuter en parallèle //{ // this.themes.Add(new ThemeViewModel(theme)); //}); foreach (ThemeModel theme in GestionThemes.LoadAllReeducationTheme()) { this.themes.Add(theme); } this.collectionView = CollectionViewSource.GetDefaultView(this.themes); if (this.collectionView == null) { throw new NullReferenceException("collectionView"); } this.collectionView.CurrentChanged += new EventHandler(this.OnCollectionViewCurrentChanged); // création de l'évenement de changement de thème selectionné SelectedTheme = themes[0]; if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { // Code runs "for real": Connect to service, etc... } // Subscribe to CollectionChanged event Exercices.CollectionChanged += OnExercicesListChanged; CreateCommands(); GetNomExercice("Discret statique"); Messenger.Default.Register <List <string> >(this, "DifficulteMessage", GetDifficulte); } catch (Exception ex) { GestionErreur.GerrerErreur(ex); } }
public ThemesExercicesEvaluationCinematiqueViewModel() { _listeThemes = new ObservableCollection <string>(); _listeThemes = GestionThemes.LoadAllFondEvalTheme(); }