public void Load(StorageDirectory colorListFolder)
		{
			Items.Clear();

			if (!colorListFolder.ExistsLocal()) return;

			foreach (var folder in colorListFolder.GetLocalFolders())
			{
				var files = folder.GetLocalFiles().ToList();

				var colorFolder = new ColorFolder();
				colorFolder.Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(folder.Name);

				var imageFile = files.FirstOrDefault(file => file.Name == "image.png");
				if (imageFile != null)
					colorFolder.Logo = new Bitmap(imageFile.LocalPath);

				var schemaFile = files.FirstOrDefault(file => file.Name == "color_scheme.txt");
				colorFolder.Schema = schemaFile != null ?
				ColorSchema.Parse(File.ReadAllText(schemaFile.LocalPath)) :
				new ColorSchema();


				Items.Add(colorFolder);
			}
		}
Esempio n. 2
0
		private void LoadSlides(StorageDirectory storageDirectory)
		{
			foreach (var sizeFolder in storageDirectory.GetLocalFolders())
			{
				var format = SlideFormatEnum.Undefined;
				switch (Path.GetFileName(sizeFolder.LocalPath))
				{
					case "4x3":
						format = SlideFormatEnum.Format4x3;
						break;
					case "16x9":
						format = SlideFormatEnum.Format16x9;
						break;
					case "3x4":
						format = SlideFormatEnum.Format3x4;
						break;
				}
				foreach (var groupFolder in sizeFolder.GetLocalFolders())
					foreach (var slideFolder in groupFolder.GetLocalFolders())
					{
						var slideMaster = new SlideMaster(slideFolder)
						{
							Group = groupFolder.Name,
							Format = format
						};
						slideMaster.Load();
						Slides.Add(slideMaster);
					}
			}
			Slides.Sort(
				(x, y) => x.Group.Equals(y.Group) ? x.Order.CompareTo(y.Order) : WinAPIHelper.StrCmpLogicalW(x.Group, y.Group));
		}
Esempio n. 3
0
		public void Load()
		{
			_themes.Clear();
			var storageDirectory = new StorageDirectory(ResourceManager.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);
		}