Click here to Skip to main content
13,868,030 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


21 bookmarked
Posted 7 Jun 2010
Licenced CPOL

Customer Support in Silverlight

, 7 Jun 2010
Rate this:
Please Sign up or sign in to vote.
Take a screen capture of your running Silverlight app and submit it to your web server, inclusive of a lot of system information


Imagine the following:

  • You have built the world's best Silverlight twitter client, but every now and then your app crashes
  • You deployed your great Line Of Business Silverlight application, but you have no idea if people like it or not
  • Every now and then you get a phone call from your customer: "I can't see the details"
    What the??

So what do you do?

Instead of having endless support calls, email conversations, tracing in log files, lookups in log-databases, etc… use the below Feedback Control:

With this feedback control, you will get:

  1. A screenshot of what the user is looking currently at
  2. All system information like:
    1. OS version
    2. Last reboot
    3. Silverlight version
    4. Your application version
    5. …. and heaps more…


  1. We use this nice ImageTools library from Codeplex (PNGEncoder can be found there) to convert a Bitmap to PNG.
  2. The file upload is done via a nice and easy HTTPHandler on the server side that receives PNGs and saves them to a specific folder.
    More information can be found in Tim Heuer's video about Uploading files in Silverlight with source code.

How To

  1. We create a screenshot of the current Silverlight app with a WriteableBitmap:
    feedback.ScreenShot = new WriteableBitmap(this.LayoutRoot, null); 
  2. We collect system information in Silverlight with classes like:
    • Environment
    • HtmlPage.Document
    • HtmlPage.BrowserInformation
    • Application.Current.Host
    // Collect system info
    StringBuilder sbStringBuilder = new StringBuilder();
    sbStringBuilder.AppendLine("OSVersion: " + Environment.OSVersion);
    sbStringBuilder.AppendLine("System start: " + 
    sbStringBuilder.AppendLine("CLR Version: " + Environment.Version); 
  3. We upload the screen to our server by converting the WriteableBitmap to a PNG:
    ImageTools.Image image = ImageTools.ImageExtensions.ToImage(_screenShot);
    using (MemoryStream writestream = new MemoryStream())
        PngEncoder encoder = new PngEncoder();
        encoder.Encode(image, writestream);
        byte[] bytes = writestream.ToArray();
        MemoryStream readStream = new MemoryStream(bytes);

Once we have the screen and the system information on the server, we can send emails, create work-items in TFS or your favorite bug tracking system...

Using the Code

  1. Copy the Feedback control to your Silverlight app.
  2. Fix the Upload URLs
    string _baseUrl = "http://{0}/Silverlight-Feedback/UploadHandlers/"; 
  3. Download ImageTools library from Codeplex and add 3 references to your Silverlight app:
    1. ImageTools
    2. ImageTools.IO.Png
    3. ImageTools.Utils
  4. Insert the following code on your "Feedback" button or "About" button:
    // Show window and we are done
    FeedbackWindow feedback = new FeedbackWindow();
    feedback.ScreenShot = new WriteableBitmap(this.LayoutRoot, null);

All done - have fun!

Other Usages

On start up or log-off your Silverlight application, phone home and tell usage...
There is no user interaction needed to do this...
Make sure to include a privacy statement somewhere. ;-)



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Peter Gfader
Tester / Quality Assurance Zühlke
Italy Italy
Peter -hates- dislikes crap software and tries his best to improve the profession of software development. For this reason he joined The seek for improvement keeps him getting out of bed ever day... and the smell of coffee.

One day, Peter woke up and realized that software development is not only about code, but also about people: From his team mates till the end user. Some people you just give donuts and some you need to give a little bit more. Peter is on a journey to make everyone happy.

If he is not sitting on a mountainbike or playing the trumpet, you might find him at a local user group to hang out with other geeks!

Peter was born in South Tirol (Italy), studied in Austria, enjoyed a beautiful 3 years working in Sydney Australia as a .NET developer for SSW and is now working for Zuehlke Engineering AG.

I blog about .NET development, mostly about development: including C# programming, usability, performance, tips & tricks, best practices, coding problems, and solution development.

You may also be interested in...

Comments and Discussions

QuestionUpdates for WPF? Pin
kiquenet.com7-May-13 21:56
professionalkiquenet.com7-May-13 21:56 
AnswerRe: Updates for WPF? Pin
Peter Gfader10-May-13 1:47
memberPeter Gfader10-May-13 1:47 
GeneralRe: Updates for WPF? Pin
kiquenet.com16-May-13 5:06
professionalkiquenet.com16-May-13 5:06 
GeneralRe: Updates for WPF? Pin
Peter Gfader16-May-13 6:45
memberPeter Gfader16-May-13 6:45 
GeneralMy vote of 5 Pin
Chrissy Pissy Poo Poo30-Mar-11 7:27
memberChrissy Pissy Poo Poo30-Mar-11 7:27 
QuestionPlease be more constructive with your feedback :-) Pin
Peter Gfader20-Oct-10 23:53
memberPeter Gfader20-Oct-10 23:53 
General[My vote of 1] Pin
kadamjadhav17-Jul-10 19:10
memberkadamjadhav17-Jul-10 19:10 
General[My vote of 1] A two liner article Pin
chrisnicolatos456617-Jul-10 16:56
memberchrisnicolatos456617-Jul-10 16:56 
GeneralRe: [My vote of 1] A two liner article Pin
Peter Gfader17-Jul-10 18:00
memberPeter Gfader17-Jul-10 18:00 
GeneralRe: [My vote of 1] A two liner article Pin
chrisnicolatos456617-Jul-10 18:20
memberchrisnicolatos456617-Jul-10 18:20 
GeneralNot worth to be a article Pin
fretecter17-Jul-10 18:29
memberfretecter17-Jul-10 18:29 
Yes, I agree Chris.

Looks like he has copied from his current project. The TFS was also pointing to his project. The quality of codeproject articles are coming down with simple two line code turning in to articles.
GeneralRe: Not worth to be a article Pin
Peter Gfader18-Jul-10 1:14
memberPeter Gfader18-Jul-10 1:14 
GeneralRe: [My vote of 1] A two liner article Pin
Peter Gfader18-Jul-10 1:12
memberPeter Gfader18-Jul-10 1:12 
GeneralMy vote of 1( These are not article but code snippets) Pin
fretecter17-Jul-10 16:47
memberfretecter17-Jul-10 16:47 
GeneralRe: My vote of 1( These are not article but code snippets) Pin
Peter Gfader17-Jul-10 17:51
memberPeter Gfader17-Jul-10 17:51 
GeneralMy vote of 5, but ... Pin
Crusty Applesniffer15-Jun-10 1:21
memberCrusty Applesniffer15-Jun-10 1:21 
GeneralRe: My vote of 5, but ... Pin
Peter Gfader15-Jun-10 3:59
memberPeter Gfader15-Jun-10 3:59 
GeneralGreat article, brings together a lot of helpful information into one place and can simplify support Pin
Member 58337914-Jun-10 15:14
memberMember 58337914-Jun-10 15:14 
GeneralRe: Great article, brings together a lot of helpful information into one place and can simplify support Pin
Peter Gfader14-Jun-10 23:32
memberPeter Gfader14-Jun-10 23:32 
GeneralRe: Great article, brings together a lot of helpful information into one place and can simplify support Pin
Member 58337916-Jun-10 16:06
memberMember 58337916-Jun-10 16:06 
GeneralNice article Pin
linuxjr7-Jun-10 6:04
professionallinuxjr7-Jun-10 6:04 
GeneralNice idea actually Pin
Sacha Barber7-Jun-10 3:18
mvaSacha Barber7-Jun-10 3:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.190214.1 | Last Updated 7 Jun 2010
Article Copyright 2010 by Peter Gfader
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid