private void OpenSelectPresentationFileDialog() { OpenSelectFileDialog(DemoType.Presentation, "PPT File(*.ppt;*.pptx;*.avi;*.mp4;*.mkv;*.wav;*.flv;*.asf;)|*.ppt;*.pptx;*.avi;*.mp4;*.mkv;*.wav;*.flv;*.asf;", (selectedFileFullName) => { LoadPresentationItem(); SetSelectedPresentationItem(PresentationList, (presentation) => { CurrentSelectedPresentation = presentation; }, (item) => item.Presentation.FileFullPath == selectedFileFullName); }); }
private void SetSelectedPresentationItem(List <PresentationItemViewModel> sourceList, Action <PresentationItemViewModel> callback, Func <PresentationItemViewModel, bool> where = null) { if (sourceList.Any()) { PresentationItemViewModel presentation = sourceList.First(); if (where != null) { presentation = sourceList.First(where); } callback.Invoke(presentation); } }
public PresentationViewModel(PresentationsRepository presentationsRepository, IEventAggregator eventAggregator) { _eventAggregator = eventAggregator; _presentationsRepository = presentationsRepository ?? throw new ArgumentNullException("presentationsRepository"); OpenSelectPresentationFileWindow = new DelegateCommand(OpenSelectPresentationFileDialog); OpenSelectWarmVideoFileWindow = new DelegateCommand(OpenSelectWarmVideoFileDialog); LoadPresentationItem(); LoadWarmVideoItem(); SetSelectedPresentationItem(PresentationList, (presentation) => { CurrentSelectedPresentation = presentation; }); SetSelectedPresentationItem(WarmVideoList, (presentation) => { CurrentSelectedWarmVideo = presentation; }); }