<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Jamil Rzayev&#039;s Blog</title>
	<atom:link href="http://jmroom.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jmroom.wordpress.com</link>
	<description></description>
	<lastBuildDate>Fri, 05 Dec 2008 14:19:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jmroom.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Jamil Rzayev&#039;s Blog</title>
		<link>http://jmroom.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jmroom.wordpress.com/osd.xml" title="Jamil Rzayev&#039;s Blog" />
	<atom:link rel='hub' href='http://jmroom.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Styles Dictionary</title>
		<link>http://jmroom.wordpress.com/2008/12/05/styles-dictionary/</link>
		<comments>http://jmroom.wordpress.com/2008/12/05/styles-dictionary/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 14:14:46 +0000</pubDate>
		<dc:creator>Jamil Rzayev</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://jmroom.wordpress.com/?p=57</guid>
		<description><![CDATA[Each time I build rich user window on WPF I think I have to write the same lines of code of style concept for each buttton or textbox. And the following question comes in mind: Why I don&#8217;t place all my styles in one XAML file to dynamically load them in future? For example, if [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jmroom.wordpress.com&amp;blog=5717628&amp;post=57&amp;subd=jmroom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Each time I build rich user window on WPF I think I have to write the same lines of code of style concept for each buttton or textbox. And the following question comes in mind: Why I don&#8217;t place all my styles in one XAML file to dynamically load them in future?</p>
<p>For example, if I have five buttons and each of them must have 40 in Width, 21 in Height, GradientColorBrush  as BackgroundColor, WhiteSmoke color as Foreground and Margin equals to 5. I simply can write for each button the following lines of code:</p>
<p><img class="alignnone size-full wp-image-65" title="threebuttonstylecode" src="http://jmroom.files.wordpress.com/2008/12/threebuttonstylecode.png?w=668&#038;h=489" alt="threebuttonstylecode" width="668" height="489" /></p>
<p>It is easy to understand that writing for each cotrol separate style code will blow our XAML file and you as a developer willl have to spend much more time to cover all UI code in future.</p>
<p>WPF allows us to create special XAML file for filling it with styles and load them as we need.</p>
<p>Such type of file is named ResourceDictionary. It is basic XAML file with following header:</p>
<p><img class="alignnone size-full wp-image-67" title="styledictionaryheadercode" src="http://jmroom.files.wordpress.com/2008/12/styledictionaryheadercode.png?w=713&#038;h=68" alt="styledictionaryheadercode" width="713" height="68" /></p>
<p>Then we write special lines of code for each style. using <em>Style</em> tag into that file between <em>ResourceDictionary</em> tags. For each important property which I want to assign a value I use <em>Setter</em> tag with <em>Property</em> and <em>Value</em> attributes.</p>
<p><img class="alignnone" title="stylecode" src="http://jmroom.files.wordpress.com/2008/12/stylecode.png?w=611&#038;h=252" alt="" width="611" height="252" /></p>
<p>That is all I need to do. For the moment I make some changes in window xaml code by using in each control declaration <strong>Style</strong> poperty and assign to it name of style. i only use Style tag and any additional attrubutes are deleted.</p>
<blockquote><p><span style="color:#ff0000;">Style</span>=<span style="color:#0000ff;">&#8220;</span><span style="color:#0000ff;">{</span><span style="color:#f24d0c;">DynamicResource</span> <span style="color:#ff0000;">ButtonStyle</span><span style="color:#0000ff;">}&#8221;</span></p></blockquote>
<p>At last to make it work correctly I put code to App.xaml file to load styles at application startup. I put file with styles in separate folder Styles.</p>
<p><img class="alignnone" title="appxamlcodeaddition" src="http://jmroom.files.wordpress.com/2008/12/appxamlcodeaddition.png?w=742&#038;h=115" alt="" width="742" height="115" /></p>
<p>That technique requires a bit more time to be accustomed with dictionaries but in <em>everyday practice </em>it reduces great time of development<em>. </em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jmroom.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jmroom.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jmroom.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jmroom.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jmroom.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jmroom.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jmroom.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jmroom.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jmroom.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jmroom.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jmroom.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jmroom.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jmroom.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jmroom.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jmroom.wordpress.com&amp;blog=5717628&amp;post=57&amp;subd=jmroom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jmroom.wordpress.com/2008/12/05/styles-dictionary/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9f51112ff22f2e6228d5dd6c8e59e960?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jamilrzayev</media:title>
		</media:content>

		<media:content url="http://jmroom.files.wordpress.com/2008/12/threebuttonstylecode.png" medium="image">
			<media:title type="html">threebuttonstylecode</media:title>
		</media:content>

		<media:content url="http://jmroom.files.wordpress.com/2008/12/styledictionaryheadercode.png" medium="image">
			<media:title type="html">styledictionaryheadercode</media:title>
		</media:content>

		<media:content url="http://jmroom.files.wordpress.com/2008/12/stylecode.png" medium="image">
			<media:title type="html">stylecode</media:title>
		</media:content>

		<media:content url="http://jmroom.files.wordpress.com/2008/12/appxamlcodeaddition.png" medium="image">
			<media:title type="html">appxamlcodeaddition</media:title>
		</media:content>
	</item>
		<item>
		<title>Common solution for cross-thread problem on WinForms</title>
		<link>http://jmroom.wordpress.com/2008/12/04/common-solution-for-cross-thread-operations-on-winforms/</link>
		<comments>http://jmroom.wordpress.com/2008/12/04/common-solution-for-cross-thread-operations-on-winforms/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 14:16:28 +0000</pubDate>
		<dc:creator>Jamil Rzayev</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[threads]]></category>
		<category><![CDATA[win32forms]]></category>

		<guid isPermaLink="false">http://jmroom.wordpress.com/?p=12</guid>
		<description><![CDATA[Last two months I write on C# for my new project. Several days ago I needed to implement asynchronous invokation of EventHandler at button click. by using new instance of EventHandler I wrote needed code with lambda expression for AsyncCallBack. But, unfortunately, my code crashed.  After first application running I received following message after button clicking: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jmroom.wordpress.com&amp;blog=5717628&amp;post=12&amp;subd=jmroom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last two months I write on C# for my new project. Several days ago I needed to implement asynchronous invokation of EventHandler at button click. by using new instance of EventHandler I wrote needed code with lambda expression for AsyncCallBack. But, unfortunately, my code crashed. </p>
<p><img class="alignnone" title="Cross Thread Code Example " src="http://jmroom.files.wordpress.com/2008/12/codeexmpl1.png?w=661&#038;h=200" alt="" width="661" height="200" /></p>
<p>After first application running I received following message after button clicking:</p>
<p style="padding-left:30px;"><a href="http://jmroom.files.wordpress.com/2008/12/crossthreaderrormsgpic1.png"><img class="alignnone size-full wp-image-21" title="crossthreaderrormsgpic1" src="http://jmroom.files.wordpress.com/2008/12/crossthreaderrormsgpic1.png?w=454&#038;h=67" alt="crossthreaderrormsgpic1" width="454" height="67" /></a></p>
<p style="padding-left:30px;"> </p>
<p>At MSDN forum I found solution for that exception and they were used BackgroundWorker. </p>
<p><a class="aligncenter" title="Make Thread-Safe Calls to Windows Forms Controls" href="http://msdn.microsoft.com/en-us/library/ms171728.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms171728.aspx</a></p>
<p>But if you have many different methods which must change some properties of controls on your form that technique is not acceptable. I realized that I would be nice <strong><em>to provide only name of appropriate method</em></strong> in my form&#8217;s class and to run it asynchronously.</p>
<p>My idea is acceptable <strong>only for C# 3.0</strong> because I use <em>extension methods. </em></p>
<p>For example, we can create new class named ExtHelper and implement one single method named SafeCall.</p>
<div id="attachment_28" class="wp-caption alignnone" style="width: 797px"><a href="http://jmroom.files.wordpress.com/2008/12/exthelperclass.png"><img class="size-full wp-image-28 " title="exthelperclass" src="http://jmroom.files.wordpress.com/2008/12/exthelperclass.png?w=787&#038;h=396" alt="Static class to implement extension method" width="787" height="396" /></a><p class="wp-caption-text">Static class to implement extension method</p></div>
<p>Now I can use the method SafeCall in my AsyncCallback delegate to invoke needed methods.<br />
For example, I have methods named Do, Do2.<br />
<a href="http://jmroom.files.wordpress.com/2008/12/usingextensionmethod.png"><img class="alignnone size-full wp-image-33" title="usingextensionmethod" src="http://jmroom.files.wordpress.com/2008/12/usingextensionmethod.png?w=666&#038;h=405" alt="usingextensionmethod" width="666" height="405" /></a></p>
<p>That mehods carry out simple gui-based operations but they distinctly show the solution&#8217;s principle.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jmroom.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jmroom.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jmroom.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jmroom.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jmroom.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jmroom.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jmroom.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jmroom.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jmroom.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jmroom.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jmroom.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jmroom.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jmroom.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jmroom.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jmroom.wordpress.com&amp;blog=5717628&amp;post=12&amp;subd=jmroom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jmroom.wordpress.com/2008/12/04/common-solution-for-cross-thread-operations-on-winforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9f51112ff22f2e6228d5dd6c8e59e960?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jamilrzayev</media:title>
		</media:content>

		<media:content url="http://jmroom.files.wordpress.com/2008/12/codeexmpl1.png" medium="image">
			<media:title type="html">Cross Thread Code Example </media:title>
		</media:content>

		<media:content url="http://jmroom.files.wordpress.com/2008/12/crossthreaderrormsgpic1.png" medium="image">
			<media:title type="html">crossthreaderrormsgpic1</media:title>
		</media:content>

		<media:content url="http://jmroom.files.wordpress.com/2008/12/exthelperclass.png" medium="image">
			<media:title type="html">exthelperclass</media:title>
		</media:content>

		<media:content url="http://jmroom.files.wordpress.com/2008/12/usingextensionmethod.png" medium="image">
			<media:title type="html">usingextensionmethod</media:title>
		</media:content>
	</item>
		<item>
		<title>Intro</title>
		<link>http://jmroom.wordpress.com/2008/12/02/hello-world/</link>
		<comments>http://jmroom.wordpress.com/2008/12/02/hello-world/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 15:08:09 +0000</pubDate>
		<dc:creator>Jamil Rzayev</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[intro]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome. My name is Jamil Rzayev. This blog is about all in programming world. As I like .Net technology I will start with it.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jmroom.wordpress.com&amp;blog=5717628&amp;post=1&amp;subd=jmroom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome. My name is Jamil Rzayev.</p>
<p>This blog is about all in programming world. As I like .Net technology I will start with it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jmroom.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jmroom.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jmroom.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jmroom.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jmroom.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jmroom.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jmroom.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jmroom.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jmroom.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jmroom.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jmroom.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jmroom.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jmroom.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jmroom.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jmroom.wordpress.com&amp;blog=5717628&amp;post=1&amp;subd=jmroom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jmroom.wordpress.com/2008/12/02/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9f51112ff22f2e6228d5dd6c8e59e960?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jamilrzayev</media:title>
		</media:content>
	</item>
	</channel>
</rss>
