//Select a slide to be matched public void SelectSlide(PictureViewModel slide) { slide.PeekAtImage(); if (SelectedSlide1 == null) { SelectedSlide1 = slide; } else if (SelectedSlide2 == null) { SelectedSlide2 = slide; HideUnmatched(); } SoundManager.PlayCardFlip(); OnPropertyChanged("areSlidesActive"); }
//Create slides from images in file directory public void CreateSlides(string imagesPath) { //New list of slides MemorySlides = new ObservableCollection <PictureViewModel>(); var models = GetModelsFrom(@imagesPath); //Create slides with matching pairs from models for (int i = 0; i < 6; i++) { //Create 2 matching slides var newSlide = new PictureViewModel(models[i]); var newSlideMatch = new PictureViewModel(models[i]); //Add new slides to collection MemorySlides.Add(newSlide); MemorySlides.Add(newSlideMatch); //Initially display images for user newSlide.PeekAtImage(); newSlideMatch.PeekAtImage(); } ShuffleSlides(); OnPropertyChanged("MemorySlides"); }