What I got was a 10 page Powerpoint presentation with graphics. Silverlight 3 can't natively show a PPT file, so how could I do this?
First, I decided to create a "User Guide" hyperlink that would bring me out of Silverlight, and into an aspx page, here is the click event:
Uri SourceUri = new Uri(HtmlPage.Document.DocumentUri, Application.Current.Host.Source.ToString().Substring(0, Application.Current.Host.Source.ToString().IndexOf("ClientBin") - 1) + "/MSEUserGuide.aspx");
HtmlPage.Window.Navigate(SourceUri, "_blank");
Next, I would use the ASP.net AJAX SlideShow control, Joe Stagner has a nice video tutorial on using the control that I found helpful.This required a webservice with a list of images, but how to get the images from a PPT file? Easy. Open up the PPT file and choose "Save As" with your favourite image type. I chose .gif and voila - 10 images nicely numbered from 1 to 10. I then created a webservice to read in the images:
[WebMethod]
public AjaxControlToolkit.Slide[] GetSlides()
{
List slides = new List();
for (int i = 1; i <= 10; i++)
{
string fileName = string.Format("PowerPoint/Slide{0}.GIF", i.ToString());
slides.Add(new AjaxControlToolkit.Slide(fileName, string.Format("Slide {0}", i.ToString()), string.Format("Slide {0}", i.ToString())));
}
return slides.ToArray();
}
}
Finally, here is the XAML code from my MSEUserGuide.aspx page (this is the newly created page I navigate to from the click even):
No comments:
Post a Comment