Пример #1
0
 public static void Dispose()
 {
     if (_database != null)
     {
         _database.Dispose();
     }
     _database = null;
 }
Пример #2
0
 public static void Dispose()
 {
   if (_database != null)
   {
     _database.Dispose();
   }
   _database = null;
 }
Пример #3
0
 public static List<BindableBase> GetPageViewModels(IVideoDatabase videoDatabase)
 {
     return new List<BindableBase>
     {
         new HomeViewModel(),
         new MoviesViewModel(),
         new TvShowsViewModel(),
         new SettingsViewModel(videoDatabase)
     };
 }
Пример #4
0
 public ShellViewModel(IVideoDatabase videoDatabase)
 {
     pageViewModels = ViewModelFactory.GetPageViewModels(videoDatabase);
     MessageService.NewMessage += OnNewMessage;
     messageTimer.Tick += (sender, args) =>
     {
         messageTimer.Stop();
         IsMessageVisible = false;
     };
     SelectedPageIndex = 0;
 }
Пример #5
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);
 }
Пример #6
0
 /// <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.");
     }
 }
Пример #7
0
 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();
 }
Пример #8
0
 public static void ReOpen()
 {
   Dispose();
   _database = DatabaseFactory.GetVideoDatabase();
 }
Пример #9
0
 public static void ReOpen()
 {
     Dispose();
     _database = DatabaseFactory.GetVideoDatabase();
 }