public MediaFileGridViewModel(MediaFileState mediaState, IEventAggregator eventAggregator) { EventAggregator = eventAggregator; NrColumns = 4; MediaStateCollectionView = new MediaFileStateCollectionView(mediaState); ViewCommand = new Command<SelectableMediaItem>((selectableItem) => { MediaItem item = selectableItem.Item; if (item.Metadata is ImageMetadata) { Shell.ShellViewModel.navigateToImageView(item); } else if (item.Metadata is VideoMetadata || item.Metadata is AudioMetadata) { Shell.ShellViewModel.navigateToVideoView(item); } }); SelectAllCommand = new Command(() => { MediaStateCollectionView.selectAll(); }, false); DeselectAllCommand = new Command(() => { MediaStateCollectionView.deselectAll(); }); BrowseLocationCommand = new Command<SelectableMediaItem>((selectableItem) => { MediaItem item = selectableItem.Item; String location = FileUtils.getPathWithoutFileName(item.Location); EventAggregator.GetEvent<MediaBrowserPathChangedEvent>().Publish(location); }); OpenLocationCommand = new Command<SelectableMediaItem>((selectableItem) => { MediaItem item = selectableItem.Item; String location = FileUtils.getPathWithoutFileName(item.Location); Process.Start(location); }); WeakEventManager<MediaLockedCollection, EventArgs>.AddHandler(MediaStateCollectionView.MediaState.UIMediaCollection, "IsLoadingChanged", mediaCollection_IsLoadingChanged); PrevFilterMode = MediaFilterMode.None; }
/// <summary> /// Use a existing mediaFileStateCollectionView /// </summary> /// <param name="mediaFileStateCollectionView"></param> /// <param name="eventAggregator"></param> public MediaFileStackPanelViewModel(MediaFileStateCollectionView mediaFileStateCollectionView, IEventAggregator eventAggregator) { MediaStateCollectionView = mediaFileStateCollectionView; initialize(eventAggregator); }