Esempio n. 1
0
 private void _helpButton_Click(object sender, EventArgs e)
 {
     if (_tab.SelectedTab == tabPage1)
     {
         HelpLauncher.Show(this, "Tasks/Basic_tasks/Change_languages.htm");
     }
     else if (_tab.SelectedTab == tabPage2)
     {
         HelpLauncher.Show(this, "Tasks/Basic_tasks/Select_front_matter_or_back_matter_from_a_pack.htm");
     }
     else if (_tab.SelectedTab == tabPage3)
     {
         HelpLauncher.Show(this, "Tasks/Basic_tasks/Enter_project_information.htm");
     }
     else
     {
         HelpLauncher.Show(this, "User_Interface/Dialog_boxes/Settings_dialog_box.htm");
     }
 }
Esempio n. 2
0
 public void CurrentSelection_ADifferentBookIsSelected_GoesToFirstPage()
 {
     HelpLauncher.Show(null, "Chorus_Help.chm", "Chorus/Chorus_overview.htm");
 }
Esempio n. 3
0
 private void _helpButton_Click(object sender, EventArgs e)
 {
     HelpLauncher.Show(this, "Tasks/Publish_tasks/Create_Epub.htm");
 }
 private void _helpButton_Click(object sender, System.EventArgs e)
 {
     HelpLauncher.Show(this, "Concepts/Bloom_Pack.htm");
 }
Esempio n. 5
0
 private void OnHelpButtonClick(object sender, MouseEventArgs e)
 {
     HelpLauncher.Show(this, CurrentTabView.HelpTopicUrl);
 }
Esempio n. 6
0
 private void _readMoreLabel_Click(object sender, LinkLabelLinkClickedEventArgs e)
 {
     HelpLauncher.Show(null, "Chorus_Help.chm", "Chorus/Chorus_overview.htm");
 }
Esempio n. 7
0
 private void toolStripMenuItem3_Click(object sender, EventArgs e)
 {
     HelpLauncher.Show(this, CurrentTabView.HelpTopicUrl);
 }
 private void OnAboutProjectInformationSetingsButton_Click(object sender, EventArgs e)
 {
     HelpLauncher.Show(this, "Tasks/Basic_tasks/Enter_project_information.htm");
 }
 private void OnAboutBookMakingSettings(object sender, EventArgs e)
 {
     HelpLauncher.Show(this, "Tasks/Basic_tasks/Select_front_matter_or_back_matter_from_a_pack.htm");
 }
 private void OnAboutLanguageSettings(object sender, EventArgs e)
 {
     HelpLauncher.Show(this, "Tasks/Basic_tasks/Change_languages.htm");
 }
		// Every path should return false or send a response.
		// Otherwise we can get a timeout error as the browser waits for a response.
		protected override bool ProcessRequest(IRequestInfo info)
		{
			if (base.ProcessRequest(info))
				return true;

			var localPath = GetLocalPathWithoutQuery(info);

			// routing
			if (localPath.StartsWith("readers/"))
			{
				if (ReadersHandler.HandleRequest(localPath, info, CurrentCollectionSettings))
					return true;
			}
			else if (localPath.StartsWith("i18n/"))
			{
				if (I18NHandler.HandleRequest(localPath, info, CurrentCollectionSettings))
					return true;
			}
			else if (localPath.StartsWith("directoryWatcher/"))
			{
				var dirName = info.GetPostData()["dir"];

				if (dirName == "Sample Texts")
				{
					if (CheckForSampleTextChanges(info))
						return true;
				}

				return false;
			}
			else if (localPath.StartsWith("leveledRTInfo/"))
			{
				var queryPart = string.Empty;
				if (info.RawUrl.Contains("?"))
					queryPart = "#" + info.RawUrl.Split('?')[1];
				var langCode = LocalizationManager.UILanguageId;
				var completeEnglishPath = FileLocator.GetFileDistributedWithApplication(localPath);
				var completeUiLangPath = GetUiLanguageFileVersion(completeEnglishPath, langCode);
				string url;
				if (langCode != "en" && File.Exists(completeUiLangPath))
					url = completeUiLangPath;
				else
					url = completeEnglishPath;
				var cleanUrl = url.Replace("\\", "/"); // allows jump to file to work

				string browser = string.Empty;
				if (Palaso.PlatformUtilities.Platform.IsLinux)
				{
					// REVIEW: This opens HTML files in the browser. Do we have any non-html
					// files that this code needs to open in the browser? Currently they get
					// opened in whatever application the user has selected for that file type
					// which might well be an editor.
					browser = "xdg-open";
				}
				else
				{
					// If we don't provide the path of the browser, i.e. Process.Start(url + queryPart), we get file not found exception.
					// If we prepend "file:///", the anchor part of the link (#xxx) is not sent unless we provide the browser path too.
					// This is the same behavior when simply typing a url into the Run command on Windows.
					// If we fail to get the browser path for some reason, we still load the page, just without navigating to the anchor.
					string defaultBrowserPath;
					if (TryGetDefaultBrowserPath(out defaultBrowserPath))
					{
						browser = defaultBrowserPath;
					}
				}

				if (!string.IsNullOrEmpty(browser))
				{
					try
					{
						Process.Start(browser, "\"file:///" + cleanUrl + queryPart + "\"");
						return false;
					}
					catch (Exception)
					{
						Debug.Fail("Jumping to browser with anchor failed.");
						// Don't crash Bloom because we can't open an external file.
					}
				}

				// If the above failed, either for lack of default browser or exception, try this:
				Process.Start("\"" + cleanUrl + "\"");
				return false;
			}

			switch (localPath)
			{
				case "currentPageContent":
					info.ContentType = "text/html";
					info.WriteCompleteOutput(CurrentPageContent ?? "");
					return true;

				case "accordionContent":
					info.ContentType = "text/html";
					info.WriteCompleteOutput(AccordionContent ?? "");
					return true;

				case "availableFontNames":
					InstalledFontCollection installedFontCollection = new InstalledFontCollection();
					info.WriteCompleteOutput(string.Join(",", installedFontCollection.Families.Select(f => f.Name)));
					return true;

				case "help":
					var post = info.GetPostData();
					HelpLauncher.Show(null, post["data"]);
					return true;

				case "getNextBookStyle":
					info.ContentType = "text/html";
					info.WriteCompleteOutput(CurrentBook.NextStyleNumber.ToString(CultureInfo.InvariantCulture));
					return true;
			}

			string path = null;
			try
			{
				path = FileLocator.GetFileDistributedWithApplication("BloomBrowserUI", localPath);
			}
			catch (ApplicationException)
			{
				// ignore
			}

			if (!File.Exists(path)) return false;

			info.ContentType = GetContentType(Path.GetExtension(localPath));
			info.ReplyWithFileContent(path);
			return true;
		}