<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Mark Prentice </title><link>http://blogs.msdn.com/markprenticems/default.aspx</link><description>Developing Device Solutions using .NET Compact Framework</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>WCF for NETCF Beta2 Update</title><link>http://blogs.msdn.com/markprenticems/archive/2007/09/08/wcf-for-netcf-beta2-update.aspx</link><pubDate>Sat, 08 Sep 2007 02:11:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4818149</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/4818149.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=4818149</wfw:commentRss><description>&lt;p&gt;Lately, I've been working on getting my WCF for NETCF hello world&amp;nbsp;BLOG posts (&lt;a href="http://blogs.msdn.com/markprenticems/archive/2007/03/27/introduction-to-windows-communication-foundation-for-the-net-compact-framework-messaging-stack.aspx"&gt;Intro to Messaging&lt;/a&gt; and the Intro to &lt;a href="http://blogs.msdn.com/markprenticems/archive/2007/04/25/introduction-to-the-windows-communication-foundation-for-the-net-compact-framework-store-and-forward-messaging.aspx"&gt;Store and Forward Messaging&lt;/a&gt;)&amp;nbsp;&amp;nbsp;prepared for inclusion into Orcas.&amp;nbsp; I have both examples running and debugging with Orcas Beta2&amp;nbsp;and NETCF v3.5 Beta2.&amp;nbsp; The code has not changed much from the original Blog posts (I did fix a coding error).&amp;nbsp; I've back updated the two BLOG posts with the current code taken from the samples.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4818149" width="1" height="1"&gt;</description></item><item><title>Store and Forward Channel Beta1... Take Two!</title><link>http://blogs.msdn.com/markprenticems/archive/2007/05/29/store-and-forward-channel-beta1-take-two.aspx</link><pubDate>Wed, 30 May 2007 01:17:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2976119</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/2976119.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=2976119</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1343d537-a62f-4a6e-9727-7791bf4cc2bd&amp;amp;DisplayLang=en"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The .NET Compact Framework v3.5 Beta1 was shipped in Orcas Beta1 allowing developers to try out NETCF's new features, except for the Store and Forward Transport which has a strong name signing issue&lt;strong&gt;.&lt;/strong&gt;&amp;nbsp; This issue stops compilation of Smart Device projects referencing Microsoft.ServiceModel.Channels.Mail.dll and or Microsoft.ServiceModel.Channels.Mail.WindowsMobile.dll.&amp;nbsp; We have fixed this issue and are making the fix available through the end user download.&amp;nbsp; If you’re trying the Store and Forward Channel out, first uninstall .NET Compact Framework v3.5 Pre-Release then install it from &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1343d537-a62f-4a6e-9727-7791bf4cc2bd&amp;amp;DisplayLang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=1343d537-a62f-4a6e-9727-7791bf4cc2bd&amp;amp;DisplayLang=en&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2976119" width="1" height="1"&gt;</description></item><item><title>Introduction to the Windows Communication Foundation for the .NET Compact Framework, Store and Forward Messaging</title><link>http://blogs.msdn.com/markprenticems/archive/2007/04/25/introduction-to-the-windows-communication-foundation-for-the-net-compact-framework-store-and-forward-messaging.aspx</link><pubDate>Thu, 26 Apr 2007 01:05:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2276518</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/2276518.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=2276518</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;Lets continue the discussion of the .NET Compact Framework new WCF features by discussing&amp;nbsp;the new EMAIL transport for store and forward messaging.&amp;nbsp; This BLOG builds off my previous &lt;a href="http://blogs.msdn.com/markprenticems/archive/2007/03/27/introduction-to-windows-communication-foundation-for-the-net-compact-framework-messaging-stack.aspx"&gt;BLOG&lt;/a&gt; on WCF deliverables included in NETCF 3.5.&amp;nbsp; I suggest you read my previous BLOG&amp;nbsp; before reading this BLOG, I also suggest you read Roman's &lt;a href="http://blogs.msdn.com/romanbat/archive/2006/10/21/windows-communication-foundation-compact-edition-and-the-story-of-the-lunch-launcher.aspx"&gt;BLOG&lt;/a&gt; as background.&amp;nbsp; Let’s take a closer look at this new feature by describing some of the key features discuss a few best practices and look at a HelloWorld example.  &lt;p&gt;The EMAIL transport permits device addressability so that messages can be sent to a device and messages from the device can be stored up and forwarded on the next synchronization.&amp;nbsp; This allows&amp;nbsp;developers to create applications&amp;nbsp;for devices in the field to communicate their data&amp;nbsp;to a local store.&amp;nbsp; The&amp;nbsp;data is then transferred&amp;nbsp;using&amp;nbsp;ActiveSync's Always&amp;nbsp;Up to Date passing the data through Exchange 2007 directly to the data center.&amp;nbsp; For more information on AUDT see: &lt;a title="http://www.microsoft.com/technet/prodtechnol/exchange/2003/autd.mspx" href="http://www.microsoft.com/technet/prodtechnol/exchange/2003/autd.mspx"&gt;http://www.microsoft.com/technet/prodtechnol/exchange/2003/autd.mspx&lt;/a&gt;.&amp;nbsp; This feature also allows data to be pushed from the data center down to one or more devices; previously this was not an easy task!&amp;nbsp;  &lt;p&gt;This communication is one way, the device can send a message to the data center or the data center can send a message to the device.&amp;nbsp; Each listener is limited to a specific channel name and will block while waiting for a message to be delivered.&amp;nbsp; For this reason, we suggest you spin up a separate thread for each channel listener allowing the data from the thread to be processed as needed and not block the entire application.  &lt;p&gt;Using the email local store to store messages, allows the device to reboot or the application to be restarted while not interrupting the flow of messages.&amp;nbsp; To address this type of message delivery, your program will need to use a stateless programming model.  &lt;p&gt;The sample below is an iteration of the http hello world example from my previous post.&amp;nbsp; It demonstrates the new EMAIL transport features in an easy to read format&amp;nbsp; Use this sample to help you start your investigation into Store and Forward Messaging, do not copy and paste it into production code.&amp;nbsp; This code will only run with the new EMAIL transport which ships with the .NET Compact Framework v3.5 beta1 which is being released with Orcas Beta1.  &lt;p&gt;&lt;strong&gt;Configuring Your PC to run the Store and Forward Messaging Hello World.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;First you will need the Beta2 or later version or later of the next Visual Studio code named Orcas.&amp;nbsp; Check &lt;a href="http://msdn2.microsoft.com/en-us/vstudio/default.aspx"&gt;http://msdn2.microsoft.com/en-us/vstudio/default.aspx&lt;/a&gt;&amp;nbsp;for the latest updates.  &lt;p&gt;Next&amp;nbsp;you will need the&amp;nbsp;Windows Mobile 6.0 SDK as it includes the ActiveSync Always up to Date features used by the&amp;nbsp;EMAIL transport on device to&amp;nbsp;keep the&amp;nbsp;inbox up to date, see: &lt;a href="http://www.microsoft.com/windowsmobile/default.mspx"&gt;http://www.microsoft.com/windowsmobile/default.mspx&lt;/a&gt;  &lt;p&gt;The EMAIL transport on the data center&amp;nbsp;side&amp;nbsp;will only run on Exchange 2007.&amp;nbsp; If you have an Exchange 2007 server running on your network you can skip this section.&amp;nbsp; The Exchange team has made a trial in VPC form available, its a quick place to start.&amp;nbsp;See &lt;a href="http://www.microsoft.com/exchange/default.mspx"&gt;http://www.microsoft.com/exchange/default.mspx&lt;/a&gt;&amp;nbsp;for more details. &amp;nbsp; Before you move on, I suggest you validate your connection to the new Exchange server by running&amp;nbsp;Outlook Web Access (OWA)&amp;nbsp;from your PC.  &lt;p&gt;Next you need to provide your emulator with network capabilities.&amp;nbsp; (ActiveSync's Always up to Date Feature does not run when ActiveSycn is providing the network connection.) For more on enabling networking with the emulator see: &lt;a href="http://blogs.msdn.com/anandba/archive/2007/03/13/networking-support-on-device-emulator-in-vista.aspx"&gt;http://blogs.msdn.com/anandba/archive/2007/03/13/networking-support-on-device-emulator-in-vista.aspx&lt;/a&gt;  &lt;p&gt;Once you have the Emulator up and running, next you need to configure ActiveSync to communicate with your Exchange Server.&amp;nbsp; See the Connecting to an Exchange Server by Using a Phone or a Wireless Network at: &lt;a href="http://www.microsoft.com/technet/solutionaccelerators/mobile/deploy/msfp_8.mspx"&gt;http://www.microsoft.com/technet/solutionaccelerators/mobile/deploy/msfp_8.mspx&lt;/a&gt;  &lt;p&gt;&lt;em&gt;&lt;em&gt;&lt;font color="#ff0000"&gt;I've updated the code below to reflect the changes found in Orcas Beta2.&lt;/font&gt;&lt;/em&gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;strong&gt;Store and Forward Messaging Hello World, the&amp;nbsp;Device:&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;To begin with, you will need to create a new Smart Device project in Orcas.&amp;nbsp; You can use the Windows Mobile 5.0 or 6.0 SDK.&amp;nbsp; I used WM 6.0 Professional. &lt;/p&gt; &lt;p&gt;To start you need to add a reference to the device EMAIl transport Microsoft.ServiceModel.Mail.dll and Microsoft.ServiceModel.Mail.WindowsMobile.dll&lt;/p&gt; &lt;p&gt;Next lets add the needed using statements.&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:29118046-712e-4f37-8703-39e57e22be55" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Runtime.Serialization;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; Microsoft.ServiceModel.Channels.Mail;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; Microsoft.ServiceModel.Channels.Mail.WindowsMobile;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.ServiceModel;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.ServiceModel.Channels;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Xml.Serialization;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Xml;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;Lets now add the TransmittedObject and XmlSerializerWrapper class from the previous post. &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:e6e8d4a7-b4a3-4c11-b4d4-78936f9d1603" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000"&gt;[System.SerializableAttribute()]
        [System.Xml.Serialization.XmlTypeAttribute(Namespace &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;http://Microsoft.ServiceModel.Samples&lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; TransmittedObject
        {
            [System.Xml.Serialization.XmlElementAttribute(Order &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; str;

            [System.Xml.Serialization.XmlElementAttribute(Order &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&lt;span style="color: #000000"&gt; i;
        }&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:97cb99ce-a7d0-46e9-9a06-fcf9d2e17fca" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;sealed&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializerWrapper : XmlObjectSerializer
        {
            XmlSerializer serializer;
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; defaultNS;
            Type objectType;

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializerWrapper(Type type)
                : &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;(type, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;){
            
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializerWrapper(Type type, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; name, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; ns)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.objectType &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; type;
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #000000"&gt;!&lt;/span&gt;&lt;span style="color: #000000"&gt;String.IsNullOrEmpty(ns))
                {
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.defaultNS &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; ns;
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializer(type, ns);
                }
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;span style="color: #000000"&gt;
                {
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.defaultNS &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;""&lt;/span&gt;&lt;span style="color: #000000"&gt;;
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializer(type);
                }
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="color: #000000"&gt; IsStartObject(XmlDictionaryReader reader)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; ReadObject(XmlDictionaryReader reader, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="color: #000000"&gt; verifyObjectName)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
            }
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; WriteEndObject(XmlDictionaryWriter writer)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; WriteObjectContent(XmlDictionaryWriter writer, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; graph)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; WriteStartObject(XmlDictionaryWriter writer, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; graph)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; WriteObject(XmlDictionaryWriter writer, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; graph)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer.Serialize(writer, graph);
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; ReadObject(XmlDictionaryReader reader)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; readersNS;

                readersNS &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; (String.IsNullOrEmpty(reader.NamespaceURI)) &lt;/span&gt;&lt;span style="color: #000000"&gt;?&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;""&lt;/span&gt;&lt;span style="color: #000000"&gt; : reader.NamespaceURI;
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (String.Compare(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.defaultNS, readersNS) &lt;/span&gt;&lt;span style="color: #000000"&gt;!=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;)
                {
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializer(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.objectType, readersNS);
                    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.defaultNS &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; readersNS;
                }

                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer.Deserialize(reader));
            }
        }&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;Now we have enough information to build the message. &lt;/p&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt; to = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;();
            to.str = &lt;span style="color: rgb(163,21,21)"&gt;"Hello"&lt;/span&gt;;
            to.i = 5;

            &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt; wrapper = 
                &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;));

            &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt; m = &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt;.CreateMessage
                (&lt;span style="color: rgb(43,145,175)"&gt;MessageVersion&lt;/span&gt;.Default, &lt;span style="color: rgb(163,21,21)"&gt;"urn:test"&lt;/span&gt;, to, wrapper);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Next let’s setup a few variables used in the rest of the program, the device and server e-mail addresses and the channel name.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:bdd887d8-21d8-444a-b918-3b4942cd7e62" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000"&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; channelName &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;StoreandFowardMessageHelloWorld&lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; serverAddress &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;ServerMailAddress@ExchangServer.com&lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; clientAddress &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;DeviceMailAddress@ExchangServer.com&lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let’s build the output channel and send the message to the server.&lt;/p&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;WindowsMobileMailBinding&lt;/span&gt; binding = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;WindowsMobileMailBinding&lt;/span&gt;();
            &lt;span style="color: rgb(43,145,175)"&gt;BindingParameterCollection&lt;/span&gt; parameters = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;BindingParameterCollection&lt;/span&gt;();

            &lt;span style="color: rgb(0,128,0)"&gt;//Create and open the Channel Factory
&lt;/span&gt;            &lt;span style="color: rgb(43,145,175)"&gt;IChannelFactory&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IOutputChannel&lt;/span&gt;&amp;gt; channelFactory =
                                            binding.BuildChannelFactory&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IOutputChannel&lt;/span&gt;&amp;gt;(parameters);
            channelFactory.Open();&lt;/pre&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;IOutputChannel&lt;/span&gt; outChannel = channelFactory.CreateChannel(
                                &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;EndpointAddress&lt;/span&gt;(&lt;span style="color: rgb(43,145,175)"&gt;MailUriHelper&lt;/span&gt;.Create(channelName, serverAddress)));
            outChannel.Open();&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp;Time to send the message.&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;      outChannel.Send(m);&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now the message has been sent, we need to listen for the response.&amp;nbsp; The listener will block so I would suggest in your production code to run any listener on a separate thread.&amp;nbsp; For this example just place it below the sender.&lt;/p&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;IChannelListener&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IInputChannel&lt;/span&gt;&amp;gt; listner = binding.BuildChannelListener&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IInputChannel&lt;/span&gt;&amp;gt;
                                      (&lt;span style="color: rgb(43,145,175)"&gt;MailUriHelper&lt;/span&gt;.CreateUri(channelName, clientAddress), parameters);

            listner.Open();

            &lt;span style="color: rgb(43,145,175)"&gt;IInputChannel&lt;/span&gt; inputChannel = listner.AcceptChannel();
            inputChannel.Open();

            &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt; reply = inputChannel.Receive();&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Now that we have the responce, lets Deserialize it and present the results to the user.&lt;/p&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt; to1 = 
                reply.GetBody&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;&amp;gt;
                (&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;)));

            &lt;span style="color: rgb(43,145,175)"&gt;MessageBox&lt;/span&gt;.Show(to1.str + &lt;span style="color: rgb(163,21,21)"&gt;" "&lt;/span&gt; + to1.i.ToString());&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Finally lets clean up the EMAIL channel objects.&lt;/p&gt;&lt;pre class="code"&gt;            outChannel.Close();
            channelFactory.Close();

            listner.Close();
            inputChannel.Close();
            binding.Close();&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;strong&gt;Store and Forward Messaging Hello World, the Server:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let’s look at the code needed to respond to the devices requests. 
&lt;p&gt;Create a new Windows Console Application, 
&lt;p&gt;To start you need to add a reference to the device EMAIl transport Microsoft.ServiceModel.Mail.dll and Microsoft.ServiceModel.Channels.Mail.ExchangeWebService.dll 
&lt;p&gt;Next lets add the needed using statements.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:29dfcd5b-1cb0-4a89-aa5f-bb7723957f34" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.ServiceModel;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.ServiceModel.Channels;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; Microsoft.ServiceModel.Channels.Mail.ExchangeWebService;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; Microsoft.ServiceModel.Channels.Mail;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Runtime.Serialization;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Xml;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Xml.Serialization;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;We need the&amp;nbsp;TransmittedObject and XmlSerializerWrapper class from the device code above, copy and paste that section to your new project. 
&lt;p&gt;Next let’s set a few global variables from the device project. &lt;/p&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; serverAddress = &lt;span style="color: rgb(163,21,21)"&gt;"ServerMailAddress@ExchangServer.com"&lt;/span&gt;;
            &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; serverPWD = &lt;span style="color: rgb(163,21,21)"&gt;"MyPassword"&lt;/span&gt;;
            &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; clientAddress = &lt;span style="color: rgb(163,21,21)"&gt;"DeviceMailAddress@ExchangServer.com"&lt;/span&gt;;
            &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; exchageServerLocation = &lt;span style="color: rgb(163,21,21)"&gt;"http://ExchagneServer"&lt;/span&gt;;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let now create the listener,&amp;nbsp;again the input channel will block so in your production code you should spin up a new thread for each listener.&amp;nbsp; In this sample as with the device sample we will place it in line.&amp;nbsp;If you are&amp;nbsp;using windows credentials just pass null value as the second argument to the ExchangeWebServiceMailBinding.&lt;/p&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;ExchangeWebServiceMailBinding&lt;/span&gt; binding = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ExchangeWebServiceMailBinding&lt;/span&gt;(
                                            &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Uri&lt;/span&gt;(exchageServerLocation),
                                            &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; System.Net.&lt;span style="color: rgb(43,145,175)"&gt;NetworkCredential&lt;/span&gt;(serverAddress, serverPWD));
            &lt;span style="color: rgb(43,145,175)"&gt;BindingParameterCollection&lt;/span&gt; parameters = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;BindingParameterCollection&lt;/span&gt;();

            &lt;span style="color: rgb(43,145,175)"&gt;IChannelListener&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IInputChannel&lt;/span&gt;&amp;gt; listner = binding.BuildChannelListener&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IInputChannel&lt;/span&gt;&amp;gt;
                                                  (&lt;span style="color: rgb(43,145,175)"&gt;MailUriHelper&lt;/span&gt;.CreateUri(channelName, &lt;span style="color: rgb(163,21,21)"&gt;""&lt;/span&gt;), parameters);
            listner.Open();&lt;/pre&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;IInputChannel&lt;/span&gt; inputChannel = listner.AcceptChannel();
            inputChannel.Open(&lt;span style="color: rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.MaxValue);
            &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Channel Open"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt; reply = inputChannel.Receive(&lt;span style="color: rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.MaxValue);
            &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Message Received"&lt;/span&gt;);
            &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt; wrapper = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;));
            &lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt; to = reply.GetBody&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;&amp;gt;(wrapper);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Processing the message.&lt;/p&gt;&lt;pre class="code"&gt;            to.str = to.str + &lt;span style="color: rgb(163,21,21)"&gt;" World"&lt;/span&gt;;
            to.i = to.i + 1;

            &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Responce: "&lt;/span&gt; + to.str + &lt;span style="color: rgb(163,21,21)"&gt;" "&lt;/span&gt; + to.i.ToString());&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Sending the response through an output channel.&lt;/p&gt;&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt; m = &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt;.CreateMessage(binding.MessageVersion, &lt;span style="color: rgb(163,21,21)"&gt;"urn:test"&lt;/span&gt;, to, wrapper);

            &lt;span style="color: rgb(43,145,175)"&gt;IChannelFactory&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IOutputChannel&lt;/span&gt;&amp;gt; channelFactory = binding.BuildChannelFactory&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IOutputChannel&lt;/span&gt;&amp;gt;(parameters);

            channelFactory.Open();

            &lt;span style="color: rgb(43,145,175)"&gt;IOutputChannel&lt;/span&gt; outChannel = channelFactory.CreateChannel(&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;EndpointAddress&lt;/span&gt;(
                                                &lt;span style="color: rgb(43,145,175)"&gt;MailUriHelper&lt;/span&gt;.CreateUri(channelName, clientAddress)));
            outChannel.Open();

            &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Out Channel Open"&lt;/span&gt;);

            outChannel.Send(m);

            &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Message Sent"&lt;/span&gt;);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Finally lets clean up the EMAIL channel objects.&lt;/p&gt;&lt;pre class="code"&gt;            outChannel.Close();
            channelFactory.Close();

            listner.Close();
            inputChannel.Close();
            binding.Close();&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Time to give it a try, start the server first then run the client code to the emulator you configured to sync with your exchange server. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2276518" width="1" height="1"&gt;</description></item><item><title>Introduction to Windows Communication Foundation for the .NET Compact Framework Messaging Stack</title><link>http://blogs.msdn.com/markprenticems/archive/2007/03/27/introduction-to-windows-communication-foundation-for-the-net-compact-framework-messaging-stack.aspx</link><pubDate>Tue, 27 Mar 2007 03:50:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1956824</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>18</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/1956824.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=1956824</wfw:commentRss><description>&lt;p&gt;This BLOG continues my discussion into new features of .NET Compact Framework 3.5 by diving into Windows Communication Foundation for the .NET Compact Framework Messaging stack.&amp;nbsp;&amp;nbsp;To start I suggest you read&amp;nbsp;Romans WCF overview BLOG at &lt;a title="Windows Communication Foundation (Compact Edition) and the story of the Lunch Launcher" href="http://blogs.msdn.com/romanbat/archive/2006/10/21/windows-communication-foundation-compact-edition-and-the-story-of-the-lunch-launcher.aspx"&gt;&lt;a title="http://blogs.msdn.com/romanbat/archive/2006/10/21/windows-communication-foundation-compact-edition-and-the-story-of-the-lunch-launcher.aspx" href="http://blogs.msdn.com/romanbat/archive/2006/10/21/windows-communication-foundation-compact-edition-and-the-story-of-the-lunch-launcher.aspx"&gt;http://blogs.msdn.com/romanbat/archive/2006/10/21/windows-communication-foundation-compact-edition-and-the-story-of-the-lunch-launcher.aspx&lt;/a&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;As with all features included&amp;nbsp;in NETCF, the WCF implementation needed to be small to fit&amp;nbsp;into device ROM's.&amp;nbsp; Our original budget was 250kb and we tracked closely to this goal by cutting out the service layer and implementing a sub-set of the messaging stack.&amp;nbsp;&amp;nbsp;Throughout our investigation&amp;nbsp;a few critical end to end solutions required messaging level security, which was not orrginaly planned for.&amp;nbsp;&amp;nbsp;To&amp;nbsp;address these solutions,&amp;nbsp;WCF for NETCF includes a subset of&amp;nbsp;WS-Security.&amp;nbsp; This drove our size up to ~450kb.&amp;nbsp;&amp;nbsp;The final&amp;nbsp;implementation&amp;nbsp;of WCF for NETCF includes the HTTP and email based transport, the text encoders and WS-Security.&amp;nbsp;&amp;nbsp;Each&amp;nbsp;of these features&amp;nbsp;are extensible and &amp;nbsp;provides a flexible framework to allow each component to be swapped out or extended as needed.&amp;nbsp; &lt;/p&gt; &lt;p&gt;To introduce the messaging stack lets look at&amp;nbsp;a hello world example&amp;nbsp;using &amp;nbsp;HTTP or HTTPS request response.&amp;nbsp;&amp;nbsp;There are&amp;nbsp;distinct tasks which need to be completed for the client solution&amp;nbsp;which includes;&amp;nbsp;create the message, create the channel, open the channel, send the message then receive the response.&amp;nbsp;&amp;nbsp; Server tasks follow similar steps; create the channel, open the channel and wait for response, parse and respond to the message.&amp;nbsp; To demonstrate this type of messaging channel I've added a simple code example below.&amp;nbsp; The client code will run on the PC so I if you do not have&amp;nbsp;Orcas&amp;nbsp;Beta1 or greater,&amp;nbsp;which includes System.ServiceModel.dll, you can start your investigation PC them move to device when Orcas Beta2 is released.&amp;nbsp; Lets look at the specifics of a simple hello world example. &lt;/p&gt; &lt;p&gt;&lt;em&gt;&lt;font color="#ff0000"&gt;I've updated the code below to reflect the changes found in Orcas Beta2.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;strong&gt;Messaging Hello World Client Code:&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The Hello World example below describes a simple use of the messaging stack in conjunction with the canned&amp;nbsp;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms731361.aspx"&gt;HTTP binding element&lt;/a&gt;.&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p&gt;We need to implement infrastructure used by both the client and server. &lt;/p&gt; &lt;p&gt;First we need to add the needed references.&lt;/p&gt; &lt;p&gt;First add references to:&lt;/p&gt; &lt;p&gt;1. System.ServiceModel.dll&lt;/p&gt; &lt;p&gt;2. System.XML.dll&lt;/p&gt; &lt;p&gt;3 System.Runtime.Serialization.dll&lt;/p&gt; &lt;p&gt;Next we add the using statements.&lt;/p&gt; &lt;blockquote&gt; &lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:cd86f5f1-b30c-4204-a496-7d8478c631c3" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.ServiceModel;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.ServiceModel.Description;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.ServiceModel.Channels;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Xml;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Xml.Serialization;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Runtime.Serialization; &lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;Next we need serializable class to contain our data.&amp;nbsp; &lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:e5836ec7-92cc-4bf9-8f9a-66e3fa100ea2" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000"&gt;    [System.SerializableAttribute()]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;http://Microsoft.ServiceModel.Samples&lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; TransmittedObject
    {
        [System.Xml.Serialization.XmlElementAttribute(Order &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; str;

        [System.Xml.Serialization.XmlElementAttribute(Order &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&lt;span style="color: #000000"&gt; i;
    } &lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;We next need to a helper class by&amp;nbsp;extend the XMLSerilizer to be used in the context of WCF messages.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:afe04174-6e94-466c-9a51-58f8320417b3" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;sealed&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializerWrapper : XmlObjectSerializer
    {
        XmlSerializer serializer;
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; defaultNS;
        Type objectType;

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializerWrapper(Type type)
            : &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;(type, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;)
        {
        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializerWrapper(Type type, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; name, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; ns)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.objectType &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; type;
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #000000"&gt;!&lt;/span&gt;&lt;span style="color: #000000"&gt;String.IsNullOrEmpty(ns))
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.defaultNS &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; ns;
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializer(type, ns);
            }
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;span style="color: #000000"&gt;
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.defaultNS &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;""&lt;/span&gt;&lt;span style="color: #000000"&gt;;
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializer(type);
            }

        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="color: #000000"&gt; IsStartObject(XmlDictionaryReader reader)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; ReadObject(XmlDictionaryReader reader, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="color: #000000"&gt; verifyObjectName)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
        }
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; WriteEndObject(XmlDictionaryWriter writer)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; WriteObjectContent(XmlDictionaryWriter writer, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; graph)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; WriteStartObject(XmlDictionaryWriter writer, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; graph)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; NotImplementedException();
        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; WriteObject(XmlDictionaryWriter writer, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; graph)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer.Serialize(writer, graph);
        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; ReadObject(XmlDictionaryReader reader)
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; readersNS;

            readersNS &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; (String.IsNullOrEmpty(reader.NamespaceURI)) &lt;/span&gt;&lt;span style="color: #000000"&gt;?&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;""&lt;/span&gt;&lt;span style="color: #000000"&gt; : reader.NamespaceURI;
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (String.Compare(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.defaultNS, readersNS) &lt;/span&gt;&lt;span style="color: #000000"&gt;!=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;)
            {
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; XmlSerializer(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.objectType, readersNS);
                &lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.defaultNS &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; readersNS;
            }

            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.serializer.Deserialize(reader));
        }
    } &lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;We now have enough infrastructure to build the message.&amp;nbsp; It can look something like: &lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt; to = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;();
            to.str = &lt;span style="color: rgb(163,21,21)"&gt;"Hello"&lt;/span&gt;;
            to.i = 5;

            &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt; wrapper = 
                &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;));

            &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt; m = &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt;.CreateMessage
                (&lt;span style="color: rgb(43,145,175)"&gt;MessageVersion&lt;/span&gt;.Soap11, &lt;span style="color: rgb(163,21,21)"&gt;"urn:test"&lt;/span&gt;, to, wrapper);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;blockquote&gt;&lt;/blockquote&gt;
&lt;p&gt;Next up we need to create the channel using the BasicHttpBinding.&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;BasicHttpBinding&lt;/span&gt; binding = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;BasicHttpBinding&lt;/span&gt;();

            &lt;span style="color: rgb(43,145,175)"&gt;BindingParameterCollection&lt;/span&gt; parameters = 
                &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;BindingParameterCollection&lt;/span&gt;();

            &lt;span style="color: rgb(43,145,175)"&gt;IChannelFactory&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IRequestChannel&lt;/span&gt;&amp;gt; channelFactory = 
                binding.BuildChannelFactory&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IRequestChannel&lt;/span&gt;&amp;gt;(parameters);

            channelFactory.Open();&lt;/pre&gt;
&lt;blockquote&gt;&lt;/blockquote&gt;
&lt;p&gt;The channel then needs to be opened.&amp;nbsp; For PC to PC you can use LocalHost. If your using a device, you will need to setup an IIS server with an appropriate address which is reachable by the device &lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;IRequestChannel&lt;/span&gt; outChannel = 
                channelFactory.CreateChannel
                (&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;EndpointAddress&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Uri&lt;/span&gt;(&lt;span style="color: rgb(163,21,21)"&gt;"http://&amp;lt;&amp;lt;ServerAddress&amp;gt;&amp;gt;:&amp;lt;&amp;lt;PortNumber&amp;gt;&amp;gt;"&lt;/span&gt;)));

            outChannel.Open(&lt;span style="color: rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.MaxValue);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;It time to send the message and wait for the reply &lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt; reply = outChannel.Request(m, &lt;span style="color: rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.MaxValue);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Once the reply is received do Deserialize it and do something with the data. &lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt; to1 = 
                reply.GetBody&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;&amp;gt;
                (&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;)));

            &lt;span style="color: rgb(43,145,175)"&gt;MessageBox&lt;/span&gt;.Show(to1.str + &lt;span style="color: rgb(163,21,21)"&gt;" "&lt;/span&gt; + to1.i.ToString());&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Lets clean up&lt;pre class="code"&gt;            outChannel.Close();
            channelFactory.Close();&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;strong&gt;Messaging Hello World&amp;nbsp;Server Code:&lt;/strong&gt; 
&lt;p&gt;Now lets look at what the server code could look like.&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;p&gt;The server needs all the infrastructure described above including reference and using statements,&amp;nbsp;TransmittedObject and XmlSerializerWrapper 
&lt;p&gt;Next the channel needs to be built. &lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;BasicHttpBinding&lt;/span&gt; binding = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;BasicHttpBinding&lt;/span&gt;();

            &lt;span style="color: rgb(43,145,175)"&gt;BindingParameterCollection&lt;/span&gt; parameters = 
                &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;BindingParameterCollection&lt;/span&gt;();

            &lt;span style="color: rgb(43,145,175)"&gt;IChannelListener&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IReplyChannel&lt;/span&gt;&amp;gt; listener = 
                binding.BuildChannelListener&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;IReplyChannel&lt;/span&gt;&amp;gt;
                (&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Uri&lt;/span&gt;(&lt;span style="color: rgb(163,21,21)"&gt;"http://&amp;lt;&amp;lt;ServerAddress&amp;gt;&amp;gt;:&amp;lt;&amp;lt;PortNumber&amp;gt;&amp;gt;"&lt;/span&gt;), parameters);

            listener.Open();

            &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt; wrapper = 
                &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;XmlSerializerWrapper&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;));&lt;/pre&gt;
&lt;p&gt;Next the channel needs to be opened. &lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;IReplyChannel&lt;/span&gt; channel = listener.AcceptChannel();
            channel.Open(&lt;span style="color: rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.MaxValue);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Receiving the message&lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;RequestContext&lt;/span&gt; r = 
                channel.ReceiveRequest(&lt;span style="color: rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.MaxValue);

            &lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt; to = 
                r.RequestMessage.GetBody&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;TransmittedObject&lt;/span&gt;&amp;gt;(wrapper);&lt;/pre&gt;
&lt;p&gt;Process the message&lt;pre class="code"&gt;            to.str = to.str + &lt;span style="color: rgb(163,21,21)"&gt;" World"&lt;/span&gt;;
            to.i = to.i + 1;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Finally we create the message and send the response. &lt;pre class="code"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt; m = &lt;span style="color: rgb(43,145,175)"&gt;Message&lt;/span&gt;.CreateMessage
                (&lt;span style="color: rgb(43,145,175)"&gt;MessageVersion&lt;/span&gt;.Soap11, &lt;span style="color: rgb(163,21,21)"&gt;"urn:test"&lt;/span&gt;, to, wrapper);

            r.Reply(m, &lt;span style="color: rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.MaxValue);&lt;/pre&gt;
&lt;p&gt;Lets Clean up&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;channel.Close();&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;I hope this provides a brief description of using the WCF messaging stack as its implemented for the device using the .NET Compact Framework. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1956824" width="1" height="1"&gt;</description></item><item><title>.NET Compact Framework 2.0 SP2 Released</title><link>http://blogs.msdn.com/markprenticems/archive/2007/03/13/net-compact-framework-2-0-sp2-released.aspx</link><pubDate>Tue, 13 Mar 2007 19:59:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1874222</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/1874222.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=1874222</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;Microsoft .NET Compact Framework version 2.0 SP2 release&amp;nbsp;is completed and is in the process of being released.&amp;nbsp; This service pack was driven customer feedback including improvements in stability, adds new heap tracking feature to the Remote Performance Monitor.  &lt;p&gt;The .NET Compact Framework will be delivered to customers through various channels in the next few months.&amp;nbsp; Each channel and location will be reported on here. &lt;p&gt;&lt;b&gt;Release Channels&lt;/b&gt; &lt;p&gt;(The links below will be updated as each release goes live) &lt;p&gt;&lt;b&gt;Release &lt;/b&gt;&lt;b&gt;Location&lt;/b&gt; &lt;p&gt;Web Download&lt;br&gt;&lt;a title="http://www.microsoft.com/downloads/details.aspx?FamilyID=aea55f2f-07b5-4a8c-8a44-b4e1b196d5c0&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=aea55f2f-07b5-4a8c-8a44-b4e1b196d5c0&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=aea55f2f-07b5-4a8c-8a44-b4e1b196d5c0&amp;amp;displaylang=en&lt;/a&gt; &lt;p&gt;WCE 4.2 QFE &lt;p&gt;WCE 5.0 QFE&lt;/p&gt; &lt;p&gt;WCE 6.0 QFE&lt;/p&gt; &lt;p&gt;Visual Studio 2005 Patch&lt;br&gt;&lt;/p&gt; &lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;b&gt;New Features:&lt;/b&gt;&lt;br&gt;Service Pack 2 of the .Net Compact Framework V2.0 includes new features in the Remote Performance Monitor aimed at finding memory leaks in the managed heap. These features allow you to take snapshots of the GC heap at any point in time and view the relationships between the live object instances in the heap. You can also compare multiple snapshots over time in order to spot allocation trends in your application as it executes.&lt;/p&gt; &lt;p&gt;&lt;br&gt;&lt;b&gt;Fixed Bugs:&lt;/b&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;NETCFRPM fails on x64&lt;/li&gt; &lt;li&gt;Setup install/uninstall fails silently when the MSI is launched from Control Panel-Programs and Features on Vista&lt;/li&gt; &lt;li&gt;Finalizers fail on RTF objects because COM bindings are already disposed&lt;/li&gt; &lt;li&gt;VS crashes on trying to attach without setting the Attach Enabled Registry Key&lt;/li&gt; &lt;li&gt;Thread.Join() fails with ERROR_INVALID_HANDLE on CE 6.0 platform&lt;/li&gt; &lt;li&gt;Potential memory corruption caused by circular reference&lt;/li&gt; &lt;li&gt;JIT assertion failure when non-existent COM port is addressed&lt;/li&gt; &lt;li&gt;TypeLoadException using generics with NETCF 2.0&lt;/li&gt; &lt;li&gt;IrDA is broken on Windows CE 5.0 devices&lt;/li&gt; &lt;li&gt;NetCFRPM and MDBG cannot target headless devices&lt;/li&gt; &lt;li&gt;SerialPort: Data corruption occurs if DataReceived event is used to receive Unicode characters sent across serial ports&lt;/li&gt; &lt;li&gt;SerialPort: Cannot open a COM port beyond COM9&lt;/li&gt; &lt;li&gt;SerialPort: GetPortNames() does not return serial port names beyond COM9&lt;/li&gt; &lt;li&gt;NETCF deadlocks on exit if native callback delegate has been called on native thread&lt;/li&gt; &lt;li&gt;VS 2005 RTM attempts to deploy NETCFv2.wce5.ARMV4I.cab/System_SR_ENU.cab instead of NETCFv2.wm.ARMV4I.cab/System_SR_ENU_wm.cab on Windows Mobile 6 platforms&lt;/li&gt; &lt;li&gt;XmlSerializerializationWriter: When GetSpecifiedMember returns false serialization is halted resulting in loss of data&lt;/li&gt; &lt;li&gt;Access violation marshaling a class with a string field&lt;/li&gt; &lt;li&gt;Stepping out from a Breakpoint after Func eval causes breakpoint to remain at same place and then VS 2005 hangs&lt;/li&gt; &lt;li&gt;COM: Access violation in N-&amp;gt;M byref marshaling&lt;/li&gt; &lt;li&gt;Native exception in marshalling code when using Interlocked.Exchange&lt;/li&gt; &lt;li&gt;Access violation in StubPolicyAlloc (eestub\policy.cpp&lt;/li&gt; &lt;li&gt;SerialPort.Open thows IOException on CE 6.0 devices&lt;/li&gt; &lt;li&gt;Type.GetDefaultMembers() doesn't return base type's default members&lt;/li&gt; &lt;li&gt;Installing multiple locales of same MSI results in multiple instances of NetCF showing up in Add Remove Programs&lt;/li&gt; &lt;li&gt;VS 2005 attempts to deploy System_SR_ENU.cab instead of System_SR_ENU_wm.cab on Windows Mobile 6 platforms&lt;/li&gt; &lt;li&gt;Debugger does not correctly handle new native threads entering through COM&lt;/li&gt; &lt;li&gt;NETCFRPM parses connection string improperly when device uses ipv6&lt;/li&gt; &lt;li&gt;V2 SP2: HttpWebRequest: HTTPS request fails when TLS_RSA_WITH_3DES_EDE_CBC_SHA cipher is used&lt;/li&gt; &lt;li&gt;Debugger may AV if breakpoints active before F5&lt;/li&gt; &lt;li&gt;WebBrowser's NavigatingEventArgs does not allow to cancel navigation&lt;/li&gt; &lt;li&gt;XmlSerializer fails to deserialize enum's with spaces&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;img alt="" src="http://img.microsoft.com/downloads/img/arrow_px_up.gif" align="bottom"&gt; &lt;a href="http://www.microsoft.com/#top"&gt;Top of page&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1874222" width="1" height="1"&gt;</description></item><item><title>Whats new with .NET Compact Framework 3.5</title><link>http://blogs.msdn.com/markprenticems/archive/2007/03/07/whats-new-with-net-compact-frameowork-3-5.aspx</link><pubDate>Wed, 07 Mar 2007 06:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1824130</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/1824130.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=1824130</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;It’s been a while since I’ve last posted a BLOG entry.&amp;nbsp; I’ve been busy working with my feature teams to complete .NET Compact Framework v3.5.&amp;nbsp; The .NET Compact Framework v3.5 will be shipped with the next version of Visual Studio, code name Orcas, later this year.&amp;nbsp; NETCF teams have been working hard to get all of our new features in for Orcas Beta1.&amp;nbsp; We wanted to make sure you all have an opptunity to try these new features early in the cycle to allow time to address your feedback.&amp;nbsp; Watch my BLOG or the NETCF team BLOG for release deliverables.&amp;nbsp; (NETCF Team BLOG at &lt;A href="http://blogs.msdn.com/netcfteam/" mce_href="http://blogs.msdn.com/netcfteam/"&gt;http://blogs.msdn.com/netcfteam/&lt;/A&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;The features I’ve been working on include, Windows Communication Foundation for the .NET Compact Framework,&amp;nbsp; .NET Compact Framework Language Integrated Query, Sound and updates to GUI.&amp;nbsp; I will be describing the new features for each of these areas in future BLOGS.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Lets off with a qucik look at the new Sound API's.&amp;nbsp; Last year we looked at the current managed sound API SoundPlayer.&amp;nbsp; We liked the programming model; it was simple and easy to use.&amp;nbsp; It was however tied to PlaySound which only allowed for one sound to be played at a time.&amp;nbsp; Devices on the other hand includes WaveOut which allows for hardware mixing of sounds which was desired for those who want to create a simple game.&amp;nbsp; Our solution is to use the managed SoundPlayer API’s unchanged, but deliver the sound to WaveOut allowing more than one sound to be rendered through SoundPlayer at a time.&amp;nbsp;&amp;nbsp;SoundPlayer has been included in the Orcas January CTP and on, to try&amp;nbsp;it grab the latest Orcas CTP.&amp;nbsp; Create a new Windows Mobile PocketPC 2003, .NET Compact Framework 3.5 project.&amp;nbsp; Then drop three buttons on the form and copy the code below to each button.&amp;nbsp; Deploy project to the emulator and give it a try.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt; System.Media;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;&amp;nbsp;...&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; button1_Click(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;{&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af"&gt;SoundPlayer&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt; s = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SoundPlayer&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"&lt;A href="file://windows/Windows%20Default%20.wav" mce_href="file://windows/Windows%20Default%20.wav"&gt;&lt;FONT color=#0000ff&gt;\\Windows\\Windows Default .wav&lt;/FONT&gt;&lt;/A&gt;"&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;s.Play();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; button2_Click(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af"&gt;SoundPlayer&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt; s = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SoundPlayer&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"&lt;A href="file://windows/type.wav" mce_href="file://windows/type.wav"&gt;&lt;FONT color=#0000ff&gt;\\Windows\\type.wav&lt;/FONT&gt;&lt;/A&gt;"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;s.Play();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; button3_Click(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af"&gt;SystemSounds&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;.Exclamation.Play();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1824130" width="1" height="1"&gt;</description></item><item><title>Developing .NET Compact Framework applications for Windows CE 4.2 Devices.</title><link>http://blogs.msdn.com/markprenticems/archive/2006/08/08/692624.aspx</link><pubDate>Wed, 09 Aug 2006 01:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:692624</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/692624.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=692624</wfw:commentRss><description>&lt;P&gt;.NET Compact Framework v2.0 SP1 includes support for Windows CE 4.2 based devices.&amp;nbsp; To date, Visual Studio 2005 does not provide managed 4.2 projects nor is there any support offerings for developing solutions targeted at 4.2 devices.&amp;nbsp; The good news is the 5.0 projects work just fine with one exception, debugging is currently broken on x86 based devices.&amp;nbsp; Below I outline the steps in creating and debugging a .NET Compact Framework v2.0 SP1 Hello World application.&lt;/P&gt;
&lt;H2&gt;&lt;B&gt;Using Visual Studio&lt;/B&gt;&lt;/H2&gt;
&lt;P&gt;The steps below outline how to create and debug a hello world application using Visual Studio 2005.&amp;nbsp; If your Windows CE device uses an x86 processor, see Using Command Line section.&lt;/P&gt;
&lt;H3&gt;1. Configuring the Development Environment&lt;/H3&gt;
&lt;P&gt;To successfully run and debug applications based on&amp;nbsp; .NET Compact Framework 2.0 SP1 you will need to apply .NET Compact Framework 2.0 SP1 to your development environment.&amp;nbsp; To update Visual Studio 2005 download the latest .NET Compact Framework 2.0 SP1 patch from &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=7befd787-9b5e-40c6-8d10-d3a43e5856b2&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=7befd787-9b5e-40c6-8d10-d3a43e5856b2&amp;amp;displaylang=en&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;H3&gt;2. Creating the Hello World Project&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;Open Visual Studio 2005 and create a new C# Windows CE 5.0 project by selecting Device Application from the New Project dialog.&lt;/LI&gt;
&lt;LI&gt;From the ToolBox drop a button on the form and add code below&lt;/LI&gt;
&lt;LI&gt;Add Code to button click &lt;FONT color=#008080&gt;MessageBox&lt;/FONT&gt;.Show(&lt;FONT color=#800000&gt;"Hello World"&lt;/FONT&gt;);&lt;/LI&gt;
&lt;LI&gt;The Windows CE 5.0 project will attempt to deploy the .NET Compact Framework 2.0 SP1 CAB files which are not designed for Windows CE 4.2.&amp;nbsp; To disable deployment turn off Deploy the latest version of NETCF click on your projects properties by selecting the Property Menu and clicking on Properties.&amp;nbsp; Then click on the Devices tab and uncheck Deploy the latest version of the .NET Compact Framework. &lt;/LI&gt;
&lt;LI&gt;Build the Hello World application by selecting Build Solution under the Build menu. &lt;/LI&gt;&lt;/OL&gt;
&lt;H3&gt;3. Setting up the Device&lt;/H3&gt;
&lt;P&gt;There are two ways to get NETCF v2 SP1 included on your 4.2 device, included in ROM by building ROM images using Platform Builder 4.2 or installed into RAM by deploying the .NET Compact Framework CAB file.&amp;nbsp; See below for details&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;B&gt;Including .NET Compact Framework v2.0 sp1 in ROM&lt;/B&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;On the PC that includes Platform Builder apply the .NET Compact Framework 2.0 SP1 Update.&amp;nbsp; For more information on the Platform Builder Update, see &lt;A href="http://msdn.microsoft.com/embedded/windowsce/default.aspx"&gt;Windows CE Download Center&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Once the Update is applied, open the Workspace which contains the image to be updated.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;Remove .NET Compact Framework v1 from the list of included features&lt;/LI&gt;
&lt;LI&gt;Add .NET Compact Framework v2.0 SP1 from the Catalog.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;B&gt;Including .NET Compact Framework v2.0 sp1 in RAM&lt;/B&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Copy the matching CAB file from \Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\WindowsCE\wce400\&amp;lt;&amp;lt;Processor&amp;gt;&amp;gt;\NETCFv2.wce4.&amp;lt;&amp;lt;proc&amp;gt;&amp;gt;.cab to your device&lt;/LI&gt;
&lt;LI&gt;Run CAB file on the device to install. &lt;/LI&gt;&lt;/OL&gt;&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;4. Connecting the Device to Visual Studio 2005&lt;/H3&gt;
&lt;P&gt;If your device connects to the PC using ActiveSync then make that connection now.&amp;nbsp; To connect a WindowsCE device to Visual Studio 2005 without ActiveSync see:&amp;nbsp; &lt;A href="http://msdn2.microsoft.com/en-us/library/ms228708.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms228708.aspx&lt;/A&gt; &lt;/P&gt;
&lt;H3&gt;5. Deploy and Debug Hello World&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;In your Hello World application set a breakpoint at the messagebox.&lt;/LI&gt;
&lt;LI&gt;Type F5 to deploy.&lt;/LI&gt;
&lt;LI&gt;The code will stop at the breakpoint, type F5 again to continue to run the project. &lt;/LI&gt;&lt;/OL&gt;
&lt;H2&gt;&lt;B&gt;Using Command Line To Debug&lt;/B&gt;&lt;/H2&gt;
&lt;P&gt;For x86 based devices, debugging will need to be done from the command line using mdbg.&amp;nbsp; For more information on command line debugging see David Klines blog posting at: &lt;A href="http://blogs.msdn.com/davidklinems/archive/2006/07/13/665023.aspx"&gt;http://blogs.msdn.com/davidklinems/archive/2006/07/13/665023.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=692624" width="1" height="1"&gt;</description></item><item><title>.NET Compact Framework v2.0 Workaround for CAB Error #4</title><link>http://blogs.msdn.com/markprenticems/archive/2006/03/28/563143.aspx</link><pubDate>Tue, 28 Mar 2006 19:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:563143</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/563143.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=563143</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;A few weeks ago I &lt;A HREF="/markprenticems/archive/2006/02/17/534274.aspx"&gt;BLOG’ed&lt;/A&gt; about a .NET Compact Framework v2.0 CAB setup error being seen on some low memory Windows Mobile 5.0 devices. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;I’m happy to report the workaround for the system failure, which will be included in SP1, has now also been slipstreamed into the current download.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If .NET Compact Framework v2 CAB installation on a Windows Mobile 5.0 device fails with error #4 then this fix is for you.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Just re-download the NETCFv2 package and re-install!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;NETCF v2 download package: &lt;A href="http://www.microsoft.com/downloads/details.aspx?familyid=9655156b-356b-4a2c-857c-e62f50ae9a55&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=9655156b-356b-4a2c-857c-e62f50ae9a55&amp;amp;displaylang=en&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I expect to see the other languages downloaded sites to be updated as the localization pages are completed in the next few weeks.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=563143" width="1" height="1"&gt;</description></item><item><title>Direct3D Mobile on Windows Mobile 5.0 Devices</title><link>http://blogs.msdn.com/markprenticems/archive/2006/03/10/547983.aspx</link><pubDate>Fri, 10 Mar 2006 04:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:547983</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/547983.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=547983</wfw:commentRss><description>&lt;P&gt;I've been testing some of the retail Windows Mobile 5.0 devices&amp;nbsp;3D performance. I have found when the proper driver is included with the device, the performance is good enough to successfully develop and run a casual game.&amp;nbsp; However these drivers do vary from device to device and some care will need to be taken to accommodate each.&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Devices running on the XScale chip without a dedicated GPU have remarkably quick 3D performance due to a good software driver.&amp;nbsp; The performance is directly related to the speed of the processor.&amp;nbsp; I ran my tests on a XScale device with a processor running at 400mhz.&amp;nbsp; This class of device provides enough throughput to run a game like &lt;A href="http://www.pocket-jongg.com/default.aspx"&gt;PocketJongg&lt;/A&gt; and runs sprite based games at an acceptable 30 frames per second.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The Dell x50v and x51v include the Intel 2700G GPU. This GPU provides great performance, but comes with a cost.&amp;nbsp; Lighting performance can be substandard to the point where its not usable. If you're going to use lighting test on the x50v or x51v first.&amp;nbsp; To see a bit of code that demonstrates this performance just run the lighting sample included in the MSDN documents at &lt;A href="http://msdn2.microsoft.com/en-us/library/ms181020.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms181020.aspx&lt;/A&gt;.&amp;nbsp; There are also substantial&amp;nbsp; issues with clipping.&amp;nbsp; To see this in action run the billboard sample from the MSDN documents at &lt;A href="http://msdn2.microsoft.com/en-us/library/ms181015.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms181015.aspx&lt;/A&gt;.&amp;nbsp; To the Dells credit, it does run a simple sprite game at 60 frames per second and also runs &lt;A href="http://www.pocket-jongg.com/default.aspx"&gt;PocketJongg&lt;/A&gt;.&amp;nbsp; If you work around its limitations, the Dell x50v and x51v provide the best render performance. &lt;/P&gt;
&lt;P&gt;HTC has been releasing deices based on TI's OMAP chip.&amp;nbsp; Unfortunately the devices in the field today contain the D3DM reference driver, not the OMAP software driver.&amp;nbsp; The reference driver renders in seconds per frame.&amp;nbsp; Devices containing the reference driver are completely useless for running games.&amp;nbsp; This will not be the case with new OMAP based devices as this is in the process of being fixed with an OMAP optimized software driver.&amp;nbsp; We should see OMAP devices capable of playing 3D games later this spring.&amp;nbsp; There may also be ROM updates available to flash up the devices in the field around the same time. &lt;/P&gt;
&lt;P&gt;&lt;B&gt;Identification&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;You may need to identify the D3DM driver and configure the game accordingly.&amp;nbsp; For instance, if you detect the reference driver you may not want the game to run, or you may detect the Intel 2700 driver and not include lighting. Below is some sample code for detecting the the driver. &lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;//--------------------------------------------------------------------- &lt;BR&gt;//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY &lt;BR&gt;//KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE &lt;BR&gt;//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A &lt;BR&gt;//PARTICULAR PURPOSE. &lt;BR&gt;//---------------------------------------------------------------------&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;using System;&lt;BR&gt;using System.Windows.Forms;&lt;BR&gt;using Microsoft.WindowsMobile.DirectX;&lt;BR&gt;using Microsoft.WindowsMobile.DirectX.Direct3D;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;namespace DisplayD3DMDriver&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class Class1 : Form&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AdapterListCollection al = Manager.Adapters;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string driver = al.Default.Information.DriverName.ToString();&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string message;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (driver)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case "d3dmref.dll":&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "Software Reference Driver";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case "D3DM TI3D Driver":&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "OMAP Software Driver";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case "PowerVR D3DMobile HAL":&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "PowerVR GPU";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case "D3DMXSC50PB.DLL":&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "XScale Software Driver";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = driver;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(message);&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(e.ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=547983" width="1" height="1"&gt;</description></item><item><title>.NET Compact Framework v2 SP1 (Setup and Headless)</title><link>http://blogs.msdn.com/markprenticems/archive/2006/02/17/534274.aspx</link><pubDate>Fri, 17 Feb 2006 21:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:534274</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/534274.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=534274</wfw:commentRss><description>&amp;nbsp;
&lt;P&gt;This BLOG started out as a way for me to describe managed game development on devices. I'm responsible for GUI and MD3DM as noted in my introduction.&amp;nbsp; I also cover setup and release which I will begin to include in this BLOG as well.&lt;/P&gt;
&lt;P&gt;The .NET Compact Framework (NETCF) team has been working on our version 2 Service Pack 1 release which we expect to ship late this spring.&amp;nbsp; SP1 includes a few new tools to help developers create and debug NETCF applications and fixes for bugs identified both internally and externally.&amp;nbsp; This BLOG entry will cover changes to Setup and Headless.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Setup&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;We have seen many reports of the NETCF v2 CAB files failing to install on Windows Mobile 5.0 devices.&amp;nbsp; Some of these setup failures have been caused by a bug in the Windows Mobile 5.0 CAB installer (wceload).&amp;nbsp; If the CAB contains an .exe the installer scans the system for all running exes and in doing so takes up more memory then needed.&amp;nbsp; If your device is already low on RAM the installer fails with out an error.&amp;nbsp; This bug has been fixed in later builds of Windows Mobile 5.0 (AKU 2.2) so devices shipping in the future will not suffer form this issue. If you encounter a NETCF CAB file setup failure with error #4 you have likely hit this bug.&amp;nbsp; To work around this bug we will be re-naming all executables (cgacutil.exe) extensions to something other then .exe.&amp;nbsp; Then during installation our setup.dll will rename the file back to .exe.&amp;nbsp;&amp;nbsp;To get NETCF v2 RTM installed, soft reset your device, shut down all running applications, and try running the CAB file again. &lt;/P&gt;
&lt;P&gt;For a great description of NETCF CAB story see Ilya's post on the .NET Compact Framework team blog at: &lt;A HREF="/netcfteam/archive/2005/10/11/479793.aspx"&gt;http://blogs.msdn.com/netcfteam/archive/2005/10/11/479793.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Headless&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;We have been working on addressing the needs of Headless devices (No display driver) for some time.&amp;nbsp; We were unable to include these features with our v2 release but they are slated to be included in SP1.&amp;nbsp; Headless features will be made available to WinCE 5.0 as part of the (NETCF) v2.0 SP1 QFE sometime after SP1.&amp;nbsp; This QFE will add a new catalog item .NET Compact Framework (Headless).&amp;nbsp; Dependencies have been changed to allow NETCF to be built into a WinCE 5.0 image which does not include a display driver. We have added an error log to help with unhandled exceptions is provided. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=534274" width="1" height="1"&gt;</description></item><item><title>Managed Sprite Sample and 2D Game Whitepapers for Devices</title><link>http://blogs.msdn.com/markprenticems/archive/2005/08/01/446111.aspx</link><pubDate>Mon, 01 Aug 2005 20:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:446111</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/446111.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=446111</wfw:commentRss><description>&lt;P&gt;We on the NETCF team have been busy completing our v2 product, which has kept me away from my BLOG.&amp;nbsp; I have found some time to get you all up to speed on whats been happening in the Managed Mobile gaming space. &lt;/P&gt;
&lt;P&gt;We had four great articles published describing how to create 2D games using Winforms.&amp;nbsp; These are based on games developed by the NETCF team as part of our application building exercise we run throughout the product cycle. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Pocket Jack: Writing a Card-Playing Application&lt;BR&gt;Summary:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; This article describes how to create and use a card game for Smartphones. The description is illustrated by the development of a blackjack game for Smartphone.&lt;BR&gt;&lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/pocketjack.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/pocketjack.asp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Focus Point: An Image Scaling Game for Smartphones&lt;BR&gt;Summary:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; This article discusses how to manage image animation, scaling, and loading on Smartphones. The description is illustrated by the development of an image scaling game for Smartphone.&lt;BR&gt;&lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/focuspoint.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/focuspoint.asp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Pocket Bots: Writing a Battle Game for Smartphones&lt;BR&gt;Summary:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; This article describes how to generate randomly tiled landscapes, fire projectiles, detect collisions, and perform frame-based animation on Smartphones. A battle game illustrates how to develop these features for Smartphones.&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/pocketbots.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/pocketbots.asp&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;StarLight: Writing a Space-Shooter Game for Smartphones&lt;BR&gt;Summary:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; This article describes how to generate moving star fields, animated sprites, and scripted movements for game objects. A space shooter game illustrates how to develop these features for Smartphones.&lt;BR&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/starlight.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/starlight.asp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I’ve been porting the code samples from Beginning .NET Game Programming in C# by David Weller to the PocketPC to fully understand how you all will port your games from PC to the device.&amp;nbsp; Recently I’ve been working through his Sprite sample, which leads me to a slightly different sample for the pocketpc.&amp;nbsp; My sample uses the donut bmp which contains the sprite animation which I loop through to animate.&amp;nbsp; Next I give the sprite an x and y velocity to move it across the screen.&amp;nbsp; I detect collision with the end of the screen, once detected, I reverse said velocity. &amp;nbsp;Finally use the dpad to modify the x and y velocity.&amp;nbsp; Simple, but hope it illustrates using Sprites on device. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently I’m using a pre-release build for the Dell Axim x50v, which includes hardware acceleration! More information on the x50v running Windows Mobile 5.0 see Dells x50v page.&amp;nbsp; It runs my sample quite well.&amp;nbsp; Unfortunately it has still not been released by Dell, so for the time being, you will have to be content with the emulator shipping in VS 2005 in Beta2 and in the latest CTP’s.&amp;nbsp; D3D performance with the emulator is very slow. It ships with the reference driver so it runs, ok more like walks slowly. &lt;/P&gt;
&lt;P&gt;A few interesting observations before we get into the code.&amp;nbsp; Setting an alpha color on a bmp is not as easy as it seems.&amp;nbsp; The alpha color can be set in the TextureLoader.FromStream, colorKey parameter with a load of other parameters most of which you will want to set to their default.&amp;nbsp; Unfortunately our documentation does not include the defaults so I will list them here:&lt;/SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;SPAN&gt;
&lt;TABLE id=table1 width="29%" border=1&gt;
&lt;TR&gt;
&lt;TD width=123&gt;&lt;B&gt;Parameter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/B&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;B&gt;Default&lt;/B&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;readBytes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;
&lt;TD&gt;D3DX.Default&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;width&lt;/TD&gt;
&lt;TD&gt;D3DX.Default&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;height&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;
&lt;TD&gt;D3DX.Default&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;mipLevels&lt;/TD&gt;
&lt;TD&gt;D3DX.Default&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;usage&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;
&lt;TD&gt;Usage.None&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;format&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;
&lt;TD&gt;Format.Unknown&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;&amp;nbsp;pool &lt;/TD&gt;
&lt;TD&gt;Pool.VideoMemory&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;filter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;
&lt;TD&gt;(Filter)D3DX.Default&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;mipFilter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;
&lt;TD&gt;(Filter)D3DX.Default&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=123&gt;colorKey&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;
&lt;TD&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/SPAN&gt;&lt;SPAN&gt;
&lt;P&gt;Once I identified the defaults to TextureLoader.FromSteam it was not too difficult to complete the sample using the MD3DM samples included in VS.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;If you have Visual Studio 2005 Beta2 (or one of the CTP’s) and the Windows Mobile 5.0 SDK installed you can build my sample by following my steps below.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;1. Create new blank PocketPC project&lt;BR&gt;2. Add references to Microsoft.WindowsMobile.DirectX, System.Drawing, System.Windows.Forms&lt;BR&gt;3. From the PPC SDK add the donuts.bmp to the project and set its Build Action to Embedded Resource to included it in the assembly&lt;BR&gt;4. Add a new class named TitleSet which will contain data describing the sprite titles.&amp;nbsp; Add code:&lt;/P&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;CODE&gt;&lt;PRE&gt;//---------------------------------------------------------------------
//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//PARTICULAR PURPOSE.
//---------------------------------------------------------------------&lt;/PRE&gt;&lt;PRE&gt;using System;
using Microsoft.WindowsMobile.DirectX;
using Microsoft.WindowsMobile.DirectX.Direct3D;
namespace SpaceDonuts {
	public class TileSet {
		private Texture texture;

		public Texture Texture {
			get {
				return texture;
			}
		}
		private int xOrigin;

		public int XOrigin {
			get {
				return xOrigin;
			}
		}
		private int yOrigin;

		public int YOrigin {
			get {
				return yOrigin;
			}
		} 
		private int numberFrameRows;

		public int NumberFrameRows {
			get {
				return numberFrameRows;
			}
		}
		private int numberFrameColumns;

		public int NumberFrameColumns {
			get {
				return numberFrameColumns;
			}
		}
		private int xExtent;

		public int ExtentX {
			get {
				return xExtent;
			}
		}

		private int yExtent;
		public int ExtentY {
			get {
				return yExtent;
			}
		}

		public TileSet(Texture tex, int StartX, int StartY, int RowCount, int ColumnCount, int xWidth, int yHeight) {
			xOrigin = StartX;
			yOrigin = StartY;
			xExtent = xWidth;
			yExtent = yHeight;
			numberFrameRows = RowCount;
			numberFrameColumns = ColumnCount;
			texture = tex;
		}
	}
}&lt;/PRE&gt;&lt;/CODE&gt;&lt;/SPAN&gt;
&lt;P&gt;5. Next add a new code file and add the game code below:&lt;/FONT&gt;&lt;SPAN style="COLOR: black"&gt;&lt;FONT face="Times New Roman"&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;CODE&gt;&lt;SPAN&gt;//---------------------------------------------------------------------&lt;BR&gt;//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY&lt;BR&gt;//KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE&lt;BR&gt;//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A&lt;BR&gt;//PARTICULAR PURPOSE.&lt;BR&gt;//---------------------------------------------------------------------&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/FONT&gt;&lt;CODE&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;/P&gt;&lt;PRE&gt;using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.WindowsMobile.DirectX;
using Microsoft.WindowsMobile.DirectX.Direct3D;
using System.Runtime.InteropServices;
using System.Reflection;

namespace SpaceDonuts
{
    // The main class for this sample
    public class CreateDevice : Form
    {
        // Our global variables for this project
        Device device = null;
        Texture texture = null;
        Rectangle tilePosition;
        TileSet tileSet = null;
        Sprite sprite;
        Int16 countX = 0;
        Int16 countY = 0;
        Vector3 spritePosition = new Vector3(200, 200, 0);
        Vector3 spriteCenter = new Vector3(16, 16, 0);
        int spriteVelocityX = 1;
        int spriteVelocityY = 1;
        

        public CreateDevice()
        {
            // Set the caption
            this.Text = "Sprite Sample";
            this.MinimizeBox = false;
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CreateDevice_KeyDown);
        }

        // Prepare the rendering device
        public bool InitializeGraphics()
        {
            try
            {
                // Now let's setup our D3D parameters
                PresentParameters presentParams = new PresentParameters();

                // Causes the display to appear in a window rather than
                // full screen
                presentParams.Windowed = true;

                // When a new frame is swapped to the front buffer
                // the old frame will be discarded
                presentParams.SwapEffect = SwapEffect.Discard;

                // 0 gives us the first monitor adapter on the system
                // for md3dm you must use the default device type
                // this refers to the form which will provide the rendering
                // area createflags allows various options to be set
                // present parameters set various details of how the image 
                // will be displayed within render area and what buffers and
                // formats it will have
                device = new Device(0, DeviceType.Default, this, CreateFlags.None, presentParams);
                device.DeviceReset += new System.EventHandler(
                      this.OnResetDevice);
                this.OnResetDevice(device, null);
            }
            catch (DirectXException)
            {
                return false;
            }
            return true;
        }

        void OnResetDevice(object sender, EventArgs e)
        {
            Device dev = (Device)sender;
            //create sprite object on device
            sprite = new Sprite(dev);
            //get the donuts resource out of the assembly and assign to texture
            //Default parameters for TextureLoader.FromStream (device, stream, D3DX.Default, D3DX.Default, D3DX.Default, D3DX.Default, Usage.None, Format.Unknown, Pool.VideoMemory,(Filter)D3DX.Default, (Filter)D3DX.Default, 0)
            //Load texture from the resource and set the color black as the alpha blended color
            texture = TextureLoader.FromStream(dev, Assembly.GetExecutingAssembly().GetManifestResourceStream("Sprites.donuts.bmp"), D3DX.Default, D3DX.Default, D3DX.Default, D3DX.Default, Usage.None, Format.Unknown, Pool.VideoMemory, (Filter)D3DX.Default, (Filter)D3DX.Default, Color.Black.ToArgb());
            //configure TileSet to the size of tile in bmp
            tileSet = new TileSet(texture, 0, 0, 6, 5, 32, 32);
            //set tileposition including the offset to the center of the sprite
            tilePosition = new Rectangle(tileSet.XOrigin, tileSet.YOrigin, tileSet.ExtentX * 2, tileSet.ExtentY * 2);
        }

        // All rendering for each frame occurs here
        private void Render()
        {

                //Clear the backbuffer to a blue color 
                device.Clear(ClearFlags.Target, System.Drawing.Color.BlueViolet,
                    1.0f, 0);

                //Begin the scene
                device.BeginScene();

                sprite.Begin(SpriteFlags.AlphaBlend);
                //draw Sprite at current position. 
                sprite.Draw(tileSet.Texture, tilePosition, spriteCenter, spritePosition,Color.White.ToArgb());
                sprite.End();

             
                //End the scene
                device.EndScene();
                device.Present();
                
                //rotateSprite moves image to the next tile
                rotateSprite();
                //moveSprite to change the sprite position for the next render.
                moveSprite();

                //Application.DoEvents();
         }
        

        // Called to repaint the window
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            // Render on painting
            this.Render();

            // Render again
            this.Invalidate();
        }

        // Called to repaint the window background
        protected override void OnPaintBackground(
            System.Windows.Forms.PaintEventArgs e)
        {
            // Do nothing to ensure that the rendering area is not overdrawn
        }


        static void Main()
        {
            CreateDevice frm = new CreateDevice();

            // Initialize Direct3D
            if (!frm.InitializeGraphics())
            {
                MessageBox.Show("Could not initialize Direct3D. " +
                    "This tutorial will exit.");
                return;
            }

            Application.Run(frm);
        }

        private void CreateDevice_KeyDown(object sender, KeyEventArgs e)
        {
            //use rocker to modify velocity 
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                // Rocker Up
                // Up
                spriteVelocityY -= 1;
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                // Rocker Down
                // Down
                spriteVelocityY += 1;
                
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Left))
            {
                // Left
                spriteVelocityX -= 1;
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Right))
            {
                // Right
                spriteVelocityX += 1;
                
            }

        }

        private void moveSprite()
        {
            if (spritePosition.X &amp;gt; (this.Width - (tileSet.ExtentX * 2)) || spritePosition.X &amp;lt; 0)
            {
                //if sprite hits either left or right side of screen provide reciprocal velocity   
                spriteVelocityX *= -1;
            }


            if (spritePosition.Y &amp;gt; (this.Height - tileSet.ExtentY * 2) || spritePosition.Y &amp;lt; 0)
            {
                //if sprite hits either top or bottom of screen provide reciprocal velocity     
                spriteVelocityY *= -1;
     
            }

            //advance sprite by adding to its position the velocity            
            spritePosition.X += spriteVelocityX;
            spritePosition.Y += spriteVelocityY;
        }

        private void rotateSprite()
        {
            //change the count to move to the next sprite tile
            if (++countX &amp;gt; 4)
            {
                countX = 0;
                if (++countY &amp;gt; 5)
                {
                    countY = 0;
                }
            }
            //set coodinates for current tile
            tilePosition.X = tileSet.XOrigin + (countX * tileSet.ExtentX * 2);
            tilePosition.Y = tileSet.YOrigin + (countY * tileSet.ExtentY * 2);
        }


    }
}&lt;/FONT&gt;&lt;/PRE&gt;&lt;/SPAN&gt;&lt;/CODE&gt;
&lt;P&gt;6. Compile and deploy to the emulator or device if you have it.&amp;nbsp; Move the donut around the screen with the d-pad, watch it hit the side of the screen and bounce off.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=446111" width="1" height="1"&gt;</description></item><item><title>Introduction</title><link>http://blogs.msdn.com/markprenticems/archive/2005/06/10/427827.aspx</link><pubDate>Fri, 10 Jun 2005 14:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:427827</guid><dc:creator>MarkPrenticeMS</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/markprenticems/comments/427827.aspx</comments><wfw:commentRss>http://blogs.msdn.com/markprenticems/commentrss.aspx?PostID=427827</wfw:commentRss><description>&lt;P&gt;Hi All, &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I thought I would introduce myself to the BLOG-O-Sphere, my name is Mark Prentice and I’m a Program Manager for the .NET Compact Framework (NETCF) team. My responsibilities on the NETCF team include help manage GUI and the Managed D3D for Devices (MD3DM) effort. This BLOG will cover my journey of using these new interfaces to create and help others create games for devices. &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;First a little bit about me. I’ve been at Microsoft for 12 years now. For the first 10 years I worked in and around VBA and Office. Some of this time was spent in Access support and the remainder as a PM for the Office Developer team. I wrote a few free Access wizards, helped a few versions MOD ship and finally drove the Web Services Reference tool for VBA. I then went on to help lay some of the ground work for the new Visual Studio Tools for Office, which I think is the great step in bring modern programming language to Office based solutions. After 10 years of working with developers in Office, I was up for a change. So I then jumped to the NETCF team to help ship V1 Sp3, Sp3 and help take on managed GUI development and finally to creating games on devices, which leads me back to this BLOG. &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Now some background on our managed D3D wrappers. The Windows CE 5.0 team implemented a version of DirectX for devices last year. This version of DirectX was inspired by DX8 (D3DM). It is not totally compatible but close enough to give DX C++ developers a head start on creating games for devices. It was a good first step, the only problem was it only ran with software drivers on one WCE development board. Since then D3DM has been included in Windows Mobile 5.0 OS! Now when the new Smart Phones and PocketPC are delivered based on Windows Mobile 5.0 the will at a minimum contain software D3D drivers. In addition manufacturers, like Dell, will offer hardware D3D drivers. For more information on the Windows Mobile space see: &lt;A href="http://www.microsoft.com/windowsmobile/default.mspx"&gt;http://www.microsoft.com/windowsmobile/default.mspx&lt;/A&gt; also see Dells announcement for the Axim x50v upgrading to WM 5.0 at: &lt;A href="http://www1.us.dell.com/content/topics/global.aspx/corp/pressoffice/en/2004/2005_05_10_rr_000?c=us&amp;amp;l=en&amp;amp;s=corp"&gt;http://www1.us.dell.com/content/topics/global.aspx/corp/pressoffice/en/2004/2005_05_10_rr_000?c=us&amp;amp;l=en&amp;amp;s=corp &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;We on the NETCF team saw an opportunity to port the DX9 managed wrappers based on D3DM to be included in NETCF V2. Now C# and VB.NET developers can quickly create managed games for devices. &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;MD3DM wraps all MD3DM and provides additional mesh functionality. Below is a list of the major features in MD3DM &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Complete access to the underlying native D3DM api &lt;/LI&gt;
&lt;LI&gt;Fixed point support (Vertex Data, Matrices, Lights, and Materials) &lt;/LI&gt;
&lt;LI&gt;Sprite &lt;/LI&gt;
&lt;LI&gt;Font &lt;/LI&gt;
&lt;LI&gt;Mesh &lt;/LI&gt;
&lt;LI&gt;TextureLoader &lt;/LI&gt;
&lt;LI&gt;Mesh Loader (As sample code) &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Instead of my going on and on about the specifics, I suggest you go out and review some of our MVP’s articles. Casey Chestnut wrote a good introduction to MD3DM at &lt;A href="http://www.mperfect.net/cfMDX/"&gt;http://www.mperfect.net/cfMDX/&lt;/A&gt;. He also took the next step and ported WorldWind. This work is documented at: &lt;A href="http://www.mperfect.net/cfWorldWind/"&gt;http://www.mperfect.net/cfWorldWind/&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;So you want to get started? No problem. Just install Visual Studio 2005 beta2 standard installed on your test PC and the Windows Mobile 5.0 SDK, see: &lt;A href="http://msdn.microsoft.com/mobility/windowsmobile/howto/windowsmobile5/install/default.aspx"&gt;http://msdn.microsoft.com/mobility/windowsmobile/howto/windowsmobile5/install/default.aspx &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Next on my BLOGs agenda: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Sprite Sample &lt;/LI&gt;
&lt;LI&gt;Description of my port of a Sprite game &lt;/LI&gt;
&lt;LI&gt;Device specific game loop’s &lt;/LI&gt;
&lt;LI&gt;And much more. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT size=1&gt;Disclaimer(s): This posting is provided "AS IS" with no warranties, and confers no rights. Some of the information contained within this post may be in relation to beta software. Any and all details are subject to change.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=427827" width="1" height="1"&gt;</description></item></channel></rss>