private void ReloadData()
        {
            libraryCreators.Clear();
            folderImagesForChildren.Clear();

            /*
             * if (includeQueueLibraryProvider)
             * {
             *      // put in the queue provider
             *      libraryCreators.Add(new LibraryProviderQueueCreator());
             *      AddFolderImage("queue_folder.png");
             * }
             *
             * if (false)
             * {
             *      // put in the history provider
             *      libraryCreators.Add(new LibraryProviderHistoryCreator());
             *      AddFolderImage("queue_folder.png");
             * } */

            // put in the sqlite provider
            libraryCreators.Add(new LibraryProviderSQLiteCreator());
            AddFolderImage("library_folder.png");

            // Check for LibraryProvider factories and put them in the list too.
            foreach (LibraryProviderPlugin libraryProviderPlugin in libraryProviderPlugins.Plugins)
            {
                if (libraryProviderPlugin.ProviderKey == "LibraryProviderPurchasedKey")
                {
                    this.PurchasedLibraryCreator = libraryProviderPlugin;
                }

                if (libraryProviderPlugin.ProviderKey == "LibraryProviderSharedKey")
                {
                    this.SharedLibraryCreator = libraryProviderPlugin;
                }

                if (libraryProviderPlugin.ShouldBeShown(ReloadData))
                {
                    // This coupling is required to navigate to the Purchased folder after redemption or purchase updates
                    libraryCreators.Add(libraryProviderPlugin);
                    folderImagesForChildren.Add(libraryProviderPlugin.GetFolderImage());
                }
            }

            // and any directory providers (sd card provider, etc...)
            // Add "Downloads" file system example
            string downloadsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");

            if (Directory.Exists(downloadsDirectory))
            {
                libraryCreators.Add(new LibraryProviderFileSystemCreator(downloadsDirectory, "Downloads"));
                AddFolderImage("download_folder.png");
            }

            firstAddedDirectoryIndex = libraryCreators.Count;
            OnDataReloaded(null);
        }
		private void ReloadData()
		{
			libraryCreators.Clear();
			folderImagesForChildren.Clear();

			if (includeQueueLibraryProvider)
			{
				// put in the queue provider
				libraryCreators.Add(new LibraryProviderQueueCreator());
				AddFolderImage("queue_folder.png");
			}

			/*
			if (false)
			{
				// put in the history provider
				libraryCreators.Add(new LibraryProviderHistoryCreator());
				AddFolderImage("queue_folder.png");
			} */

			// put in the sqlite provider
			libraryCreators.Add(new LibraryProviderSQLiteCreator());
			AddFolderImage("library_folder.png");

			// Check for LibraryProvider factories and put them in the list too.
			foreach (LibraryProviderPlugin libraryProviderPlugin in libraryProviderPlugins.Plugins)
			{
				if (libraryProviderPlugin.ProviderKey == "LibraryProviderPurchasedKey")
				{
					this.PurchasedLibraryCreator = libraryProviderPlugin;
				}

				if (libraryProviderPlugin.ProviderKey == "LibraryProviderSharedKey")
				{
					this.SharedLibraryCreator = libraryProviderPlugin;
				}

				if (libraryProviderPlugin.ShouldBeShown())
				{
					// This coupling is required to navigate to the Purchased folder after redemption or purchase updates
					libraryCreators.Add(libraryProviderPlugin);
					folderImagesForChildren.Add(libraryProviderPlugin.GetFolderImage());
				}
			}

			// and any directory providers (sd card provider, etc...)
			// Add "Downloads" file system example
			string downloadsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
			if (Directory.Exists(downloadsDirectory))
			{
				libraryCreators.Add(
					new LibraryProviderFileSystemCreator(
						downloadsDirectory,
						"Downloads".Localize(),
						useIncrementedNameDuringTypeChange: true));

				AddFolderImage("download_folder.png");
			}

			string userLibraryFoldersPath = Path.Combine(ApplicationDataStorage.ApplicationUserDataPath, "LibraryFolders.conf");
			if (File.Exists(userLibraryFoldersPath))
			{
				foreach (string directory in File.ReadLines(userLibraryFoldersPath))
				{
					if (Directory.Exists(directory))
					{
						libraryCreators.Add(
							new LibraryProviderFileSystemCreator(
								directory,
								(new DirectoryInfo(directory).Name),
								useIncrementedNameDuringTypeChange: true));

						AddFolderImage("download_folder.png");
					}
				}
			}

			firstAddedDirectoryIndex = libraryCreators.Count;
			OnDataReloaded(null);
		}
Esempio n. 3
0
        public LibraryProviderSelector(Action <LibraryProvider> setCurrentLibraryProvider)
            : base(null)
        {
            this.Name = "Home".Localize();

            this.setCurrentLibraryProvider = setCurrentLibraryProvider;

            ApplicationController.Instance.CloudSyncStatusChanged.RegisterEvent(CloudSyncStatusChanged, ref unregisterEvents);

            if (false)
            {
                // This is test code for how to add these when we get to it
                // put in the queue provider
                libraryCreators.Add(new LibraryProviderQueueCreator());
                AddFolderImage("queue_folder.png");

                // put in the queue provider
                libraryCreators.Add(new LibraryProviderHistoryCreator());
                AddFolderImage("queue_folder.png");
            }

            // put in the sqlite provider
            libraryCreators.Add(new LibraryProviderSQLiteCreator());
            AddFolderImage("library_folder.png");

            // Check for LibraryProvider factories and put them in the list too.
            PluginFinder <LibraryProviderPlugin> libraryProviderPlugins = new PluginFinder <LibraryProviderPlugin>();

            foreach (LibraryProviderPlugin libraryProviderPlugin in libraryProviderPlugins.Plugins)
            {
                // This coupling is required to navigate to the Purchased folder after redemption or purchase updates
                libraryCreators.Add(libraryProviderPlugin);
                folderImagesForChildren.Add(libraryProviderPlugin.GetFolderImage());

                if (libraryProviderPlugin.ProviderKey == "LibraryProviderPurchasedKey")
                {
                    this.PurchasedLibraryCreator = libraryProviderPlugin;
                }
            }

            // and any directory providers (sd card provider, etc...)
            // Add "Downloads" file system example
            string downloadsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");

            if (Directory.Exists(downloadsDirectory))
            {
                libraryCreators.Add(new LibraryProviderFileSystemCreator(downloadsDirectory, "Downloads"));
                AddFolderImage("download_folder.png");
            }

            firstAddedDirectoryIndex = libraryCreators.Count;

#if !__ANDROID__
            MenuOptionFile.CurrentMenuOptionFile.AddLocalFolderToLibrary += (sender, e) =>
            {
                AddCollectionToLibrary(e.Data);
            };
#endif

            this.FilterProviders();
        }
		private void ReloadData()
		{
			libraryCreators.Clear();
			folderImagesForChildren.Clear();

			if (includeQueueLibraryProvider)
			{
				// put in the queue provider
				libraryCreators.Add(new LibraryProviderQueueCreator());
				AddFolderImage("queue_folder.png");
			}

			if (false)
			{
				// put in the history provider
				libraryCreators.Add(new LibraryProviderHistoryCreator());
				AddFolderImage("queue_folder.png");
			}

			// put in the sqlite provider
			libraryCreators.Add(new LibraryProviderSQLiteCreator());
			AddFolderImage("library_folder.png");

			// Check for LibraryProvider factories and put them in the list too.
			foreach (LibraryProviderPlugin libraryProviderPlugin in libraryProviderPlugins.Plugins)
			{
				if (libraryProviderPlugin.ProviderKey == "LibraryProviderPurchasedKey")
				{
					this.PurchasedLibraryCreator = libraryProviderPlugin;
				}

				if (libraryProviderPlugin.ShouldBeShown(ReloadData))
				{
					// This coupling is required to navigate to the Purchased folder after redemption or purchase updates
					libraryCreators.Add(libraryProviderPlugin);
					folderImagesForChildren.Add(libraryProviderPlugin.GetFolderImage());
				}
			}

			// and any directory providers (sd card provider, etc...)
			// Add "Downloads" file system example
			string downloadsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
			if (Directory.Exists(downloadsDirectory))
			{
				libraryCreators.Add(new LibraryProviderFileSystemCreator(downloadsDirectory, "Downloads"));
				AddFolderImage("download_folder.png");
			}

			firstAddedDirectoryIndex = libraryCreators.Count;
			OnDataReloaded(null);
		}
		public LibraryProviderSelector(Action<LibraryProvider> setCurrentLibraryProvider)
			: base(null)
		{
			this.Name = "Home".Localize();

			this.setCurrentLibraryProvider = setCurrentLibraryProvider;

			ApplicationController.Instance.CloudSyncStatusChanged.RegisterEvent(CloudSyncStatusChanged, ref unregisterEvents);

			if (false)
			{
				// This is test code for how to add these when we get to it
				// put in the queue provider
				libraryCreators.Add(new LibraryProviderQueueCreator());
				AddFolderImage("queue_folder.png");

				// put in the queue provider
				libraryCreators.Add(new LibraryProviderHistoryCreator());
				AddFolderImage("queue_folder.png");
			}

			// put in the sqlite provider
			libraryCreators.Add(new LibraryProviderSQLiteCreator());
			AddFolderImage("library_folder.png");

			// Check for LibraryProvider factories and put them in the list too.
			PluginFinder<LibraryProviderPlugin> libraryProviderPlugins = new PluginFinder<LibraryProviderPlugin>();
			foreach (LibraryProviderPlugin libraryProviderPlugin in libraryProviderPlugins.Plugins)
			{
				// This coupling is required to navigate to the Purchased folder after redemption or purchase updates
				libraryCreators.Add(libraryProviderPlugin);
				folderImagesForChildren.Add(libraryProviderPlugin.GetFolderImage());

				if (libraryProviderPlugin.ProviderKey == "LibraryProviderPurchasedKey")
				{
					this.PurchasedLibraryCreator = libraryProviderPlugin;
				}
			}

			// and any directory providers (sd card provider, etc...)
			// Add "Downloads" file system example
			string downloadsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
			if (Directory.Exists(downloadsDirectory))
			{
				libraryCreators.Add(new LibraryProviderFileSystemCreator(downloadsDirectory, "Downloads"));
				AddFolderImage("download_folder.png");
			}

			firstAddedDirectoryIndex = libraryCreators.Count;

#if !__ANDROID__
			MenuOptionFile.CurrentMenuOptionFile.AddLocalFolderToLibrary += (sender, e) =>
			{
				AddCollectionToLibrary(e.Data);
			};
#endif

			this.FilterProviders();
		}