public MedialibViewModel() { this.FileSearchWorker = new FileSearchWorker("Medialib", MediaFile.GetMediaFileViewModel); playerSettings = TinyIoCContainer.Current.Resolve<PlayerSettings>(); this.CustomWindowPlacementSettings = new CustomWindowPlacementSettings(playerSettings.Medialib); this.MediaFiles = CollectionViewSource.GetDefaultView(new MedialibCollection(null)); // Do a selection/filtering when nothing new has been changed for 400 ms and it isn't // an empty string... and don't filter for the same thing twice. this.ObservableForProperty(x => x.SelectedGenre) .Throttle(TimeSpan.FromMilliseconds(400), RxApp.MainThreadScheduler) .Select(x => x.Value) //.Where(x => !string.IsNullOrWhiteSpace(x)) .DistinctUntilChanged() .Subscribe(x => FilterByGenreSelection(x)); this.ObservableForProperty(x => x.SelectedArtist) .Throttle(TimeSpan.FromMilliseconds(400), RxApp.MainThreadScheduler) .Select(x => x.Value) //.Where(x => !string.IsNullOrWhiteSpace(x)/* && !string.IsNullOrEmpty(this.SelectedGenre)*/) .DistinctUntilChanged() .Subscribe(x => FilterByArtistSelection(this.SelectedGenre, x)); this.ObservableForProperty(x => x.SelectedAlbum) .Throttle(TimeSpan.FromMilliseconds(400), RxApp.MainThreadScheduler) .Select(x => x.Value) //.Where(x => !string.IsNullOrWhiteSpace(x)/* && !string.IsNullOrEmpty(this.SelectedGenre) && !string.IsNullOrEmpty(this.SelectedArtist)*/) .DistinctUntilChanged() .Subscribe(x => FilterByAlbumSelection()); this.AddDirectoryCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.FileSearchWorker.IsWorking, isworking => !isworking.Value), x => AddDirectoryAsync()); }
public PlayListsViewModel() { this.FileSearchWorker = new FileSearchWorker("PlayList", MediaFile.GetMediaFileViewModel); var container = TinyIoCContainer.Current; this.playerEngine = container.Resolve<PlayerEngine>(); this.playerSettings = container.Resolve<PlayerSettings>(); this.SelectedPlayListFiles = new ObservableCollection<IMediaFile>(); this.StartUpCommand = ReactiveCommand.CreateAsyncTask(x => this.StartUpAsync()); // handle command line args from another instance this.WhenAnyValue(x => x.CommandLineArgs) .Where(list => list != null && list.Skip(1).Any()) .Select(list => list.Skip(1).ToList()) .SelectMany(list => this.HandleCommandLineArgsAsync(list).ToObservable()) .Subscribe(); }
private Equalizer(FMOD.System system, PlayerSettings settings) { this.playerSettings = settings; this.Name = "DefaultEqualizer"; this.fmodSystem = system; this.Initializied = false; this.Bands = new ObservableCollection<EqualizerBand>(); this.IsEnabled = settings.PlayerEngine.EqualizerSettings == null || settings.PlayerEngine.EqualizerSettings.IsEnabled; this.WhenAnyValue(x => x.IsEnabled) .Subscribe(enabled => { if (!this.Initializied || enabled) { this.Init(this.fmodSystem); } else if (this.Initializied) { this.SaveEqualizerSettings(); this.DeInit(this.fmodSystem); } }); }
public PlayerEngine(PlayerSettings settings) { this.playerSettings = settings; }
public void CleanUp() { /* Shut down */ this.timer.Stop(); this.CleanUpSound(ref this.sound); this.CleanUpEqualizer(); this.CleanUpSystem(ref this.system); this.playerSettings = null; }
public static Equalizer GetEqualizer(FMOD.System system, PlayerSettings settings) { var eq = new Equalizer(system, settings); eq.Initializied = true; return eq; }
public void CleanUp() { this.DeInit(this.fmodSystem); this.Bands.Clear(); this.fmodSystem = null; this.playerSettings = null; }