コード例 #1
0
		public async Task Upload()
		{
			var tempArchiveFile = new StorageFile(RelativePathParts.Merge(String.Format("{0}.zip", Name)));
			Utils.CompressFiles(Directory.GetFiles(LocalPath), tempArchiveFile.LocalPath);
			await tempArchiveFile.AllocateParentFolder(true);
			await tempArchiveFile.Upload();
		}
コード例 #2
0
		private void LoadApprovedThemes(StorageDirectory root)
		{
			var contentFile = new StorageFile(root.GetParentFolder().RelativePathParts.Merge("ApprovedThemes.xml"));

			if (!contentFile.ExistsLocal()) return;

			var document = new XmlDocument();
			document.Load(contentFile.LocalPath);

			foreach (var slideNode in document.SelectNodes(@"//Root/Slide").OfType<XmlNode>())
			{
				var slideAttribute = slideNode.Attributes["Name"];
				if (slideAttribute == null) continue;
				var slideType = SlideType.None;
				switch (slideAttribute.Value)
				{
					case "SalesLibrary":
						slideType = SlideType.SalesDepot;
						break;
				}
				if (slideType == SlideType.None) continue;
				foreach (var themeNode in slideNode.SelectNodes("Theme").OfType<XmlNode>())
				{
					if (!ApprovedThemes.ContainsKey(slideType))
						ApprovedThemes.Add(slideType, new List<string>());
					ApprovedThemes[slideType].Add(themeNode.InnerText);
				}
			}
		}
コード例 #3
0
		private FormStateHelper(Form targetForm, StorageDirectory storagePath, string filePrefix, bool showMaximized, bool saveSate)
		{
			_form = targetForm;
			_formKey = filePrefix;
			_stateStorageFile = new StorageFile(storagePath.RelativePathParts.Merge(String.Format("{0}-{1}", filePrefix, StorageName)));
			_showMaximized = showMaximized;
			_saveSate = saveSate;
			_form.WindowState = FormWindowState.Normal;
			_form.Load += (o, e) => LoadState();
			_form.FormClosed += (o, e) => SaveState();
		}
コード例 #4
0
		public async Task LoadProfile()
		{
			_localAppIdFile = String.IsNullOrEmpty(LibraryAlias) ?
				new StorageFile(new[] { String.Format("{0}_app_id.xml", AppName) }) :
				new StorageFile(new[] { String.Format("{0}_{1}_app_id.xml", AppName, LibraryAlias) });

			_appID = Guid.Empty;
			if (File.Exists(_localAppIdFile.LocalPath))
			{
				var document = new XmlDocument();
				document.Load(_localAppIdFile.LocalPath);

				var node = document.SelectSingleNode(@"/AppID");
				if (!String.IsNullOrEmpty(node?.InnerText))
					_appID = new Guid(node.InnerText);
			}

			if (_appID.Equals(Guid.Empty))
				CreateProfile();

			ProfilesRootFolder = new StorageDirectory(new object[]
			{
				FileStorageManager.OutgoingFolderName,
				AppNameSet
			});
			if (!await ProfilesRootFolder.Exists(true))
				if (AppNameSet.Length > 1)
				{
					await StorageDirectory.CreateSubFolder(new[]
					{
						FileStorageManager.OutgoingFolderName
					}, AppName, true);
					await StorageDirectory.CreateSubFolder(new[]
					{
						FileStorageManager.OutgoingFolderName
					}, AppNameSet, true);
				}
				else
				{
					await StorageDirectory.CreateSubFolder(new[]
					{
						FileStorageManager.OutgoingFolderName
					}, AppNameSet, true);
				}

			ProfileFolder = new StorageDirectory(ProfilesRootFolder.RelativePathParts.Merge(ProfileName));
			if (!await ProfileFolder.Exists(true))
				await StorageDirectory.CreateSubFolder(ProfilesRootFolder.RelativePathParts, ProfileName, true);

			UserDataFolder = new StorageDirectory(ProfileFolder.RelativePathParts.Merge(new[] { UserDataFolderName }));
			if (!await UserDataFolder.Exists(true))
				await StorageDirectory.CreateSubFolder(ProfileFolder.RelativePathParts, UserDataFolderName, true);
		}
コード例 #5
0
		public void Init()
		{
			SettingsFile = new StorageFile(new[]
			{
				FileStorageManager.LocalFilesFolderName,
				FileStorageManager.CommonIncomingFolderName,
				"Credentials.xml"
			});
			SettingsFile.AllocateParentFolder();

			Settings = AuthSettings.Load(SettingsFile);
		}
コード例 #6
0
		public void RunPowerPointLoader()
		{
			KillPowerPoint();

			var launcherTemplate = new StorageFile(RemoteResourceManager.Instance.LauncherTemplatesFolder.RelativePathParts.Merge(SlideSettings.LauncherTemplateName));
			if (!launcherTemplate.ExistsLocal())
				throw new FileNotFoundException(String.Format("There is no {0} found", launcherTemplate.Name));

			var process = new Process();
			process.StartInfo.FileName = launcherTemplate.LocalPath;
			process.StartInfo.UseShellExecute = true;
			process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
			process.Start();
		}
コード例 #7
0
		public async Task Init()
		{
			await InitCredentials();

			_versionFile = new ConfigFile(new object[]
			{
				IncomingFolderName,
				AppProfileManager.Instance.AppNameSet,
				"version.txt"
			});
			if (Activated)
				await CheckDataSate();
			if (Activated)
				Authorize();
		}
コード例 #8
0
		public async Task LoadRemote()
		{
			await Common.Helpers.RemoteResourceManager.Instance.LoadRemote();

			#region Remote
			var appOutgoingFolder = new StorageDirectory(new object[]
			{
				FileStorageManager.IncomingFolderName,
				AppProfileManager.Instance.AppNameSet,
				"AppSettings"
			});

			SiteFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"Site.txt"
				));
			await SiteFile.Download();

			CategoryRequestSettingsFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"CategoryRequest.xml"
				));
			await CategoryRequestSettingsFile.Download();

			ErrorEmailSettingsFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"ErrorEmail.xml"
				));
			await ErrorEmailSettingsFile.Download();

			TabSettingsFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"RibbonTabs.xml"
				));
			await TabSettingsFile.Download();

			SyncLockSettingsFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"SyncLock.xml"
				));
			await SyncLockSettingsFile.Download();
			#endregion
		}
コード例 #9
0
		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();
		}
コード例 #10
0
		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));
		}
コード例 #11
0
ファイル: Theme.cs プロジェクト: w01f/VolgaTeam.SalesLibrary
		public void Load()
		{
			var files = _root.GetLocalFiles().ToList();

			var titleFile = files.First(file => file.Name == "title.txt");
			Name = File.ReadAllText(titleFile.LocalPath).Trim();

			int tempInt;
			if (Int32.TryParse(Path.GetFileName(_root.LocalPath), out tempInt))
				Order = tempInt;

			var bigLogoFile = files.FirstOrDefault(file => file.Name == "preview.png");
			if (bigLogoFile != null)
			{
				Logo = new Bitmap(bigLogoFile.LocalPath);
				BrowseLogo = Logo.GetThumbnailImage(((Logo.Width * 144) / Logo.Height) + 10, 144, null, IntPtr.Zero);
				var borderedLogo = Logo.DrawBorder();
				RibbonLogo = borderedLogo.GetThumbnailImage(((borderedLogo.Width * 72) / borderedLogo.Height) + 10, 72, null, IntPtr.Zero);
			}

			_themeFile = files.FirstOrDefault(file => file.Extension == ".thmx");

			ApprovedSlides = new List<SlideType>();
		}
コード例 #12
0
		public async Task LoadRemote()
		{
			ArtworkFolder = new ArchiveDirectory(new object[]
			{
				FileStorageManager.IncomingFolderName,
				AppProfileManager.Instance.AppName,
				"shared_artwork",
				"Artwork"
			});
			if (!await ArtworkFolder.Exists(true))
			{
				ArtworkFolder = new ArchiveDirectory(new object[]
				{
					FileStorageManager.IncomingFolderName,
					AppProfileManager.Instance.AppNameSet,
					"Artwork"
				});
			}
			await ArtworkFolder.Download();

			ThemesFolder = new ArchiveDirectory(new[]
			{
				FileStorageManager.IncomingFolderName,
				FileStorageManager.CommonIncomingFolderName,
				"SellerPointThemes"
			});
			await ThemesFolder.Download();

			LauncherTemplatesFolder = new ArchiveDirectory(new[]
			{
				FileStorageManager.IncomingFolderName,
				FileStorageManager.CommonIncomingFolderName,
				"LauncherTemplates"
			});
			await LauncherTemplatesFolder.Download();

			DefaultSlideSettingsFile = new StorageFile(new[]
			{
				FileStorageManager.IncomingFolderName,
				FileStorageManager.CommonIncomingFolderName,
				"AppSettings",
				"DefaultSlideSettings.xml"
			});
			await DefaultSlideSettingsFile.Download();

			SlideSizeSettingsFile = new StorageFile(new[]
			{
				FileStorageManager.IncomingFolderName,
				FileStorageManager.CommonIncomingFolderName,
				"AppSettings",
				"SlideSizeSettings.xml"
			});
			await SlideSizeSettingsFile.Download();

			HelpFile = new StorageFile(new[]
			{
				FileStorageManager.IncomingFolderName,
				FileStorageManager.CommonIncomingFolderName,
				"HelpUrls",
				HelpManager.GetFileName()
			});
			await HelpFile.Download();

			HelpBrowserFile = new StorageFile(new[]
			{
				FileStorageManager.IncomingFolderName,
				FileStorageManager.CommonIncomingFolderName,
				"HelpUrls",
				"!Help_Browser.xml"
			});
			await HelpBrowserFile.Download();
		}
コード例 #13
0
		public static async Task<bool> Exists(string[] relativePathParts, bool checkRemoteToo = false)
		{
			var storageItem = new StorageFile(relativePathParts);
			return await storageItem.Exists(checkRemoteToo);
		}
コード例 #14
0
		public async Task Load()
		{
			await Common.Helpers.RemoteResourceManager.Instance.LoadLocal();
			await Common.Helpers.RemoteResourceManager.Instance.LoadRemote();

			#region Local
			LocalLibraryFolder = new StorageDirectory(new[]
			{
				FileStorageManager.LocalFilesFolderName,
				"Libraries"
			});
			if (!await LocalLibraryFolder.Exists())
				await StorageDirectory.CreateSubFolder(new[] { FileStorageManager.LocalFilesFolderName }, "Libraries");

			EmailBinFile = new StorageFile(new object[]
			{
				FileStorageManager.LocalFilesFolderName,
				AppProfileManager.Instance.AppNameSet,
				"EmailBin.xml"
			});
			EmailBinFile.AllocateParentFolder();
			#endregion

			#region Remote
			var appOutgoingFolder = new StorageDirectory(new object[]
			{
				FileStorageManager.IncomingFolderName,
				AppProfileManager.Instance.AppNameSet,
				"AppSettings"
			});

			NetworkPathFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"NetworkPath.txt"
				));
			await NetworkPathFile.Download();

			DefaultViewFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"DefaultView.xml"
				));
			await DefaultViewFile.Download();

			ViewButtonsFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"ViewButtons.xml"
				));
			await ViewButtonsFile.Download();

			TabSettingsFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"SDTabNames.xml"
				));
			await TabSettingsFile.Download();

			CalendarDisclaimerFile = new StorageFile(new object[]
			{
				FileStorageManager.IncomingFolderName,
				AppProfileManager.Instance.AppNameSet,
				"Nielsen Permissible Use.pdf"
			});
			await CalendarDisclaimerFile.Download();

			Gallery1ConfigFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"Gallery1.xml"
				));
			await Gallery1ConfigFile.Download();

			Gallery2ConfigFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"Gallery2.xml"
				));
			await Gallery2ConfigFile.Download();

			CalendarRibbonLogoFile = new StorageFile(appOutgoingFolder.RelativePathParts.Merge(
				"oc_logo.png"
				));
			await CalendarRibbonLogoFile.Download();

			SDSearchFile = new StorageFile(new object[]
			{
				FileStorageManager.IncomingFolderName,
				AppProfileManager.Instance.AppNameSet,
				"Data",
				"SDSearch.xml"
			});
			await SDSearchFile.Download();
			#endregion
		}
コード例 #15
0
		public static AuthSettings Load(StorageFile settingsFile)
		{
			var settings = SettingsSerializeHelper.Load<AuthSettings>(settingsFile);
			settings.Init(settingsFile);
			return settings;
		}
コード例 #16
0
		public void Init(StorageFile settingsFile)
		{
			_settingsFile = settingsFile;
		}