<?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>Sytone&#039;s Ramblings &#187; c#</title>
	<atom:link href="http://www.sytone.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sytone.com</link>
	<description>Me, Family, Life</description>
	<lastBuildDate>Sun, 20 Nov 2011 05:29:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>WPF Converter: CaseConverter</title>
		<link>http://www.sytone.com/2010/08/wpf-converter-caseconverter/</link>
		<comments>http://www.sytone.com/2010/08/wpf-converter-caseconverter/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 06:53:35 +0000</pubDate>
		<dc:creator>Sytone</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Binding]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.sytone.com/?p=256</guid>
		<description><![CDATA[ <p>Case Converter was made when I wanted the text to display in a WPF UI in upper case. Probably not the best class name, but anyway. To get the code and install read on.</p> <p></p> <p>Make any UI string uppercase. Once you have registered the resource and created the class just use the [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sytone.com%2F2010%2F08%2Fwpf-converter-caseconverter%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sytone.com%2F2010%2F08%2Fwpf-converter-caseconverter%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Case Converter was made when I wanted the text to display in a WPF UI in upper case. Probably not the best class name, but anyway. To get the code and install read on.</p>
<p><span id="more-256"></span></p>
<p>Make any UI string uppercase. Once you have registered the resource and created the class just use the converter in the element you want converted.</p>
<pre>&lt;TextBlock Text="{Binding Title, Converter={StaticResource CaseConverter}}"/&gt;</pre>
<p>Add the following element to the XAML, usually in Window.Resources and ensure that you have registered your namespace for local to the namespace of your application. e.g. <em>xmlns:local=&#8221;clr-namespace:ExampleApp&#8221;</em></p>
<pre>&lt;local:CaseConverter x:Key="CaseConverter" /&gt;</pre>
<p>This is the class, short and sweet.</p>
<pre class="brush:csharp">    public class CaseConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string text = value as string;
            if(text != null)
            {
                return text.ToUpper(culture);
            }

            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }
    }</pre>
<div class="shr-publisher-256"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F08%2Fwpf-converter-caseconverter%2F' data-shr_title='WPF+Converter%3A+CaseConverter'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F08%2Fwpf-converter-caseconverter%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F08%2Fwpf-converter-caseconverter%2F' data-shr_title='WPF+Converter%3A+CaseConverter'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.sytone.com/2010/08/wpf-converter-caseconverter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Getting the Central Admin URL for a Farm in SharePoint</title>
		<link>http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/</link>
		<comments>http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 00:53:55 +0000</pubDate>
		<dc:creator>Sytone</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.sytone.com/?p=242</guid>
		<description><![CDATA[ <p>I recently needed to get the Url of the CA for a SharePoint farm, after a bit of hunting in the API it was tracked down under the SPAdministrationWebApplication object.</p> C# SPAdministrationWebApplication caWebApp = Microsoft.SharePoint.Administration.SPAdministrationWebApplication.Local; var url = caWebApp.Sites[0].Url; PowerShell $caWebApp = [Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sytone.com%2F2010%2F07%2Fgetting-the-central-admin-url-for-a-farm-in-sharepoint%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sytone.com%2F2010%2F07%2Fgetting-the-central-admin-url-for-a-farm-in-sharepoint%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignright" src="http://farm1.static.flickr.com/5/10700151_e80d4f8b0f_m.jpg" alt="Toy Car" width="101" height="76" />I recently needed to get the Url of the CA for a SharePoint farm, after a bit of hunting in the API it was tracked down under the SPAdministrationWebApplication object.</p>
<h3>C#</h3>
<pre class="brush: csharp; title: ; notranslate">
SPAdministrationWebApplication caWebApp = Microsoft.SharePoint.Administration.SPAdministrationWebApplication.Local;
var url = caWebApp.Sites[0].Url;
</pre>
<h3>PowerShell</h3>
<pre class="brush: powershell; title: ; notranslate">
$caWebApp = [Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local
$caWebApp.Sites[0].Url
</pre>
<div class="shr-publisher-242"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F07%2Fgetting-the-central-admin-url-for-a-farm-in-sharepoint%2F' data-shr_title='Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F07%2Fgetting-the-central-admin-url-for-a-farm-in-sharepoint%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F07%2Fgetting-the-central-admin-url-for-a-farm-in-sharepoint%2F' data-shr_title='Getting+the+Central+Admin+URL+for+a+Farm+in+SharePoint'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.sytone.com/2010/07/getting-the-central-admin-url-for-a-farm-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>When is true not true?</title>
		<link>http://www.sytone.com/2010/05/when-is-true-not-true/</link>
		<comments>http://www.sytone.com/2010/05/when-is-true-not-true/#comments</comments>
		<pubDate>Mon, 31 May 2010 10:30:17 +0000</pubDate>
		<dc:creator>Sytone</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.sytone.com/?p=208</guid>
		<description><![CDATA[ <p>When you look at true stored in the .Net framework.</p> <p>While playing with Pex I found out a interesting fact that the bool is a byte in the MSIL. Which means that a bool could be euqal to anything on the byte range&#8230; Now this would require you to go out of your [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sytone.com%2F2010%2F05%2Fwhen-is-true-not-true%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sytone.com%2F2010%2F05%2Fwhen-is-true-not-true%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>When you look at true stored in the .Net framework.</p>
<p>While playing with Pex I found out a interesting fact that the bool is a byte in the MSIL. Which means that a bool could be euqal to anything on the byte range&#8230; Now this would require you to go out of your way and create unsafe code blocks to do this. Why you would do this&#8230; No ideas <img src='http://www.sytone.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Its marked as a no-fix which is not supprising as I would not fix it either becase as they say, if you know about this and you use it then you are on your own..</p>
<p><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=455553&amp;wa=wsignin1.0">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=455553&amp;wa=wsignin1.0</a></p>
<p><a href="http://blog.dotnetwiki.org/2009/05/29/TamingThePexBeastWellbehavedEnumsMultidimensionalArraysAndBooleans.aspx">http://blog.dotnetwiki.org/2009/05/29/TamingThePexBeastWellbehavedEnumsMultidimensionalArraysAndBooleans.aspx</a></p>
<div class="shr-publisher-208"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F05%2Fwhen-is-true-not-true%2F' data-shr_title='When+is+true+not+true%3F+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F05%2Fwhen-is-true-not-true%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F05%2Fwhen-is-true-not-true%2F' data-shr_title='When+is+true+not+true%3F+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.sytone.com/2010/05/when-is-true-not-true/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a Outlook MailItem from a Ribbon Event</title>
		<link>http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/</link>
		<comments>http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 10:01:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[outlook]]></category>

		<guid isPermaLink="false">http://www.sytone.com/?p=167</guid>
		<description><![CDATA[ <p>You may find this code block handy:</p> /// /// Gets the mail item selected in the explorer view if one is selected or instance if that is the view active. /// /// The instance containing the event data. /// A Outlook.MailItem for the mail being viewed. private Outlook.MailItem GetMailItem(RibbonControlEventArgs e) { // Check to [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sytone.com%2F2010%2F02%2Fgetting-a-outlook-mailitem-from-a-ribbon-event%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sytone.com%2F2010%2F02%2Fgetting-a-outlook-mailitem-from-a-ribbon-event%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>You may find this code block handy:</p>
<pre class="brush:csharp">        ///
        /// Gets the mail item selected in the explorer view if one is selected or instance if that is the view active.
        ///
        ///
The  instance containing the event data.
        /// A Outlook.MailItem for the mail being viewed.
        private Outlook.MailItem GetMailItem(RibbonControlEventArgs e)
        {
            // Check to see if a item is select in explorer or we are in inspector.
            if (e.Control.Context is Outlook.Inspector)
            {
                Outlook.Inspector inspector = (Outlook.Inspector)e.Control.Context;

                if (inspector.CurrentItem is Outlook.MailItem)
                {
                    return inspector.CurrentItem as Outlook.MailItem;
                }
            }

            if (e.Control.Context is Outlook.Explorer)
            {
                Outlook.Explorer explorer = (Outlook.Explorer)e.Control.Context;

                Outlook.Selection selectedItems = explorer.Selection;
                if (selectedItems.Count != 1)
                {
                    return null;
                }

                if (selectedItems[1] is Outlook.MailItem)
                {
                    return selectedItems[1] as Outlook.MailItem;
                }
            }

            return null;
        }</pre>
<div class="shr-publisher-167"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F02%2Fgetting-a-outlook-mailitem-from-a-ribbon-event%2F' data-shr_title='Getting+a+Outlook+MailItem+from+a+Ribbon+Event'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F02%2Fgetting-a-outlook-mailitem-from-a-ribbon-event%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.sytone.com%2F2010%2F02%2Fgetting-a-outlook-mailitem-from-a-ribbon-event%2F' data-shr_title='Getting+a+Outlook+MailItem+from+a+Ribbon+Event'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.sytone.com/2010/02/getting-a-outlook-mailitem-from-a-ribbon-event/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.sytone.com @ 2012-02-07 03:10:17 by W3 Total Cache -->
