Exemplo n.º 1
0
		public WebThumbnailViewer()
		{
			CanLoad = false;
			ThumbBorderColor = Color.Wheat;
			ThumbBackgroundColor = Color.White;
			ThumbNailSize = 95;
			InitializeComponent();

			_browser = new XWebBrowser(XWebBrowser.BrowserType.GeckoFx);
			_browser.Dock = DockStyle.Fill;
			Controls.Add(_browser);
			_browser.Navigated += ((sender, args) =>
			{
				if (LoadComplete != null)
					LoadComplete(this, new EventArgs());
			});
			var browserAdapter = ((GeckoFxWebBrowserAdapter)_browser.Adapter);
			browserAdapter.AddDomClickHandler(id =>
			{
				HasSelection = true;
				var path = Uri.UnescapeDataString(id);
				if (SelectedPath != path)
				{
					browserAdapter.SetClassOfLastClickTarget("imageWrap");
					browserAdapter.SetClassOfClickTarget("imageWrap selected");
					SelectedPath = path;
					if (SelectedIndexChanged != null)
						SelectedIndexChanged(this, new EventArgs());
				}
			});
		}
Exemplo n.º 2
0
 private static void ShowSilAboutBox(XWebBrowser.BrowserType browserType, bool useFullVersionNumber)
 {
     XWebBrowser.DefaultBrowserType = browserType;
     using (var tempfile = TempFile.WithExtension("html"))
     {
         File.WriteAllText(tempfile.Path,
             @"<html><body><h3>Copyright 2014 <a href=""http://sil.org"">SIL International</a></h3>" +
             @"<p>Testing the <b>about box</b></p></body></html>");
         var uri = new Uri(tempfile.Path);
         using (var dlg = new SILAboutBox(uri.AbsoluteUri, useFullVersionNumber))
         {
             dlg.ShowDialog();
         }
     }
 }