public static Library CreateLibrary(CoreSettings settings = null, ILibraryReader reader = null, ILibraryWriter writer = null, IFileSystem fileSystem = null, ILocalSongFinder localSongFinder = null) { return(new LibraryBuilder().WithReader(reader) .WithWriter(writer) .WithSettings(settings) .WithFileSystem(fileSystem) .WithSongFinder(localSongFinder) .Build()); }
public Library(IRemovableDriveWatcher driveWatcher, ILibraryReader libraryReader, ILibraryWriter libraryWriter) { this.songLock = new object(); this.songs = new HashSet<Song>(); this.playlists = new List<Playlist>(); this.AccessMode = AccessMode.Administrator; // We want implicit to be the administrator, till we change to user mode manually this.cacheResetHandle = new AutoResetEvent(false); this.driveWatcher = driveWatcher; this.libraryReader = libraryReader; this.libraryWriter = libraryWriter; this.disposeLock = new object(); }
public Library(ILibraryReader libraryReader, ILibraryWriter libraryWriter, CoreSettings settings, IFileSystem fileSystem, Func <string, ILocalSongFinder> localSongFinderFunc = null) { if (libraryReader == null) { throw new ArgumentNullException(nameof(libraryReader)); } if (libraryWriter == null) { throw new ArgumentNullException(nameof(libraryWriter)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (fileSystem == null) { throw new ArgumentNullException(nameof(fileSystem)); } this.libraryReader = libraryReader; this.libraryWriter = libraryWriter; this.settings = settings; this.fileSystem = fileSystem; this.localSongFinderFunc = localSongFinderFunc ?? (x => new LocalSongFinder(x)); this.globalSubscriptions = new CompositeDisposable(); this.accessControl = new AccessControl(settings); this.songLock = new ReaderWriterLockSlim(); this.songs = new HashSet <LocalSong>(); this.playlists = new ReactiveList <Playlist>(); this.songsUpdated = new Subject <Unit>(); this.audioPlayer = new AudioPlayer(); this.manualUpdateTrigger = new Subject <Unit>(); this.LoadedSong = this.audioPlayer.LoadedSong; this.TotalTime = this.audioPlayer.TotalTime; this.PlaybackState = this.audioPlayer.PlaybackState; this.WhenAnyValue(x => x.CurrentPlaylist.CanPlayNextSong).SampleAndCombineLatest(this.audioPlayer.PlaybackState .Where(p => p == AudioPlayerState.Finished), (canPlayNextSong, _) => canPlayNextSong) .SelectMany(x => this.HandleSongFinishAsync(x).ToObservable()) .Subscribe(); this.CurrentPlaybackTime = this.audioPlayer.CurrentTimeChanged; this.volume = this.settings.WhenAnyValue(x => x.Volume) .ToProperty(this, x => x.Volume); }
public Library(IRemovableDriveWatcher driveWatcher, ILibraryReader libraryReader, ILibraryWriter libraryWriter, ILibrarySettings settings) { this.songLock = new object(); this.songs = new HashSet <Song>(); this.playlists = new List <Playlist>(); this.AccessMode = AccessMode.Administrator; // We want implicit to be the administrator, till we change to user mode manually this.cacheResetHandle = new AutoResetEvent(false); this.driveWatcher = driveWatcher; this.libraryReader = libraryReader; this.libraryWriter = libraryWriter; this.disposeLock = new object(); this.settings = settings; }
/// <summary> /// Sets the active reader for the viewer /// </summary> /// <param name="lib"> /// A <see cref="ILibraryReader"/> /// </param> public void SetReader(ILibraryReader lib) { store.Clear(); foreach(MediaItem item in lib) { List<object> values = new List<object>(); for (int i = 0; i < _category.Fields.Length; i++) { values.Add(item[_category.Fields[i]]); } store.AppendValues(values.ToArray()); } }
public Library(ILibraryReader libraryReader, ILibraryWriter libraryWriter, CoreSettings settings, IFileSystem fileSystem, Func<string, ILocalSongFinder> localSongFinderFunc = null) { if (libraryReader == null) throw new ArgumentNullException("libraryReader"); if (libraryWriter == null) throw new ArgumentNullException("libraryWriter"); if (settings == null) throw new ArgumentNullException("settings"); if (fileSystem == null) throw new ArgumentNullException("fileSystem"); this.libraryReader = libraryReader; this.libraryWriter = libraryWriter; this.settings = settings; this.fileSystem = fileSystem; this.localSongFinderFunc = localSongFinderFunc ?? (x => new LocalSongFinder(x)); this.globalSubscriptions = new CompositeDisposable(); this.accessControl = new AccessControl(settings); this.songLock = new ReaderWriterLockSlim(); this.songs = new HashSet<LocalSong>(); this.playlists = new ReactiveList<Playlist>(); this.songsUpdated = new Subject<Unit>(); this.audioPlayer = new AudioPlayer(); this.manualUpdateTrigger = new Subject<Unit>(); this.LoadedSong = this.audioPlayer.LoadedSong; this.TotalTime = this.audioPlayer.TotalTime; this.PlaybackState = this.audioPlayer.PlaybackState; this.WhenAnyValue(x => x.CurrentPlaylist.CanPlayNextSong).SampleAndCombineLatest(this.audioPlayer.PlaybackState .Where(p => p == AudioPlayerState.Finished), (canPlayNextSong, _) => canPlayNextSong) .SelectMany(x => this.HandleSongFinishAsync(x).ToObservable()) .Subscribe(); this.CurrentPlaybackTime = this.audioPlayer.CurrentTimeChanged; this.volume = this.settings.WhenAnyValue(x => x.Volume) .ToProperty(this, x => x.Volume); }
public PartViewModel( IScreen hostScreen, Part part) : base(hostScreen) { _part = part ?? new Part(); Id = _part.Id; _libaryBuilder = Locator.Current.GetRequiredService <ILibraryBuilder>(); _libaryReader = Locator.Current.GetRequiredService <ILibraryReader>(); _partRepository = Locator.Current.GetRequiredService <IPartRepository>(); _settingsService = Locator.Current.GetRequiredService <ISettingsProvider>(); GoBack = ReactiveCommand.CreateFromTask(ExecuteGoBackAsync); var canCloneOrDelete = this.WhenAnyValue(vm => vm.Id) .Select(id => !string.IsNullOrEmpty(id)); Clone = ReactiveCommand.Create(ExecuteClone, canCloneOrDelete); Delete = ReactiveCommand.CreateFromTask(ExecuteDeleteAsync, canCloneOrDelete); Save = ReactiveCommand.CreateFromTask(ExecuteSaveAsync); DiscardChangesConfirmation = new Interaction <Unit, bool>(); DeletePartConfirmation = new Interaction <Unit, bool>(); }
public KiCadLibraryReaderCache(ILibraryReader libraryReader, ISettingsProvider settingsProvider) { _libraryReader = libraryReader; _settingsProvider = settingsProvider; }
public LibraryBuilder WithReader(ILibraryReader reader) { this.reader = reader; return this; }
public LibraryBuilder WithReader(ILibraryReader reader) { this.reader = reader; return(this); }