Esempio n. 1
0
		public void Load()
		{
			MainFolder = new StorageDirectory(RemoteResourceManager.Instance.ArtworkFolder.RelativePathParts.Merge("Banners"));
			AdditionalFolder = new StorageDirectory(RemoteResourceManager.Instance.ArtworkFolder.RelativePathParts.Merge("Banners_2"));
			FavsFolder = new StorageDirectory(RemoteResourceManager.Instance.AppSharedSettingsFolder.RelativePathParts.Merge("Favorite_Banners"));

			Items.Clear();

			SourceFolderImageGroup sourceFolderImageGroup = new RegularImageGroup(this);
			sourceFolderImageGroup.Name = "Gallery";
			sourceFolderImageGroup.Order = -3;
			if (MainFolder.ExistsLocal())
				sourceFolderImageGroup.LoadImages<Banner>(MainFolder.LocalPath);
			Items.Add(sourceFolderImageGroup);

			var searchResultsimageGroup = new SearchResultsImageGroup(this);
			searchResultsimageGroup.Name = "Search Results";
			searchResultsimageGroup.Order = -2;
			Items.Add(searchResultsimageGroup);

			sourceFolderImageGroup = new FavoriteImageGroup(this);
			sourceFolderImageGroup.Name = "My Favorites";
			sourceFolderImageGroup.Order = -1;
			if (FavsFolder.ExistsLocal())
				sourceFolderImageGroup.LoadImages<Banner>(FavsFolder.LocalPath);
			Items.Add(sourceFolderImageGroup);

			if (AdditionalFolder.ExistsLocal())
			{
				var contentDescriptionPath = Path.Combine(AdditionalFolder.LocalPath, "order.txt");
				if (File.Exists(contentDescriptionPath))
				{
					var groupNames = File.ReadAllLines(contentDescriptionPath);
					var groupIndex = 0;
					foreach (var groupName in groupNames)
					{
						if (String.IsNullOrEmpty(groupName)) continue;
						var groupFolderPath = Path.Combine(AdditionalFolder.LocalPath, groupName);
						if (!Directory.Exists(groupFolderPath)) continue;
						sourceFolderImageGroup = new RegularImageGroup(this);
						sourceFolderImageGroup.Name = groupName;
						sourceFolderImageGroup.Order = groupIndex;
						sourceFolderImageGroup.LoadImages<Banner>(groupFolderPath);
						Items.Add(sourceFolderImageGroup);
						groupIndex++;
					}
				}
			}
			Items.Sort((x, y) => x.Order.CompareTo(y.Order));
		}
		public async Task LoadLocal()
		{
			TempFolder = new StorageDirectory(new[]
			{
				"Temp"
			});
			if (TempFolder.ExistsLocal())
				Utils.CleanFolder(TempFolder.LocalPath);
			if (!TempFolder.ExistsLocal())
				await StorageDirectory.CreateSubFolder(new string[] { }, "Temp");

			AppSharedSettingsFolder = new StorageDirectory(new object[]
			{
				FileStorageManager.LocalFilesFolderName,
				AppProfileManager.Instance.AppName,
				"shared"
			});
			if (!await AppSharedSettingsFolder.Exists())
				await StorageDirectory.CreateSubFolder(new[] { FileStorageManager.LocalFilesFolderName }, new[] { AppProfileManager.Instance.AppName, "shared" });

			AppAliasSettingsFolder = new StorageDirectory(new object[]
			{
				FileStorageManager.LocalFilesFolderName,
				AppProfileManager.Instance.AppNameSet,
			});
			if (!await AppAliasSettingsFolder.Exists())
				await StorageDirectory.CreateSubFolder(new[] { FileStorageManager.LocalFilesFolderName }, AppProfileManager.Instance.AppNameSet);

			AppSettingsFile = new StorageFile(new object[]
			{
				FileStorageManager.LocalFilesFolderName,
				AppProfileManager.Instance.AppNameSet,
				"Settings.xml"
			});
			AppSettingsFile.AllocateParentFolder();
		}
		public void Load()
		{
			_themes.Clear();
			var storageDirectory = new StorageDirectory(RemoteResourceManager.Instance.ThemesFolder.RelativePathParts.Merge(PowerPointManager.Instance.SlideSettings.SlideMasterFolder));
			if (!storageDirectory.ExistsLocal()) return;

			LoadApprovedThemes(storageDirectory);

			foreach (var themeFolder in storageDirectory.GetLocalFolders())
			{
				var theme = new Theme(themeFolder);
				theme.Load();
				foreach (var approvedTheme in ApprovedThemes.Where(approvedTheme => approvedTheme.Value.Any(t => t.Equals(theme.Name))))
					theme.ApprovedSlides.Add(approvedTheme.Key);
				_themes.Add(theme);
			}
			_themes.Sort((x, y) => x.Order.CompareTo(y.Order));

			ThemesChanged?.Invoke(this, EventArgs.Empty);
		}
		public void Load()
		{
			MainFolder = new StorageDirectory(RemoteResourceManager.Instance.ArtworkFolder.RelativePathParts.Merge("link_bundle_icons"));
			AdditionalFolder = new StorageDirectory(RemoteResourceManager.Instance.ArtworkFolder.RelativePathParts.Merge("link_bundle_icons_2"));
			FavsFolder = new StorageDirectory(RemoteResourceManager.Instance.AppAliasSettingsFolder.RelativePathParts.Merge("Favorite Link Bundle Icons"));

			DefaultPowerPointLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_pptx.png"));
			DefaultWordLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_docx.png"));
			DefaultExcelLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_xlsx.png"));
			DefaultPdfLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_pdf.png"));
			DefaultVideoLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_mp4.png"));
			DefaultImageLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_image.png"));

			DefaultInfoLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_info.png"));
			DefaultRevenueLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_revenue.png"));
			DefaultStrategyLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_sales_strategy.png"));
			DefaultUrlLogo = new StorageFile(MainFolder.RelativePathParts.Merge("default_url.png"));

			Items.Clear();

			SourceFolderImageGroup sourceFolderImageGroup = new RegularImageGroup(this);
			sourceFolderImageGroup.Name = "Gallery";
			sourceFolderImageGroup.Order = -2;
			if (MainFolder.ExistsLocal())
				sourceFolderImageGroup.LoadImages<Widget>(MainFolder.LocalPath);
			Items.Add(sourceFolderImageGroup);

			sourceFolderImageGroup = new FavoriteImageGroup(this);
			sourceFolderImageGroup.Name = "My Favorites";
			sourceFolderImageGroup.Order = -1;
			if (FavsFolder.ExistsLocal())
				sourceFolderImageGroup.LoadImages<Widget>(FavsFolder.LocalPath);
			Items.Add(sourceFolderImageGroup);

			Items.Sort((x, y) => x.Order.CompareTo(y.Order));
		}