<?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>TechBlog &#187; 2009</title>
	<atom:link href="http://techblog.byllemos.com/tag/2009/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.byllemos.com</link>
	<description>Accelerating into the Future with Wisdom about Technology! Ingrid Byllemos</description>
	<lastBuildDate>Tue, 05 Jan 2010 00:04:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>A Tip from the old box &#8211; installing a localized Navision version on an English SBS Server</title>
		<link>http://techblog.byllemos.com/2010/01/a-tip-from-the-old-box-installing-a-localized-navision-version-on-an-english-sbs-server/</link>
		<comments>http://techblog.byllemos.com/2010/01/a-tip-from-the-old-box-installing-a-localized-navision-version-on-an-english-sbs-server/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 00:04:42 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Navision]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[Dynamics]]></category>
		<category><![CDATA[localized]]></category>
		<category><![CDATA[SBS]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=560</guid>
		<description><![CDATA[<p>Recently I have been implemented a Danish version of Dynamics Navision 2009 SP1 on an English SBS server and there I meet an old &#8220;friend&#8221;.</p>
<p>The old &#8220;friend&#8221; was a problem with the Danish letter Ø. The letter was displayed&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Recently I have been implemented a Danish version of Dynamics Navision 2009 SP1 on an English SBS server and there I meet an old &#8220;friend&#8221;.</p>
<p>The old &#8220;friend&#8221; was a problem with the Danish letter Ø. The letter was displayed as Ȼ which is not the right sign (actually the data was also corrupt <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />  ). At first side everything looked fine in the regional settings and the language was set to Danish &#8211; but then I looked on the Advance page and voilá there we had the answer. Code Page 850 was not selected.<br />
<span id="more-560"></span><br />
After a selection of the code page and a reboot of the server, the letter Ø was now displayed correctly. Yeah! </p>
<p>This did though not solve all my problems. Unfortunately the data was been corrupted, due to the wrong code page. Luckily this was a new installation of Navision, so all I had to do was restore my locally build database again. </p>
<p>This was a new installation of Navision and not an Upgrade. If this had not been the case, it would have been necessary to correct the data &#8220;manually&#8221;. DOH! Not an ideal situation.</p>
<p>This time I was Lucky – next time I might not be so lucky. So in the future, I will personally check the regional settings before restoring the database. </p>
<p>So &#8211; always remember to check the regional settings, before you are restoring a localized Navision Database. You might else run into the same problems as I did.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2010/01/a-tip-from-the-old-box-installing-a-localized-navision-version-on-an-english-sbs-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hey&#8230; where are my menu items?</title>
		<link>http://techblog.byllemos.com/2009/10/hey-where-are-my-menu-items/</link>
		<comments>http://techblog.byllemos.com/2009/10/hey-where-are-my-menu-items/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 20:27:19 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Navision]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[5.01]]></category>
		<category><![CDATA[Menu Item]]></category>
		<category><![CDATA[Navigation Pane]]></category>
		<category><![CDATA[Shortcut]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=524</guid>
		<description><![CDATA[<p>Today I had a funny error &#8211; my menu items in the navigation pane did disappear if I made shortcuts to them.</p>
<p>Therefore I did some testing and here is what a figured out:</p>
<ol>
<li> Open a fresh client</li></ol><p>&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Today I had a funny error &#8211; my menu items in the navigation pane did disappear if I made shortcuts to them.</p>
<p>Therefore I did some testing and here is what a figured out:</p>
<ol>
<li> Open a fresh client</li>
<li> Add shortcuts to a menu item or a menu group</li>
<li> Check shortcuts &#8211; they were created fine</li>
<p><span id="more-524"></span></p>
<li> Check menu items &#8211; they are also still here</li>
<li> Now close the client</li>
<li> Open a fresh client</li>
<li> Check shortcuts &#8211; they are still there</li>
<li> Check menu items and they are now disappeared&#8230;&nbsp; <span style="color: #ff0000;">huh what happenend here???</span></li>
</ol>
<p>If I now want to restore the missing menu item &#8211; I unfortunately has to clear the users record in &#8220;User Menu Level&#8221;. Not a ideal situation!</p>
<p>So what to do? Don&#8217;t bother looking into you code; it is not a code error. After some searching I did find out that this a known error Navision.</p>
<p>This error affects NAV 2009 and NAV 5.0 SP1 and you can get a hot fix from Microsoft. Just locate the article with id. 970545 &#8211; here the problem is described and you will also be able to get a hot fix.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2009/10/hey-where-are-my-menu-items/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RoleTailored Client &#8211; Where is the Default Page?</title>
		<link>http://techblog.byllemos.com/2009/10/roletailored-client-default-page/</link>
		<comments>http://techblog.byllemos.com/2009/10/roletailored-client-default-page/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 20:10:18 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Navision]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[Page]]></category>
		<category><![CDATA[RoleTailored Client]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=511</guid>
		<description><![CDATA[<p>Have you also been wondering about which page are the default page, where to set it up and what to do if a user should have a different page.</p>
<p>Well&#8230; it is actually pretty easy <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Have you also been wondering about which page are the default page, where to set it up and what to do if a user should have a different page.</p>
<p>Well&#8230; it is actually pretty easy <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
&nbsp;</p>
<p>1) What is the default page? The default page is usually page 9006 &#8220;Order Processor Role Center&#8221;.</p>
<p>So how did I find it out? Well I think like a developer &#8211; so why use forms, when you can go straight into tables <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> <span id="more-511"></span></p>
<p>In table 2000000072 Profile you can locate the different profiles. Each profile has a startup Page attached. Furthermore you can also locate a field called &#8220;Default Role Center&#8221;. All you now have to do is set a filter on this field and viola you have discovered the default page.</p>
<p>Btw. the correct way would properly be Administration -&gt; Application Setup -&gt; RoleTailored Client -&gt; Profiles<br />
&nbsp;</p>
<p>2) Where do I set it up?</p>
<p>Well haven&#8217;t I already answered it??? If not &#8211; all I have to say is Profiles&#8230;.<br />
&nbsp;</p>
<p>3) How to give a user a different start up page? Use Profiles and &#8220;User Personalization&#8221;</p>
<p>Ok &#8211; I have in 1) already described Profiles &#8211; so before going into &#8220;User Personalization&#8221; be sure, that you have defined a new (or reused) a user specific profile.&nbsp;</p>
<p>Next go into &#8220;User Personalization&#8221; and attach a profile to your user by filling &#8220;Profile ID&#8221; &#8211; that&#8217;s all, now has the specific user a new start up page.</p>
<p>Where to find &#8220;User Personalization&#8221;? Go into either table 2000000073 &#8220;User Personalization&#8221; or the clean way <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Administration -&gt; Application Setup -&gt; RoleTailored Client -&gt; User Personalization</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2009/10/roletailored-client-default-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NAV 2009 SP1 &#8211; Using the RSS reader Add-In</title>
		<link>http://techblog.byllemos.com/2009/10/using-the-rss-reader-add-in/</link>
		<comments>http://techblog.byllemos.com/2009/10/using-the-rss-reader-add-in/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 19:02:31 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Navision]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[Add-Ins]]></category>
		<category><![CDATA[Page]]></category>
		<category><![CDATA[RoleTailored Client]]></category>
		<category><![CDATA[RTC]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=490</guid>
		<description><![CDATA[<p>In the previous article we created a RSS reader Add-In, now let us take a look on how to use it from navision (RoleTailored Client).</p>
<p>First we must make it possible for navision to see it. This is done by&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>In the previous article we created a RSS reader Add-In, now let us take a look on how to use it from navision (RoleTailored Client).</p>
<p>First we must make it possible for navision to see it. This is done by adding the dll&#8217;s information to the table 2000000069 Client Add-in.</p>
<p>Before we are doing this we need to be sure that the dll is in the add-ins folder and we need to know the public key for the dll.</p>
<p>Okay &#8211; first locate the folder C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client\Add-ins and make sure the file naviRss.dll is located there.</p>
<p><span id="more-490"></span></p>
<p>Next we have to find the public key. This is done by using the Visual Studio Command Prompt. Change to the Add-ins directory and run the command sn -T naviRss.dll</p>
<p><img src="http://techblog.byllemos.com/wp-content/naviRss-VS1.jpg" alt="naviRss-VS" title="naviRss-VS" width="519" height="233" class="aligncenter size-full wp-image-493" /></p>
<p>This command returns the public key &#8211; which is c172ecf10f26d3ea.</p>
<p>Next is to add the DLL to the table 2000000069 Client Add-in in navision. You only have to fill Control Add-in Name and Public Key Token</p>
<p><img src="http://techblog.byllemos.com/wp-content/naviRss-ClientAddIn.JPG" alt="naviRss-ClientAddIn" title="naviRss-ClientAddIn" width="486" height="162" class="aligncenter size-full wp-image-494" /></p>
<p>By adding the DLL to the table, we are now able to call it from a page.</p>
<p>Create a new page &#8211; ex. naviRss. The sourcetable for the page is RSS &#8211; it is a new table, that contains the different RSS urls</p>
<p>The Page could look like this:</p>
<p><img src="http://techblog.byllemos.com/wp-content/naviRss-Page.JPG" alt="naviRss-Page" title="naviRss-Page" width="584" height="174" class="aligncenter size-full wp-image-496" /></p>
<p>If we take a look on the Feed control &#8211; you can see that it is bound to the variable Parameters, which is set in OnAfterGetrecord:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow">
Parameters := 'rss_url='+&quot;Rss Feed Url&quot;+
              '¤no_feeds='+FORMAT<span class="br0">&#40;</span>&quot;No Feeds&quot;<span class="br0">&#41;</span>+
              '¤show_description='+FORMAT<span class="br0">&#40;</span>&quot;Show Description&quot;<span class="br0">&#41;</span>;</div></pre><!--END_DEVFMTCODE--><br />
This is the Parameters, the function GetParameter (RssControl.cs) is collecting.</p>
<p></p>
<p>Until now the Feed is still not linked to the naviRss.dll &#8211; this is done in the properties for the Feed control.</p>
<p>In the properties locate ControlAddIn, here you should add naviRss.</p>
<p><img src="http://techblog.byllemos.com/wp-content/naviRss-Page-Feed-Prop.JPG" alt="naviRss-Page-Feed-Prop" title="naviRss-Page-Feed-Prop" width="498" height="191" class="aligncenter size-full wp-image-497" /></p>
<p>That&#8217;s all &#8211; now the page is ready for testing <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><img src="http://techblog.byllemos.com/wp-content/naviRss-Page-Test1.JPG" alt="naviRss-Page-Test" title="naviRss-Page-Test" width="95%" height="95%" class="aligncenter size-full wp-image-502" /></p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2009/10/using-the-rss-reader-add-in/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>RSS Reader Add-In for the RoleTailored Client</title>
		<link>http://techblog.byllemos.com/2009/10/rss-reader-add-in/</link>
		<comments>http://techblog.byllemos.com/2009/10/rss-reader-add-in/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 20:36:27 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Navision]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[Add-Ins]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[RoleTailored Client]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[RTC]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=467</guid>
		<description><![CDATA[<p>Add-Ins are used to add new features to the RoleTailored Client and was introduced with NAV 2009 SP1.</p>
<p>I have previous written about a ASP.NET RSS reader &#8211; in that article, the collection of feeds was a C# function, so&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Add-Ins are used to add new features to the RoleTailored Client and was introduced with NAV 2009 SP1.</p>
<p>I have previous written about a ASP.NET RSS reader &#8211; in that article, the collection of feeds was a C# function, so why not use this function to extend the RoleTailored Client.</p>
<p>I will be using Visual Studio 2008 to write a Dynamic Link Library (dll), but you can also use the free Express version of Visual C#.</p>
<p>Let&#8217;s start by creating a new project &#8211; a class library. I have chosen to call it naviRSS.<br />
<span id="more-467"></span><br />
Add-In libraries must be strong signed, therefor go into properties -&gt; Signing. Here we are going to create a new key.</p>
<ul>
<li>Mark Sign the assemply</li>
<li>Chose to create a new strong key</li>
<li>Fill the Key file name
<ul>
<ol>
<img class="aligncenter size-full wp-image-470" title="naviRss-StrongKey" src="http://techblog.byllemos.com/wp-content/naviRss-StrongKey.JPG" alt="naviRss-StrongKey" width="70%" height="70%" /></ol>
</ul>
</li>
</ul>
<p>Now the signing page should look something like this:</p>
<p><img class="aligncenter size-full wp-image-468" title="naviRSS-Signing" src="http://techblog.byllemos.com/wp-content/naviRSS-Signing.JPG" alt="naviRSS-Signing" width="95%" height="95%" /></p>
<p>We have now signed the project, so next is to add the needed references to the project. Add the following references:</p>
<ul>
<li>System.Windows.Forms</li>
<li>System.Drawing</li>
<li>Microsoft.Dynamics.Framework.UI.Extensibility</li>
</ul>
<p>Microsoft.Dynamics.Framework.UI.Extensibility is a dll file that usually can be located here: C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client.</p>
<p>Finally we have the initial settings in place and are ready to handle the &#8220;real&#8221; code.</p>
<p>We will be using 3 items:</p>
<ul>
<li>RssControl.cs</li>
<li>RssFeeds.html</li>
<li>RssFeeds.cs</li>
</ul>
<p>Rename the default class1.cs to RssControl.cs (or delete it and create a new one <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</p>
<p>The RssControl will be containing the following functions:</p>
<ul>
<li>public RssControl(string template)
<ul>
<li>is the constructor to handle the integration with RSS Feeds</li>
</ul>
</li>
<li>void RssControl_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
<ul>
<li>what should happend when the html document is loaded</li>
</ul>
</li>
<li>public override string Text
<ul>
<li>updates some variables in the html document</li>
</ul>
</li>
<li>private string GetParameter(string parm, string defaultvalue)
<ul>
<li>gets the paramenters which are set from navision</li>
</ul>
</li>
<li>private string GetFeed(string rssURL, int maxItems, int showDesc)
<ul>
<li>is the GetFeed functions, that already is known from a earlier article</li>
</ul>
</li>
</ul>
<p>The complete RssControl.cs will look like this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow">using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Dynamics.Framework.UI.Extensibility;
using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;
&nbsp;
&nbsp;
namespace naviRss
<span class="br0">&#123;</span>
&nbsp;
    public class RssControl : WebBrowser
    <span class="br0">&#123;</span>
        private string template;
        private string text;
        private string html = &quot;&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
&nbsp;
        public RssControl<span class="br0">&#40;</span>string template<span class="br0">&#41;</span>
        <span class="br0">&#123;</span>
            this.template = template;
            this.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler<span class="br0">&#40;</span>RssControl_DocumentCompleted<span class="br0">&#41;</span>;
        <span class="br0">&#125;</span>
&nbsp;
        void RssControl_DocumentCompleted<span class="br0">&#40;</span>object sender, WebBrowserDocumentCompletedEventArgs e<span class="br0">&#41;</span>
        <span class="br0">&#123;</span>
            if <span class="br0">&#40;</span>this.DocumentText != this.html<span class="br0">&#41;</span>
            <span class="br0">&#123;</span>
                this.DocumentText = this.html;
            <span class="br0">&#125;</span>
        <span class="br0">&#125;</span>
&nbsp;
        public override string Text
        <span class="br0">&#123;</span>
            get
            <span class="br0">&#123;</span>
                return text;
            <span class="br0">&#125;</span>
            set
            <span class="br0">&#123;</span>
                if <span class="br0">&#40;</span>text != value<span class="br0">&#41;</span>
                <span class="br0">&#123;</span>
                    text = value;
                    if <span class="br0">&#40;</span>string.IsNullOrEmpty<span class="br0">&#40;</span>value<span class="br0">&#41;</span><span class="br0">&#41;</span>
                    <span class="br0">&#123;</span>
                        html = &quot;&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
                    <span class="br0">&#125;</span>
                    else
                    <span class="br0">&#123;</span>
                        string rss_url = GetParameter<span class="br0">&#40;</span>&quot;rss_url&quot;, &quot;0&quot;<span class="br0">&#41;</span>;
&nbsp;
                        Int16 no_feeds = <span style="">0</span>;
                        Int16.TryParse<span class="br0">&#40;</span>GetParameter<span class="br0">&#40;</span>&quot;no_feeds&quot;, &quot;0&quot;<span class="br0">&#41;</span>, out no_feeds<span class="br0">&#41;</span>;
&nbsp;
                        string show_desc = GetParameter<span class="br0">&#40;</span>&quot;show_description&quot;, &quot;1&quot;<span class="br0">&#41;</span>;
&nbsp;
                        string feeds = &quot;&quot;;
                        if <span class="br0">&#40;</span>show_desc == &quot;true&quot; || show_desc == &quot;1&quot;<span class="br0">&#41;</span>
                            feeds = GetFeed<span class="br0">&#40;</span>rss_url, no_feeds, 1<span class="br0">&#41;</span>;
                        else
                            feeds = GetFeed<span class="br0">&#40;</span>rss_url, no_feeds, 0<span class="br0">&#41;</span>;
&nbsp;
                        html = this.template;
                        html = html.Replace<span class="br0">&#40;</span>&quot;%rss_url%&quot;, rss_url<span class="br0">&#41;</span>;
                        html = html.Replace<span class="br0">&#40;</span>&quot;%no_feeds%&quot;, no_feeds.ToString<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                        html = html.Replace<span class="br0">&#40;</span>&quot;%show_description%&quot;, show_desc<span class="br0">&#41;</span>;
                        html = html.Replace<span class="br0">&#40;</span>&quot;%feeds%&quot;, feeds<span class="br0">&#41;</span>;
                    <span class="br0">&#125;</span>
                    this.DocumentText = html;
                <span class="br0">&#125;</span>
            <span class="br0">&#125;</span>
        <span class="br0">&#125;</span>
&nbsp;
        private string GetParameter<span class="br0">&#40;</span>string parm, string defaultvalue<span class="br0">&#41;</span>
        <span class="br0">&#123;</span>
            foreach <span class="br0">&#40;</span>string parameter in text.Split<span class="br0">&#40;</span>'¤'<span class="br0">&#41;</span><span class="br0">&#41;</span>
            <span class="br0">&#123;</span>
                if <span class="br0">&#40;</span>parameter.StartsWith<span class="br0">&#40;</span>parm + &quot;=&quot;<span class="br0">&#41;</span><span class="br0">&#41;</span>
                <span class="br0">&#123;</span>
                    return parameter.Substring<span class="br0">&#40;</span>parm.Length + 1<span class="br0">&#41;</span>;
                <span class="br0">&#125;</span>
            <span class="br0">&#125;</span>
            return defaultvalue;
        <span class="br0">&#125;</span>
&nbsp;
        private string GetFeed<span class="br0">&#40;</span>string rssURL, int maxItems, int showDesc<span class="br0">&#41;</span>
        <span class="br0">&#123;</span>
            string FeedsCollected = &quot;&quot;;
&nbsp;
            System.Net.WebRequest myRequest = System.Net.WebRequest.Create<span class="br0">&#40;</span>rssURL<span class="br0">&#41;</span>;
            System.Net.WebResponse myResponse = myRequest.GetResponse<span class="br0">&#40;</span><span class="br0">&#41;</span>;
&nbsp;
            System.IO.Stream rssStream = myResponse.GetResponseStream<span class="br0">&#40;</span><span class="br0">&#41;</span>;
            System.Xml.XmlDocument rssDoc = new System.Xml.XmlDocument<span class="br0">&#40;</span><span class="br0">&#41;</span>;
            rssDoc.Load<span class="br0">&#40;</span>rssStream<span class="br0">&#41;</span>;
&nbsp;
            System.Xml.XmlNodeList rssItems = rssDoc.SelectNodes<span class="br0">&#40;</span>&quot;rss/channel/item&quot;<span class="br0">&#41;</span>;
&nbsp;
            string title = &quot;&quot;;
            string link = &quot;&quot;;
            string pub_date = &quot;&quot;;
            string desc = &quot;&quot;;
&nbsp;
            if <span class="br0">&#40;</span>maxItems == 0<span class="br0">&#41;</span>
                maxItems = rssItems.Count;
&nbsp;
            if <span class="br0">&#40;</span><span class="br0">&#40;</span>maxItems &gt; 0<span class="br0">&#41;</span> &amp;&amp; <span class="br0">&#40;</span>rssItems.Count &lt; maxItems<span class="br0">&#41;</span><span class="br0">&#41;</span>
            <span class="br0">&#123;</span>
                maxItems = rssItems.Count;
            <span class="br0">&#125;</span>
&nbsp;
            for <span class="br0">&#40;</span>int i = <span style="">0</span>; i &lt; maxItems; i++<span class="br0">&#41;</span>
            <span class="br0">&#123;</span>
                title = rssItems.Item<span class="br0">&#40;</span>i<span class="br0">&#41;</span>.SelectSingleNode<span class="br0">&#40;</span>&quot;title&quot;<span class="br0">&#41;</span>.InnerText;
                link = rssItems.Item<span class="br0">&#40;</span>i<span class="br0">&#41;</span>.SelectSingleNode<span class="br0">&#40;</span>&quot;link&quot;<span class="br0">&#41;</span>.InnerText;
                pub_date = rssItems.Item<span class="br0">&#40;</span>i<span class="br0">&#41;</span>.SelectSingleNode<span class="br0">&#40;</span>&quot;pubDate&quot;<span class="br0">&#41;</span>.InnerText;
                desc = rssItems.Item<span class="br0">&#40;</span>i<span class="br0">&#41;</span>.SelectSingleNode<span class="br0">&#40;</span>&quot;description&quot;<span class="br0">&#41;</span>.InnerText;
&nbsp;
                FeedsCollected += &quot;&lt;a href='&quot; + link + &quot;' target='new'&gt;&quot; + title + &quot;&lt;/a&gt;&lt;br/&gt;&quot;;
&nbsp;
            <span class="br0">&#125;</span>
&nbsp;
            return FeedsCollected;
        <span class="br0">&#125;</span>
    <span class="br0">&#125;</span>
&nbsp;
<span class="br0">&#125;</span>
</div></pre><!--END_DEVFMTCODE--></p>
<p>Ok &#8211; now we have all the info we need about the feeds. Next is to create a html page, which we will be using to present the feeds with. Add a new item RssFeeds.html to the project.</p>
<p>It is a pretty simple page and could look like this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML <span style="">4.0</span> Transitional//EN&quot;&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;&lt;/title&gt;
	&lt;/head&gt;
&nbsp;
	&lt;body&gt;
        	%feeds%
	&lt;/body&gt;
&lt;/html&gt;</div></pre><!--END_DEVFMTCODE--></p>
<p>Notice that we have a variable %feeds%. This variable will be updated by the function Text, that is located in the RssControl.cs.
<p />
<p>To be able to use the html page from the RoleTailored Client, we have to embed the file. This is done by adding the resource file Resources.resx to the project.</p>
<p>Then afterwards open Resources.resx and drop (drag &#038; drop) the RssFeeds.html file on it.
<p />
<p>Now all we need is to add the item RssFeeds.cs to the project (new item -> class). In RssFeeds.cs we will be handling CreateControl and AllowCaptionControl.</p>
<p>When the NAV Client needs to create the actual winforms control, it will be calling the CreateControl. By having our own CreateControl in the RssFeeds.cs &#8211; we are overriding the default method and giving it a html template instead.</p>
<p>AllowCaptionControl is used the override the default handling of captions.</p>
<p>RssFeeds.cs will look like this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow">using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Microsoft.Dynamics.Framework.UI.Extensibility;
using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;
using System.Windows.Forms;
&nbsp;
namespace naviRss
<span class="br0">&#123;</span>
&nbsp;
    <span class="br0">&#91;</span>ControlAddInExport<span class="br0">&#40;</span>&quot;naviRss&quot;<span class="br0">&#41;</span><span class="br0">&#93;</span>
    public class RssFeeds : StringControlAddInBase, IStringControlAddInDefinition
    <span class="br0">&#123;</span>
        protected override Control CreateControl<span class="br0">&#40;</span><span class="br0">&#41;</span>
        <span class="br0">&#123;</span>
            //System.Diagnostics.Debugger.Launch<span class="br0">&#40;</span><span class="br0">&#41;</span>;
            var RssWeb = new RssControl<span class="br0">&#40;</span>Resources.RssFeeds<span class="br0">&#41;</span>;
&nbsp;
            RssWeb.MinimumSize = new Size<span class="br0">&#40;</span>600, 200<span class="br0">&#41;</span>;
            RssWeb.MaximumSize = new Size<span class="br0">&#40;</span>600, 200<span class="br0">&#41;</span>;
            RssWeb.ScrollBarsEnabled = false;
            RssWeb.ScriptErrorsSuppressed = true;
            RssWeb.WebBrowserShortcutsEnabled = false;
&nbsp;
            return RssWeb;
        <span class="br0">&#125;</span>
&nbsp;
        public override bool AllowCaptionControl
        <span class="br0">&#123;</span>
            get
            <span class="br0">&#123;</span>
                return false;
            <span class="br0">&#125;</span>
        <span class="br0">&#125;</span>
    <span class="br0">&#125;</span>
<span class="br0">&#125;</span>
</div></pre><!--END_DEVFMTCODE--></p>
<p>
[ControlAddInExport("naviRss")] is used to set the &#8220;control name&#8221; for navision. In this case the Control will be known as naviRss.</p>
<p>
Everything is now in place and we are ready to build our project.
</p>
<p>
Build the project and place the naviRss.dll in the Add-Ins directory under the RoleTailored Client.
</p>
<p>
A little tip &#8211; if you don&#8217;t want to copy the dll yourself into the Add-Ins directory, then add the following commandline to post-build event commandline in the  project properties under &#8220;build events&#8221;:  </p>
<p>copy naviRss.dll &#8220;C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client\Add-ins&#8221;
</p>
<p>
All you know have to do is setting up the dll in navision and build a page to use it. This will be described in the next article.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2009/10/rss-reader-add-in/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NAV 2009 SP1 &#8211; Testing Codeunits &#8211; Part 2</title>
		<link>http://techblog.byllemos.com/2009/09/nav-2009-sp1-testing-codeunits-2/</link>
		<comments>http://techblog.byllemos.com/2009/09/nav-2009-sp1-testing-codeunits-2/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 20:39:21 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Navision]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=442</guid>
		<description><![CDATA[<p>In the earlier article, we where using the ConfirmHandler &#8211; but confirm is not everything a function can contain. So why not add the handling of Message Boxes <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>First, let us a add simple&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>In the earlier article, we where using the ConfirmHandler &#8211; but confirm is not everything a function can contain. So why not add the handling of Message Boxes <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>First, let us a add simple test message function to the previous created &#8220;doTest&#8221; codeunit. The function could look this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="cside"><div class="devcodeoverflow">
PROCEDURE TestMessage@1112800001(useWrong@1112800000 : Boolean) : Boolean;
BEGIN

  IF useWrong THEN
    MESSAGE('Wrong Message')
  ELSE
    MESSAGE('Test Ok');

  EXIT(TRUE);
END;
</div></pre><!--END_DEVFMTCODE--><br />
<span id="more-442"></span><br />
It is a simple function that opens a Message Box with either &#8220;Wrong Message&#8221; or &#8220;Test Ok&#8221; &#8211; depending of the parameter useWrong.</p>
<p>Now we must add the handling of the Message Box to the codeunit &#8220;Handler Test Functions&#8221;. Here we will be adding the functions:
<ul>
<li>Message_Ok</li>
<li>TestMessage_Ok</li>
<li>TestMessage_Ok_Error</li>
</ul>
<p>Message_Ok is the actual MessageHandler. Message_Ok is created in this way:
<ol>
<li>First add the function to the Global Vars</li>
<li>Change the property &#8220;FunctionType&#8221; for the Message_Ok function to MessageHandler.</li>
</ol>
<p>The properties for the Message_Ok function should now look like this:<br />
<center><br />
<img class="aligncenter size-full wp-image-443" title="Function_Message_Ok_Prop" src="http://techblog.byllemos.com/wp-content/Function_Message_Ok_Prop.jpg" alt="Function_Message_Ok_Prop" width="407" height="163" /></center><br />
Now it is time to add parameters to the Message_Ok function. The signatur for the MessageHandler is:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="cside"><div class="devcodeoverflow">Function <function name>(<msg> : Text[1024])</div></pre><!--END_DEVFMTCODE--></p>
<p>Therefore we will add the parameter msg. Next is to add code, that can handle the message. It could look like this:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="cside"><div class="devcodeoverflow">
[MessageHandler]
PROCEDURE Message_Ok@1112800002(Msg@1112800000 : Text[1024]);
BEGIN

  IF Msg <> 'Test Ok' THEN
    ERROR('Unexpected Msg');
END;
</div></pre><!--END_DEVFMTCODE--></p>
<p>Now you can see why i added 2 different messages to the test function. This is because I would like to test the handling of an unexpected message box.</p>
<p>Ok &#8211; the MessageHandler is now in place, so lets look on the functions to handle the Tests.<br />
Let us start by testing an Ok message &#8211; which the function TestMessage_Ok will handle.<br />
TestMessage_Ok is created in this way:
<ol>
<li>First add the function to the Global Vars</li>
<li>Change the property &#8220;FunctionType&#8221; for the TestMessage_Ok function to Test.</li>
<li>Change the property &#8220;HandlerFunctions&#8221; to &#8220;Message_Ok&#8221;</li>
</ol>
<p>The properties for the TestMessage_Ok function should now look like this:<br />
<center><br />
<img src="http://techblog.byllemos.com/wp-content/Function_TestMessage_Ok_Prop.jpg" alt="Function_TestMessage_Ok_Prop" title="Function_TestMessage_Ok_Prop" width="406" height="162" class="aligncenter size-full wp-image-445" /></center><br />
All you now have to do &#8211; is calling the TestMessage function in the doTest codeunit. You should end up with a function like this:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="cside"><div class="devcodeoverflow">
[Test]
[HandlerFunctions(Message_Ok)]
PROCEDURE TestMessage_Ok@1112800006();
VAR
  doTest@1112800000 : Codeunit 50001;
BEGIN

  IF NOT doTest.TestMessage(FALSE) THEN
    ERROR('Error in test - Ok');
END;
</div></pre><!--END_DEVFMTCODE--></p>
<p>If you repeats these steps to create the function TestMessage_Ok_Error &#8211; you could end up with a function like this:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="cside"><div class="devcodeoverflow">

[Test]
[HandlerFunctions(Message_Ok)]
PROCEDURE TestMessage_Ok_Error@1112800007();
VAR
  doTest@1112800000 : Codeunit 50001;
BEGIN

  IF NOT doTest.TestMessage(TRUE) THEN
    ERROR('Error in Test - Ok Error');
END;
</div></pre><!--END_DEVFMTCODE--></p>
<p>When you now run the &#8220;Test Runner&#8221; codeunit &#8211; the TestMessage function in to codeunit doTest will be tested. </p>
<p>If you have noticed, you can see that the function TestMessage_Ok_Error sends in a TRUE &#8211; which means, that the doTest.TestMessage will show the Message Box containing the message &#8220;Wrong Message&#8221;. The MessageHandler function though, only handles the message &#8220;Test Ok&#8221;. Therefor you will in the log see, that the first function TestMessage_Ok went well and that the second function TestMessage_Ok_Error failed.</p>
<p>The Log could look like this:<br />
<center><br />
<img src="http://techblog.byllemos.com/wp-content/Log-MessageHandler.jpg" alt="Log-MessageHandler" title="Log-MessageHandler" width="702" height="163" class="aligncenter size-full wp-image-446" /></center></p>
<p>That&#8217;s all folks &#8211; now you also can handle Message Boxes <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2009/09/nav-2009-sp1-testing-codeunits-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

