Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic html in silverlight (Read 4473 times)
xarzu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Oct 13th, 2011
html in silverlight
Oct 13th, 2011 at 7:56pm
Print Post  
I have noticed that I can create an HTML class in a silverlight project.  But how can I make use of it?  I do not think it is possible, for example, to import an html document into a richtextedit class.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: html in silverlight
Reply #1 - Oct 13th, 2011 at 8:07pm
Print Post  
If you are referring to the HtmlBuilder class, it's used to create image-maps for exported diagram images. This will let you (or your users) show in the browser diagram images with clickable node areas that will open a new page. I'm not sure how useful this will be from a Silvelright application that's already shown in a browser anyway, but we copied it from our other controls after a customer requested it.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
xarzu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Oct 13th, 2011
Re: html in silverlight
Reply #2 - Oct 14th, 2011 at 1:25am
Print Post  
I see it is part of the
MindFusion.Diagramming.Silverlight Namespace.

Is there a demo to see this in action?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: html in silverlight
Reply #3 - Oct 14th, 2011 at 7:34am
Print Post  
You can see the a sample page here:
http://mindfusion.eu/_samples/html_test.html

The nodes' Hyperlink property is set to http://silverlight.net and the html was generated with the code below:

Code
Select All
private string imageFile;

private void OnExportImage(object sender, RoutedEventArgs e)
{
	var dlg = new SaveFileDialog { Filter = "image files|*.png" };
	if (dlg.ShowDialog() == true)
	{
		using (var stream = dlg.OpenFile())
			diagram.SaveToPng(stream);
		imageFile = dlg.SafeFileName;
	}
}

private void OnExportHtml(object sender, RoutedEventArgs e)
{
	var dlg = new SaveFileDialog { Filter = "html files|*.html" };
	if (!string.IsNullOrEmpty(imageFile) && dlg.ShowDialog() == true)
	{
		using (var stream = dlg.OpenFile())
		using (var writer = new StreamWriter(stream))
		{
			var htmlBuilder = new HtmlBuilder(diagram);
			var map = htmlBuilder.CreateImageMap("map1");
			var mapRef = htmlBuilder.CreateUseMapAttr("map1");

			string html = "<html><body><img src='{0}' {1}>{2}</body></html>";
			html = string.Format(html, imageFile, mapRef, map);

			writer.Write(html);
		}
	}
} 



We have found a bug that created incorrect offset of ShapeNodes, it is fixed in the HtmlBuilder version here:
https://mindfusion.eu/_temp/diaglite_html.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
xarzu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Oct 13th, 2011
Re: html in silverlight
Reply #4 - Oct 14th, 2011 at 7:44am
Print Post  
Stoyo wrote on Oct 14th, 2011 at 7:34am:
You can see the a sample page here:
http://mindfusion.eu/_samples/html_test.html


That is an interesting example this page does not display a html document.  Instead it provides a link to a web site.
http://mindfusion.eu/_samples/html_test.html

This is not what I have in mind.  I thought it would display a small image of the website.

We can include an html web page insice a c# project as these two images show.  So, how do we make use of them?



  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: html in silverlight
Reply #5 - Oct 14th, 2011 at 7:52am
Print Post  
HtmlBuilder only lets you define areas on exported diagram image that work as hyperlinks. Do you need to display html pages as part of the diagram?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint