<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9</title>
    <atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Niners/c4f.Robert-Fischer/Posts/RSS"></atom:link>
    <itunes:summary></itunes:summary>
    <itunes:author>Microsoft</itunes:author>
    <itunes:subtitle></itunes:subtitle>
    <image>
      <url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
      <title>Channel 9</title>
      <link>http://channel9.msdn.com/Niners/c4f.Robert-Fischer/Posts</link>
    </image>
    <itunes:image href=""></itunes:image>
    <itunes:category text="Technology"></itunes:category>
    <description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
    <link>http://channel9.msdn.com/Niners/c4f.Robert-Fischer/Posts</link>
    <language>en</language>
    <pubDate>Fri, 24 May 2013 12:32:53 GMT</pubDate>
    <lastBuildDate>Fri, 24 May 2013 12:32:53 GMT</lastBuildDate>
    <generator>Rev9</generator>
    <c9:totalResults>1</c9:totalResults>
    <c9:pageCount>1</c9:pageCount>
    <c9:pageSize>25</c9:pageSize>
  <item>
      <title>Building a Full Featured Mobile Camera Application: C4FCamera</title>
      <description><![CDATA[
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/Code4FunPicture4_2.jpg"><img title="Code4FunPicture4" border="0" alt="Code4FunPicture4" align="right" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/Code4FunPicture4_thumb.jpg" width="180" height="240"></a><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/Code4FunPicture2_2.jpg"><img title="Code4FunPicture2" border="0" alt="Code4FunPicture2" align="right" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/Code4FunPicture2_thumb.jpg" width="180" height="240"></a></p>

<p>Maybe you have always wanted to get started developing a Windows Mobile 6.x application but weren't sure where or how to get started. The nice thing about mobile development is that it is actually simpler than desktop application development in many ways.
 This is due to the fact that when developing against the .NET Compact Framework you have fewer options. The .NET Compact Framework contains a subset of the .NET Framework. This article focuses on building a Mobile Camera Phone application using the Windows
 Mobile 6 SDK and the .NET Compact Framework Version 3.5. It is a great application for learning the Compact Framework since it covers a variety of scenarios you are likely to experience when developing a mobile application that you wouldn't typically come
 across when developing a desktop application.&nbsp; For a good source of background information for Windows Mobile Development, check out the following Microsoft site:
<a href="http://msdn.microsoft.com/en-us/windowsmobile/default.aspx">http://msdn.microsoft.com/en-us/windowsmobile/default.aspx</a></p>
<p>To build and run this application sample, you will need to install the following:</p>

<p>This article will not go through the steps of installing and configuring your development environment since it can get pretty involved. However a good starting point would be MSDN's article:
<a href="http://msdn.microsoft.com/en-us/library/bb158509.aspx"><i>Development Tools and Resources for Windows Mobile 6</i></a><i>.</i></p>
<h2>C4FCamera Solution Overview</h2>
<p>The C4FCamera Visual Studio solution contains three projects: <strong>C4FCamera</strong>,
<strong>C4FCameraLib</strong> and <strong>CameraTests</strong>. Three projects were created due to necessity. The C4FCamera application makes use of the
<i>CameraCaptureDialog</i> class. This class provides an easy, mobile-device-neutral wrapper for the camera and video functionality provided by the mobile device. This is very convenient because it abstracts away the specific implementations that would occur
 from the different mobile device manufacturers and the headaches that would occur if you needed to access each device through hardware specific drivers. This class returns a JPEG when used to capture still images.</p>
<p>A difficulty arises when developing with the <i>CameraCaptureDialog</i> class and testing the application using a mobile emulator. This is due to the emulator not having a real camera attached to it. The C4FCamera project allows you to save the picture as
 Color, Black and White, or Sepia tone. But since there is not an actual camera attached to the phone, how do you test the filters? In this project, we solved the problem by creating a mobile application library and then testing the application using a Visual
 Studio Test project. For Test Driven Design (TDD) practitioners, this would be just the beginning. For those not familiar with TDD, this gives you an example of one of the many benefits that come from using TDD.</p>
<p>Superficial exploration of C4FCamera will reveal that it demonstrates many common tasks and scenarios that would likely be encountered when developing a mobile application. First the project makes use of multiple mobile device forms and controls. Second,
 the application demonstrates several workarounds that arise from limitations in the compact framework. Altogether, the application should help the new mobile developer gain an understanding of how mobile development differs from other types of software development.</p>
<h2>Exploring the C4FCamera Project</h2>
<h4>The Main Application Interface: Coding4FunCameraForm</h4>
<p>The project has three forms. The main screen provides the user with the ability to set the location where pictures are stored, the resolution of the pictures, and the default file name. When developing a professional application, it may not make sense to
 offer all the settings to a user on the main interface. It is up to you to decide based on your knowledge of the target user's profile. The majority of the settings on the main form relate to the properties of the
<i>CameraCaptureDialog</i> class. The filter selection radio buttons are not directly related to the
<i>CameraCaptureDialog class</i>.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image002_5B7_5D.jpg"><img title="clip_image002[7]" border="0" alt="clip_image002[7]" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image002_5B7_5D_thumb.jpg" width="250" height="379"></a>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image004_5B7_5D.jpg">
<img title="clip_image004[7]" border="0" alt="clip_image004[7]" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image004_5B7_5D_thumb.jpg" width="250" height="296"></a></p>
<p>Many of the control settings and default values are kept in a resource file. A resource file provides a convenient location where localized settings can be kept. Since most text in an application is culture and location specific, it makes sense to use resource
 files as a matter of habit. Resource files can hold strings, images, icons, and even audio files.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image006_5B7_5D.jpg"><img title="clip_image006[7]" border="0" alt="clip_image006[7]" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image006_5B7_5D_thumb.jpg" width="500" height="273"></a></p>
<p>We will cover other aspects of the user interface later in this article. For now, it is important to recognize that the user interface directly relates to information we need to present to the
<i>CameraCaptureDialog</i> class. </p>
<h4>CameraCaptureDialog Class</h4>
<p>The C4FCamera application revolves around the <i>CameraCaptureDialog</i> class. This class is extremely simple to use. Below is the code from the C4FCamera project.</p>
<pre class="csharpcode">CameraCaptureDialog cameraCapture = <span class="kwrd">new</span> CameraCaptureDialog();
cameraCapture.StillQuality = <span class="kwrd">this</span>.StillQuality;
cameraCapture.Owner = <span class="kwrd">this</span>;
cameraCapture.DefaultFileName = textDefaultFileName.Text;
cameraCapture.InitialDirectory = PictureDirectoryPath.Text;
cameraCapture.Resolution = <span class="kwrd">new</span> Size(Convert.ToInt32(textWidth.Text), Convert.ToInt32(textHeight.Text));

<span class="rem">// Displays the &quot;Camera Capture&quot; dialog box</span>
<span class="kwrd">if</span> (DialogResult.OK == cameraCapture.ShowDialog())
{
   <span class="kwrd">string</span> fileName = cameraCapture.FileName.Replace(<span class="str">&quot;___TEMP&quot;</span>, <span class="str">&quot;&quot;</span>);
   ICameraFilter filter = GetPictureFilter(cameraCapture.FileName);
   <span class="kwrd">string</span> saveFileName = CameraFileUtilities.incrementFileNameNumber(fileName);
   filter.Apply().Save(saveFileName, ImageFormat.Jpeg);
   File.Delete(cameraCapture.FileName);
   <span class="rem">// The method completed successfully.</span>
   MessageBox.Show(
      <span class="str">&quot;The picture has been successfully captured and saved to:\n\n&quot;</span> &#43; saveFileName, <span class="kwrd">this</span>.Text,<br>       MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
}</pre>
<style type="text/css">
<!--
.csharpcode, .csharpcode 
	{font-size:small;
	color:black;
	font-family:consolas,"Courier New",courier,monospace;
	background-color:#ffffff}
.csharpcode 
	{margin:0em}
.csharpcode .rem
	{color:#008000}
.csharpcode .kwrd
	{color:#0000ff}
.csharpcode .str
	{color:#006080}
.csharpcode .op
	{color:#0000c0}
.csharpcode .preproc
	{color:#cc6633}
.csharpcode .asp
	{background-color:#ffff00}
.csharpcode .html
	{color:#800000}
.csharpcode .attr
	{color:#ff0000}
.csharpcode .alt
	{background-color:#f4f4f4;
	width:100%;
	margin:0em}
.csharpcode .lnum
	{color:#606060}
-->
</style>
<p>The code in this example creates a new instance of the <i>CameraCaptureDialog</i> class and then calls the
<b>ShowDialog</b> method. The <b>ShowDialog</b> method brings up the camera interface including the viewfinder of the camera. There really isn't much you can do with this interface, but fortunately you don't need to. When the
<b>ShowDialog</b> method returns, the class has already written the image to a file. What file? A file is created with the name specified in
<b>DefaultFileName</b> property. If a file with the same file name already exists it is overwritten. For a consumer application this would be unacceptable, so a method was added to prevent this.</p>
<p>Imagine you are at a friend's wedding. You capture a picture that exemplifies the specialness of the event. Later, you go to take a picture of one of your friends acting goofy at the reception. Without purposely creating some sort of file versioning logic,
 you are going to lose the original image. To address this issue, the <i>CameraFileUtilities</i> class and a static method called
<b>incrementFileNameNumber</b> are included with the project. This method performs a check to determine if a file with the same name exists. If one does, it increments the version number by one.</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">string</span> incrementFileNameNumber(<span class="kwrd">string</span> file)
{
    <span class="kwrd">string</span> newFileName;
    <span class="kwrd">int</span> fileVersionNumber = 0;

    FileInfo fileInfo = <span class="kwrd">new</span> FileInfo(file);
    newFileName = fileInfo.FullName;
    <span class="kwrd">if</span> (File.Exists(newFileName))
    {
        <span class="kwrd">do</span>
      {
        newFileName = fileInfo.DirectoryName &#43; <span class="str">&quot;\\&quot; &#43; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileInfo.Name.Replace(fileInfo.Extension, &quot;</span>&quot;) &#43; (&#43;&#43;fileVersionNumber) &#43; fileInfo.Extension;
      }
      <span class="kwrd">while</span> (File.Exists(newFileName));
    }

    <span class="kwrd">return</span> newFileName;
}</pre>
<p>There are many strategies you could employ here, but appending an integer value to the end of the file name before the extension is probably the simplest. We actually delete the file created by
<i>CameraCaptureDialog</i>. That is because we are applying a filter to the still image that we have captured. Even if we are applying the Color filter to the image, we want to call the
<i>ICameraFilter</i> interface and use the <b>Apply</b> method. Since the <b>Apply</b> method returns an instance of the
<i>Bitmap</i> class, we use the short hand of call <b>Save</b> on the <i>Bitmap</i> instance.</p>
<pre class="csharpcode">ICameraFilter filter = GetPictureFilter(cameraCapture.FileName);
<span class="kwrd">string</span> saveFileName = CameraFileUtilities.incrementFileNameNumber(fileName);
filter.Apply().Save(saveFileName, ImageFormat.Jpeg);
File.Delete(cameraCapture.FileName);</pre>
<p>The <i>ICameraFilter</i> is an interface. We are using this interface in a way that roughly resembles the Gang of Four Abstract Factory design pattern. The interface allows us to handle the
<i>ColorFilter</i> class, the <i>BlackAndWhiteFilter</i> class, and the <i>SepiaFilter</i> class in same way at runtime. Because they all implement the
<i>ICameraFilter</i> interface, we don't even care which one is selected, they all adhere to the contract defined in the
<i>ICameraFilter</i> interface. This allows receiving the correct class already instantiated (in other word: built), hence it is a factory pattern.
</p>
<h2>The ICameraFilter Interface and Filter Implementations</h2>
<p>The ICameraFilter interface is very simple. We are only expecting each filter to return a bitmap.
</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">interface</span> ICameraFilter
{
   Bitmap Apply();
}</pre>
<p>The actual implementation of the filters is little bit more complicated. Let's look at the code for the BlackAndWhiteFilter class.
</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> BlackAndWhiteFilter : ICameraFilter
{
    <span class="kwrd">private</span> <span class="kwrd">string</span> _fileName;
    <span class="kwrd">public</span> BlackAndWhiteFilter(<span class="kwrd">string</span> fileName)
    {
        <span class="kwrd">if</span> (!File.Exists(fileName))
        {
            <span class="kwrd">throw</span> <span class="kwrd">new</span> ApplicationException(
    <span class="str">&quot;Cannot apply Camera filter to a file that doesn't exist&quot;</span>);
        }
        <span class="kwrd">else</span>
        {
            <span class="kwrd">this</span>._fileName = fileName;
        }
    }

    <span class="preproc">#region</span> ICameraFilter Members

    <span class="kwrd">public</span> Bitmap Apply()
    {
        Bitmap newBitmap;

        <span class="kwrd">using</span> (Bitmap original = <span class="kwrd">new</span> Bitmap(_fileName))
        {
            <span class="rem">//make an empty Bitmap the same size as original</span>
            newBitmap =
               <span class="kwrd">new</span> Bitmap(original.Width, original.Height);

            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; original.Width; i&#43;&#43;)
            {
                <span class="kwrd">for</span> (<span class="kwrd">int</span> j = 0; j &lt; original.Height; j&#43;&#43;)
                {
                    <span class="rem">//get the pixel color from the original image</span>
                    Color originalColor = original.GetPixel(i, j);

                    <span class="rem">//create the grayscale pixel value</span>
                    <span class="kwrd">int</span> grayScale =
                       (<span class="kwrd">int</span>)((originalColor.R * .3) &#43;
                              (originalColor.G * .59) &#43;
                              (originalColor.B * .11));

                    <span class="rem">//create the color object</span>
                    Color newColor =
                       Color.FromArgb(grayScale, grayScale, grayScale);

                    <span class="rem">//set the new image's pixel to the grayscale pixel //value</span>
                    newBitmap.SetPixel(i, j, newColor);
                }
            }
        }
        <span class="kwrd">return</span> newBitmap;
    }

    <span class="preproc">#endregion</span>
}</pre>
<p>In the <i>BlackAndWhiteFilter</i>, we are creating a grayscale version of the image we received from the
<i>CaptureCameraDialog</i> class. The code adjusts every pixel, removing the red, green, and blue values from the pixel. This would actually be one of the least efficient ways to process the image if we were using the full .NET framework. However, we are using
 the .NET Compact Framework and this is one area where the differences become obvious. Using the full .NET Framework we would make use of the
<i>ColorMatrix</i> class. The <i>ColorMatrix</i> class is not available in the .NET Compact Framework and is rather complex to use. However, it is used commonly and most code samples involving grayscale will employ this method, so it is important to know about
 its existence. </p>
<p>The <i>SepiaFilter</i> is very much like the <i>BlackAndWhiteFilter</i>, with a couple of changes in the 2nd for loop.</p>
<pre class="csharpcode">Color originalColor = original.GetPixel(i, j);

<span class="kwrd">double</span> outputRed = (originalColor.R * .393) &#43; (originalColor.G * .769) &#43; (originalColor.B * .189);
<span class="kwrd">double</span> outputGreen = (originalColor.R * .349) &#43; (originalColor.G * .686) &#43; (originalColor.B * .168);
<span class="kwrd">double</span> outputBlue = (originalColor.R * .272) &#43; (originalColor.G * .534) &#43; (originalColor.B * .131);

<span class="kwrd">int</span> ioutputRed = Convert.ToInt16(outputRed);
<span class="kwrd">int</span> ioutputGreen = Convert.ToInt16(outputGreen);
<span class="kwrd">int</span> ioutputBlue = Convert.ToInt16(outputBlue);                        

<span class="kwrd">if</span> (ioutputRed &gt; 255)
      ioutputRed = 255;
<span class="kwrd">if</span> (ioutputGreen &gt; 255)
    ioutputGreen = 255;
<span class="kwrd">if</span> (ioutputBlue &gt; 255)
    ioutputBlue = 255;</pre>
<p>Since the filters are located in a Mobile Device Library, we can test the filters without using the mobile device camera. You simple create a test project and reference the library. Visual Studio will give a warning about using a mobile library with a test
 project. We ignored the warning without any ramifications. If you are concerned, paste the filters in a regular Windows Library project.</p>
<p>Once the filter has been applied, the image is written to … where? If you haven't set the main form to use a specific directory location, a default location will be set when the main form initializes. Since it is always unwise to assume the directory layout
 of any system, the code uses an environment defined enum that can be used to retrieve the initial path:
<i>Environment</i>.<b>SpecialFolder.Personal</b>. Using this enum, we can retrieve the user's personal directory.</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">string</span> _personaldirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
<span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">string</span> PersonalDirectory
{
      get { <span class="kwrd">return</span> _personaldirectory; }
}</pre>
<h6></h6>
<h6></h6>
<h2>Directory Browser Form</h2>
<p>The compact framework doesn't ship with a directory browser dialog. This makes it difficult for the user to configure the target storage location for the pictures. As this is a common problem when working in a Windows Mobile Smart Phone environment, a Directory
 Browser form has been added to the project. The form simply allows the user to browse the local file system and select an appropriate storage location for the images.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image017_5B7_5D.jpg"><img title="clip_image017[7]" border="0" alt="clip_image017[7]" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image017_5B7_5D_thumb.jpg" width="162" height="244"></a></p>
<p>The form itself consists of a <b>TreeView</b> control and a label to display the currently selected path. On initialization the form calls the
<b>PopulateTree</b> method which, as the name suggests, populates the <b>TreeView</b> control:</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">void</span> PopulateTree(<span class="kwrd">string</span> directoryValue, TreeNode parentNode)
{
    <span class="kwrd">string</span>[] directoryArray = Directory.GetDirectories(directoryValue);

    <span class="kwrd">try</span>
    {
        <span class="kwrd">if</span> (directoryArray.Length != 0)
        {
            <span class="kwrd">foreach</span> (<span class="kwrd">string</span> directory <span class="kwrd">in</span> directoryArray)
            {
                substringDirectory = directory.Substring(
                directory.LastIndexOf(<span class="str">'\\') &#43; 1,
                directory.Length - directory.LastIndexOf(<span class="str">'\\'</span></span>) - 1);

                TreeNode myNode = <span class="kwrd">new</span> TreeNode(substringDirectory);
                myNode.ImageIndex = 0;
                myNode.SelectedImageIndex = 1;

                parentNode.Nodes.Add(myNode);

                PopulateTree(directory, myNode);
            }
        }
    }
    <span class="kwrd">catch</span> (UnauthorizedAccessException)
    {
        parentNode.Nodes.Add(<span class="str">&quot;Access denied&quot;</span>);
    } <span class="rem">// end catch</span>
}</pre>
<p>This method recursively walks the file system starting at the root to build a complete directory tree. It also has some rudimentary error handling for unauthorized file system nodes.</p>
<p>The C4FCamera application employs this directory browser on the main configuration form. The user simply selects the target directory on the tree. The path of this directory is stored as a string in the
<b>SelectedDirectory</b> property of the form. On return, the configuration form uses the property to fetch the desired target path:</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">void</span> btnSetPictureDirectory_Click(<span class="kwrd">object</span> sender, EventArgs e)
{
    DirectoryBrowser directory = <span class="kwrd">new</span> DirectoryBrowser();
    directory.ShowDialog();
    <span class="kwrd">if</span> (directory.DialogResult == DialogResult.OK
        &amp;&amp; directory.SelectedDirectory != <span class="kwrd">string</span>.Empty)
    {
        PictureDirectoryPath.Text = directory.SelectedDirectory;
    }
}</pre>
<p>Building a directory browser is a simple way to add greater usability to your application.</p>
<h2>Browse Pictures Form</h2>
<p>In addition to the directory browser the application needs a simple way for users to be able to browse the results of their photography. To achieve this, a basic image browser was added to the project.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image021_5B7_5D.jpg"><img title="clip_image021[7]" border="0" alt="clip_image021[7]" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9725275/clip_image021_5B7_5D_thumb.jpg" width="158" height="240"></a></p>
<p>The Browse Pictures form provides the ability to view and delete images that are stored in the application's picture storage path. On initialization the form calls the
<b>InitializeViewer</b> method. This method checks the file type of each file in the storage directory. If the file is an image, the file name is added to a
<b>ComboBox</b> list and the first image file is loaded in a <b>PictureBox</b> control:</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">void</span> InitializeViewer(<span class="kwrd">string</span> directory)
{
    <span class="kwrd">bool</span> filesFound = <span class="kwrd">false</span>;
    dropdownPictures.Items.Clear();
    InitialDirectory = directory;
    <span class="kwrd">string</span>[] files = Directory.GetFiles(InitialDirectory);
    <span class="kwrd">foreach</span> (<span class="kwrd">string</span> file <span class="kwrd">in</span> files)
    {
        FileInfo fileinfo = <span class="kwrd">new</span> FileInfo(file);
        <span class="kwrd">if</span> (fileinfo.Extension.ToLower() == <span class="str">&quot;.jpg&quot;</span> ||
        fileinfo.Extension.ToLower() == <span class="str">&quot;.bmp&quot;</span> ||
        fileinfo.Extension.ToLower() == <span class="str">&quot;.jpeg&quot;</span>)
        {
            dropdownPictures.Items.Add(fileinfo.Name);
            filesFound = <span class="kwrd">true</span>;
        }

    }

    <span class="kwrd">if</span> (filesFound)
    {
        <span class="kwrd">string</span> file = files[0];
        Bitmap picture = <span class="kwrd">new</span> Bitmap(file);
        pictureViewer.Image = picture;
        dropdownPictures.SelectedIndex = 0;
    }
}</pre>
<p>A user can navigate the images in the directory by changing the selection in the
<b>ComboBox</b>. The currently selected image can be deleted by selecting <b>Delete</b> in the form menu.</p>
<p>The Picture Browser can be accessed through the application's main menu.</p>
<h2>Conclusion</h2>
<p>This article has shown you how to use an internal mobile camera with the .NET Compact Framework. The resulting application also addresses some of the limitations imposed by the mobile platform by presenting a basic directory browser. Additionally, it introduces
 some common image filtering methods for grayscale and sepia toned photos. Hopefully this will inspire you to go forward and create your own Windows Mobile applications.</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Niners/c4f.Robert-Fischer/Posts/RSS&WT.dl=0&WT.entryid=Entry:RSSView:7c4d661e74734dc7adcd9e7600cbf5f1">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Building-a-Full-Featured-Mobile-Camera-Application-C4FCamera</comments>
      <itunes:summary>
 

Maybe you have always wanted to get started developing a Windows Mobile 6.x application but weren&#39;t sure where or how to get started. The nice thing about mobile development is that it is actually simpler than desktop application development in many ways.
 This is due to the fact that when developing against the .NET Compact Framework you have fewer options. The .NET Compact Framework contains a subset of the .NET Framework. This article focuses on building a Mobile Camera Phone application using the Windows
 Mobile 6 SDK and the .NET Compact Framework Version 3.5. It is a great application for learning the Compact Framework since it covers a variety of scenarios you are likely to experience when developing a mobile application that you wouldn&#39;t typically come
 across when developing a desktop application.&amp;nbsp; For a good source of background information for Windows Mobile Development, check out the following Microsoft site:
http://msdn.microsoft.com/en-us/windowsmobile/default.aspx 
To build and run this application sample, you will need to install the following: 

This article will not go through the steps of installing and configuring your development environment since it can get pretty involved. However a good starting point would be MSDN&#39;s article:
Development Tools and Resources for Windows Mobile 6. 
C4FCamera Solution Overview
The C4FCamera Visual Studio solution contains three projects: C4FCamera,
C4FCameraLib and CameraTests. Three projects were created due to necessity. The C4FCamera application makes use of the
CameraCaptureDialog class. This class provides an easy, mobile-device-neutral wrapper for the camera and video functionality provided by the mobile device. This is very convenient because it abstracts away the specific implementations that would occur
 from the different mobile device manufacturers and the headaches that would occur if you needed to access each device through hardware specific drivers. This class returns a JPEG when used to c</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/articles/Building-a-Full-Featured-Mobile-Camera-Application-C4FCamera</link>
      <pubDate>Tue, 07 Jul 2009 16:01:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Building-a-Full-Featured-Mobile-Camera-Application-C4FCamera</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9725275_100.jpg" height="75" width="100"></media:thumbnail>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9725275_220.jpg" height="165" width="220"></media:thumbnail>      
      <dc:creator>Robert Fischer</dc:creator>
      <itunes:author>Robert Fischer</itunes:author>
      <slash:comments>11</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/articles/Building-a-Full-Featured-Mobile-Camera-Application-C4FCamera/RSS</wfw:commentRss>
      <category>Windows Mobile</category>
      <category>image manipulation</category>
    </item>    
</channel>
</rss>