<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Akash Kava &#187; Trace</title>
	<atom:link href="http://akashkava.com/blog/tag/trace/feed/" rel="self" type="application/rss+xml" />
	<link>http://akashkava.com/blog</link>
	<description>Founder of NeuroSpeech</description>
	<lastBuildDate>Tue, 10 Apr 2012 18:00:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Enabling Tracing in Silverlight with UI Atoms</title>
		<link>http://akashkava.com/blog/307/enabling-tracing-in-silverlight-with-ui-atoms/</link>
		<comments>http://akashkava.com/blog/307/enabling-tracing-in-silverlight-with-ui-atoms/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 15:44:00 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Trace]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[UI Atoms]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/307/enabling-tracing-in-silverlight-with-ui-atoms/</guid>
		<description><![CDATA[UI Atoms 2010 v1.9 update now includes Trace API for developers to log information on screen just like normal .NET application. Diagnostics Trace API Microsoft .NET provided Trace API to help in troubleshoot problems which is of great help at time of development. But Silverlight developers are disappointed for not being able to trace in [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/307/enabling-tracing-in-silverlight-with-ui-atoms/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Enabling+Tracing+in+Silverlight+with+UI+Atoms";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F307%2Fenabling-tracing-in-silverlight-with-ui-atoms%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F307%2Fenabling-tracing-in-silverlight-with-ui-atoms%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p align="justify">UI Atoms 2010 v1.9 update now includes Trace API for developers to log information on screen just like normal .NET application.</p>
<h2 align="justify">Diagnostics Trace API</h2>
<p align="justify">Microsoft .NET provided Trace API to help in troubleshoot problems which is of great help at time of development. But Silverlight developers are disappointed for not being able to trace in Silverlight apps. However running apps on multiple platform isn’t quite easy, and different user experiences on different platforms raise unexpected issues. Such issues are difficult to resolve as deployed client computer may not have development tools available to troubleshoot and see application logs.</p>
<blockquote><p align="justify">Trace.WriteLine(“ Hello World “);</p>
</blockquote>
<p align="justify">We sure miss Trace in Silverlight, so we decided to add similar diagnostics API in Silverlight.</p>
<h2 align="justify">Trace Viewer</h2>
<p align="justify">In Silverlight, as it runs inside a browser, there is no way to see any trace information not only this, on different platforms like Mac, it may be too difficult for no technical user to install and enable remote debugging.</p>
<p align="justify">So we decided to include a visual component that can be put anywhere on screen, just like “Output” pane in visual studio. Its developer’s choice to fit the Trace Viewer. Its pretty simple Text View control, where in you can see lines of log automatically scrolling down as log grows.</p>
<h2>AtomTraceView</h2>
<p align="justify">UI Atoms’s AtomTraceView control works well with Silverlight as well as WPF, in WPF it uses inbuilt Trace functionality and displays trace information to user, and in Silverlight we have added custom API, that is used to display Trace information. Syntax is pretty simple.</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Grid</span><span class="kwrd">&gt;</span>
   <span class="kwrd">&lt;</span><span class="html">Grid.RowDefintions</span><span class="kwrd">&gt;</span>
       <span class="kwrd">&lt;</span><span class="html">RowDefinition</span><span class="kwrd">/&gt;</span>
       <span class="kwrd">&lt;</span><span class="html">RowDefinition</span> <span class="attr">Height</span><span class="kwrd">=&quot;200&quot;</span><span class="kwrd">/&gt;</span>
   <span class="kwrd">&lt;</span><span class="html">Grid.RowDefintions</span><span class="kwrd">&gt;</span>

   <span class="kwrd">&lt;</span><span class="html">MyUserControl</span><span class="kwrd">/&gt;</span>

   <span class="kwrd">&lt;</span><span class="html">AtomTraceView</span> <span class="attr">Grid</span>.<span class="attr">Row</span><span class="kwrd">=&quot;1&quot;</span><span class="kwrd">/&gt;</span>

<span class="kwrd">&lt;</span><span class="html">Grid</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p align="justify">This way you can include AtomTraceView at the bottom of your page and it will display all traces programmed by the developer.</p>
<h2 align="justify">Limited API</h2>
<p align="justify">However, .NET Trace API is very huge, and it is extensible, but Trace API offered by UI Atoms as of now is very limited, not by the design but by implications, Silverlight itself is very limited platform, this is just an Add-on for users to troubleshoot their apps.</p>
<h2>Trace Statements in Silverlight</h2>
<p>In order to write Trace statements, you have to import following namespace,</p>
<blockquote>
<p><font color="#333333">using NeuroSpeech.UIAtoms.Core;</font></p>
</blockquote>
<p>Then you can write following statements and they will appear in AtomTraceView Control.</p>
<pre class="csharpcode">AtomTrace.WriteLine(<span class="str">&quot; Hello World &quot;</span>);

AtomTrace.WriteLine( exception.ToString() );

AtomTrace.WriteLine( <span class="kwrd">string</span>.Format(<span class="str">&quot;{0},{1} Coordinates&quot;</span>, x, y) );</pre>
<p>&#160;</p>
<p>The AtomTrace class exists for both Silverlight and WPF, so it becomes easier to write your logs with AtomTrace instead of Trace, so your code can be shared on both Silverlight as well as WPF.</p>
<h2>Trace and Multithreading</h2>
<p align="justify">Trace statements can be accessed by thread in Silverlight app, however the sequence in which it will appear can not be guaranteed because it depends upon the processor and scheduling algorithm used in thread pool of Silverlight application.</p>
<h2>Custom Trace Listener</h2>
<p>Just similar to .NET, we have included&#160; AtomTraceListener class, which you can derive and customize trace information according to your need as well as it has Traced event, which you can implement and get trace notifications anywhere..</p>
<h2>&#160;</h2>
<h2>Future of Trace API in Silverlight</h2>
<p align="justify">When Trace API will be included by Microsoft in future edition of Silverlight, we may plan to remove Trace API, to be consistent with the Silverlight development workflow, this API has been enabled only to write shared code between WPF and Silverlight environment. However otherwise, we plan to make tracing more rich with UI Atoms. But for now, it is very helpful for everyone.</p>
<h2>Live Demo</h2>
<p><a href="http://go.neurospeech.com/10" target="_blank"><strong><font size="4">Click Here</font></strong></a> to see live demo of Tracing in Silverlight.</p>
<p><strong><a href="http://go.neurospeech.com/4" target="_blank"><font size="4">Click Here</font></a></strong> to download demo version of UI Atoms 2010.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fakashkava.com%2Fblog%2F307%2Fenabling-tracing-in-silverlight-with-ui-atoms%2F&amp;title=Enabling%20Tracing%20in%20Silverlight%20with%20UI%20Atoms"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/307/enabling-tracing-in-silverlight-with-ui-atoms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

