public static void Dispose() { if (_database != null) { _database.Dispose(); } _database = null; }
public static void Dispose() { if (_database != null) { _database.Dispose(); } _database = null; }
public static List<BindableBase> GetPageViewModels(IVideoDatabase videoDatabase) { return new List<BindableBase> { new HomeViewModel(), new MoviesViewModel(), new TvShowsViewModel(), new SettingsViewModel(videoDatabase) }; }
public ShellViewModel(IVideoDatabase videoDatabase) { pageViewModels = ViewModelFactory.GetPageViewModels(videoDatabase); MessageService.NewMessage += OnNewMessage; messageTimer.Tick += (sender, args) => { messageTimer.Stop(); IsMessageVisible = false; }; SelectedPageIndex = 0; }
public SettingsViewModel(IVideoDatabase videoDatabase) { this.videoDatabase = videoDatabase; EditSourceViewModel = new EditSourceViewModel(videoDatabase); EditSourceViewModel.SourceChanged += async () => { await RefreshVideoSourcesAsync(); }; ClearDatabaseCommand = new DelegateCommand(async () => { await ClearDataBaseAsync(); }, () => !IsUpdatingLibrary); UpdateLibraryCommand = new DelegateCommand(async () => { await UpdateLibraryAsync(); }, () => !IsUpdatingLibrary); EditSourceCommand = new DelegateCommand<IVideoSource>(EditSource, () => !IsUpdatingLibrary); EditNewSourceCommand = new DelegateCommand(EditNewSource, () => !IsUpdatingLibrary); DeleteSourceCommand = new DelegateCommand<IVideoSource>(async source => { await DeleteSource(source); }, () => !IsUpdatingLibrary); }
/// <summary> /// Initializes a new instance of the <see cref="MediaLibrary"/> class. /// </summary> /// <param name="libVLC">LibVLC Instance.</param> /// <param name="musicDatabase">Music Database.</param> /// <param name="videoDatabase">Video Database.</param> /// <param name="platform">Storage File APIs.</param> /// <param name="logHelper">Log Helper.</param> public MediaLibrary(LibVLC libVLC, IMusicDatabase musicDatabase, IVideoDatabase videoDatabase, IPlatformSettings platform, ILogHelper logHelper) { this.platform = platform; this.logHelper = logHelper; this.libVLC = libVLC; this.musicDatabase = musicDatabase; this.videoDatabase = videoDatabase; if (!this.musicDatabase.IsInitialized || !this.videoDatabase.IsInitialized) { throw new ArgumentException($"Databases must be initialized before using them in the media library."); } }
public EditSourceViewModel(IVideoDatabase videoDatabase) { this.videoDatabase = videoDatabase; BrowseForFolderCommand = new DelegateCommand(BrowseForFolder); SaveCommand = new DelegateCommand(async () => { await SaveSource(); }, CanSave); CancelCommand = new DelegateCommand(() => EditSourceMode = false); openFolderDialog = new CommonOpenFileDialog("Browse For Folder") { IsFolderPicker = true, InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), AddToMostRecentlyUsedList = true, AllowNonFileSystemItems = false, EnsureFileExists = true, EnsurePathExists = true, EnsureReadOnly = false, EnsureValidNames = true, Multiselect = false, ShowPlacesList = true }; SetNewSource(); }
public static void ReOpen() { Dispose(); _database = DatabaseFactory.GetVideoDatabase(); }
public static void ReOpen() { Dispose(); _database = DatabaseFactory.GetVideoDatabase(); }