<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Dean Rowe's WebLog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/deanro/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/deanro/feed.xml</link>
    <description>Expression Encoder with little bits of MovieMaker and DVD Maker.</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:00:27 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Editing files with Encoder V3</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/editing-files-with-encoder-v3</link>
      <pubDate>Tue, 13 Apr 2010 22:34:32 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2010/04/13/editing-files-with-encoder-v3/</guid>
      <description><![CDATA[I’d written a previous post about editing files with Encoder v2 in the SDK however in V3 we changed...]]></description>
      <content:encoded><![CDATA[<p>I’d written a previous <a href="https://blogs.msdn.com/deanro/archive/2009/03/16/editing-files-with-encoder.aspx">post</a> about editing files with Encoder v2 in the SDK however in V3 we changed things a little bit to support adding multiple files to a single timeline. In the case where you want to edit bits out of a single file you now need to go through the Source object.</p>  <p>Here’s some sample code that does this which should hopefully be self-explanatory.</p>  <pre class="code"><span style="color: green">// Create a media item and get a pointer to the inital source.
</span><span style="color: #2b91af">MediaItem </span>item = <span style="color: blue">new </span><span style="color: #2b91af">MediaItem</span>(<span style="color: #a31515">@&quot;c:\users\Public\Videos\Sample Videos\Wildlife.wmv&quot;</span>);
<span style="color: #2b91af">Source </span>source = item.Sources[0];

<span style="color: green">// Change the first clip so that instead of spanning the entire file
// I'm just going to encode the bit from 5 to 10 seconds.
</span>source.Clips[0].StartTime = <span style="color: blue">new </span><span style="color: #2b91af">TimeSpan</span>(0, 0, 5);
source.Clips[0].EndTime = <span style="color: blue">new </span><span style="color: #2b91af">TimeSpan</span>(0, 0, 10);

<span style="color: green">// Also add the bit from 20 to 30 seconds from the original file.
</span><span style="color: #2b91af">TimeSpan </span>secondClipStart = <span style="color: blue">new </span><span style="color: #2b91af">TimeSpan</span>(0,0,20);
<span style="color: #2b91af">TimeSpan </span>secondClipEnd = <span style="color: blue">new </span><span style="color: #2b91af">TimeSpan</span>(0,0,30);
source.Clips.Add(<span style="color: blue">new </span><span style="color: #2b91af">Clip</span>(secondClipStart, secondClipEnd));</pre>
<a href="https://11011.net/software/vspaste"></a>]]></content:encoded>
    </item>
    <item>
      <title>Expression Encoder 3 Visual Basic Samples</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/expression-encoder-3-visual-basic-samples</link>
      <pubDate>Sun, 28 Feb 2010 22:59:11 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2010/02/28/expression-encoder-3-visual-basic-samples/</guid>
      <description><![CDATA[We shipped Expression Encoder 3 with a bunch of samples that demonstrated various aspects of the...]]></description>
      <content:encoded><![CDATA[<p>We shipped Expression Encoder 3 with a bunch of samples that demonstrated various aspects of the Expression Encoder 3 SDK. Some of them were shipped as C# only. Thanks to some good folks in Visual Studio these are now available in Visual Basic in the following CodePlex project.</p>  <p><a href="https://encoder3vb.codeplex.com/"></a><a href="https://encoder3vb.codeplex.com/">Expression Encoder 3 Visual Basic Samples</a></p>  <p>You can download them as one zip file by clicking on the Source Code tab and then clicking the Download tab on the right. If you have any problems let me know.<a href="https://encoder3vb.codeplex.com/"></a></p>]]></content:encoded>
    </item>
    <item>
      <title>What’s New in the Expression Encoder 3 SDK?</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/whats-new-in-the-expression-encoder-3-sdk</link>
      <pubDate>Thu, 30 Jul 2009 02:55:46 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2009/07/30/whats-new-in-the-expression-encoder-3-sdk/</guid>
      <description><![CDATA[Just posted a little article talking about the Expression Encoder 3 SDK over on the Expression...]]></description>
      <content:encoded><![CDATA[<p>Just posted a little article talking about the Expression Encoder 3 SDK over on the Expression Encoder team blog.</p>  <p><a href="https://blogs.msdn.com/expressionencoder/archive/2009/07/29/9853000.aspx">Link</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Microsoft Expression Encoder 3 is now available for download</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/microsoft-expression-encoder-3-is-now-available-for-download</link>
      <pubDate>Wed, 22 Jul 2009 13:57:20 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2009/07/22/microsoft-expression-encoder-3-is-now-available-for-download/</guid>
      <description><![CDATA[Check out the details on the Expression Encoder blog. Download it and tell us what you think.  Link]]></description>
      <content:encoded><![CDATA[<p>Check out the details on the Expression Encoder blog. Download it and tell us what you think.</p>  <p><a href="https://blogs.msdn.com/expressionencoder/archive/2009/07/22/9845044.aspx">Link</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Coming Soon: Expression Encoder 3</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/coming-soon-expression-encoder-3</link>
      <pubDate>Fri, 10 Jul 2009 14:38:28 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2009/07/10/coming-soon-expression-encoder-3/</guid>
      <description><![CDATA[James has just updated the Expression Encoder blog with details of Expression Encoder 3. The product...]]></description>
      <content:encoded><![CDATA[<p>James has just updated the Expression Encoder blog with details of Expression Encoder 3. The product that has been keeping us busy for a while now. Once it’s out I’ll try to post a little bit more than I have in the past :-)</p>  <p><a href="https://blogs.msdn.com/expressionencoder/archive/2009/07/10/9828866.aspx">Link</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Editing files with Encoder</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/editing-files-with-encoder</link>
      <pubDate>Mon, 16 Mar 2009 03:03:57 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2009/03/16/editing-files-with-encoder/</guid>
      <description><![CDATA[In Encoder V2 we added the ability to edit multiple sections out of a video/audio file and this can...]]></description>
      <content:encoded><![CDATA[<p>In Encoder V2 we added the ability to edit multiple sections out of a video/audio file and this can also be accomplished with the Expression Encoder SDK. MediaItem has a property called SourceClips which contains the list of clips for that media item. When you create a MediaItem it starts with one clip that encompasses the entire duration of the source. Each clip is represented by the SourceClip class and that contains two properties StartTime and EndTime. These properties indicate the times within the source file that the clip represents. For example, if I wanted to change it so that I only encoded the first 15 seconds of the file I could do something like the following. </p>  <blockquote>   <pre class="code"><span style="color: #2b91af">MediaItem </span>item = <span style="color: blue">new </span><span style="color: #2b91af">MediaItem</span>(<span style="color: #a31515">@&quot;C:\myvideo.wmv&quot;</span>);
item.SourceClips[0].EndTime = <span style="color: blue">new </span><span style="color: #2b91af">TimeSpan</span>(0, 0, 15);</pre>
</blockquote>

<p>If I wanted to include the time from 0-15 seconds and from 30-45 seconds of the file I could add the following lines.</p>

<blockquote>
  <pre class="code"><span style="color: #2b91af">TimeSpan </span>timeStart = <span style="color: blue">new </span><span style="color: #2b91af">TimeSpan</span>(0, 0, 30);
<span style="color: #2b91af">TimeSpan </span>timeEnd = <span style="color: blue">new </span><span style="color: #2b91af">TimeSpan</span>(0, 0, 45);
item.SourceClips.Add(<span style="color: blue">new </span><span style="color: #2b91af">SourceClip</span>(timeStart, timeEnd));</pre>
</blockquote>

<p>You can keep added SourceClip’s for as many sections of the source that you wish to add before calling the Encode method.</p>]]></content:encoded>
    </item>
    <item>
      <title>Metadata</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/metadata</link>
      <pubDate>Sat, 13 Dec 2008 01:56:57 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2008/12/13/metadata/</guid>
      <description><![CDATA[When encoding files using the Expression Encoder SDK, you may find there are times when you want to...]]></description>
      <content:encoded><![CDATA[<p>When encoding files using the Expression Encoder SDK, you may find there are times when you want to examine the current metadata and/or change the metadata on the file you’re creating. Let’s say you want to go through all the metadata items on an item, you can do something like this.</p>  <pre class="code"><span style="color: #2b91af">MediaItem </span>mediaItem = <span style="color: blue">new </span><span style="color: #2b91af">MediaItem</span>(<span style="color: #a31515">@&quot;C:\myvideo.wmv&quot;</span>);
<span style="color: blue">int </span>metadataCount = 0;
<span style="color: blue">foreach </span>(<span style="color: #2b91af">KeyValuePair</span>&lt;<span style="color: blue">string</span>, <span style="color: blue">string</span>&gt; pair <span style="color: blue">in </span>mediaItem.Metadata)
{
    <span style="color: #2b91af">Console</span>.WriteLine(pair.Key + <span style="color: #a31515">&quot;-&quot; </span>+ pair.Value);
}</pre>

<p>More frequently you’ll probably want to specify certain metadata before encoding the file. You can do this by doing something like the following before calling the Job’s Encode method</p>

<pre class="code">mediaItem.Metadata[<span style="color: #2b91af">MetadataNames</span>.Title] = <span style="color: #a31515">&quot;My Home Movies&quot;</span>;
mediaItem.Metadata[<span style="color: #2b91af">MetadataNames</span>.Author] = <span style="color: #a31515">&quot;Dean Rowe&quot;</span>;</pre>

<p>These are using the predefined metadata names that we’ve specified. If you want to specify your own custom metadata you can simply do something like</p>

<pre class="code">mediaItem.Metadata[<span style="color: #a31515">&quot;Fred&quot;</span>] = <span style="color: #a31515">&quot;Foo&quot;</span>;</pre>]]></content:encoded>
    </item>
    <item>
      <title>Expression Encoder 2 SDK Updated for Service Pack 1</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/expression-encoder-2-sdk-updated-for-service-pack-1</link>
      <pubDate>Thu, 13 Nov 2008 19:29:14 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2008/11/13/expression-encoder-2-sdk-updated-for-service-pack-1/</guid>
      <description><![CDATA[I’ve just uploaded a post to the Expression Encoder team blog that talks about the new updates to...]]></description>
      <content:encoded><![CDATA[<p>I’ve just uploaded a post to the Expression Encoder team blog that talks about the new updates to the Expression Encoder 2 SDK that we’ve just released for Service Pack 1. Go ahead and try it out and let us know if you have any questions or comments.</p>  <p><a href="https://blogs.msdn.com/expressionencoder/archive/2008/11/13/9067983.aspx">Link</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Bingo</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/bingo</link>
      <pubDate>Wed, 12 Nov 2008 00:48:00 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2008/11/12/bingo/</guid>
      <description><![CDATA[The other day my wife had volunteered to help out with the Halloween festivities at my son’s...]]></description>
      <content:encoded><![CDATA[<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/deanro/WindowsLiveWriter/Bingo_132C6/image_4.png" original-url="https://blogs.msdn.com/blogfiles/deanro/WindowsLiveWriter/Bingo_132C6/image_4.png" mce_href="https://blogs.msdn.com/blogfiles/deanro/WindowsLiveWriter/Bingo_132C6/image_4.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; MARGIN-LEFT: 0px; BORDER-TOP: 0px; MARGIN-RIGHT: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image align=right src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/deanro/WindowsLiveWriter/Bingo_132C6/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/deanro/WindowsLiveWriter/Bingo_132C6/image_thumb_1.png" width=231 height=244 mce_src="https://blogs.msdn.com/blogfiles/deanro/WindowsLiveWriter/Bingo_132C6/image_thumb_1.png"></A> The other day my wife had volunteered to help out with the Halloween festivities at my son’s school. As part of this, she wanted to organize a game of bingo for the kids. I promised to help and went online to search for some halloween bingo cards that could be generated or printed out. Unfortunately my searches weren’t fruitful. I found ones with numbers or words, but nothing that allowed me to uses images – which I thought would make it more fun for the young kids. </P>
<P>I thought about using Excel to generate the cards or maybe Word but that didn’t look to be as straightforward as I ‘d hope it might be. Then I thought “What about writing a quick WFP app?”. I hadn’t tried printing from WPF first, so I knocked up a quick app to try that out. Once that proved straightforward I just had to write some simple XAML to layout the card, get some halloween clipart from <A href="https://office.microsoft.com/en-us/clipart/default.aspx" mce_href="https://office.microsoft.com/en-us/clipart/default.aspx">office online</A> and write a little code to load and randomize the images. </P>
<P>So here’s what I ended up with. Each time you run it the app you get a “random” card and every time you click “Print” a new card is generated so you can just keep printing until you have enough cards.</P>
<P>The kids loved it. We gave a few prizes for the kids that got a line first and then we let the kids keeping playing until everybody had filled their card. Note that I deliberately chose to include every image on every card, so everybody filled out their card and shouted “house” at the same time. Of course it would be quite easy to change this behaviour.</P>
<P>If you ever want to do something like this yourself, just launch Visual Studio and create a new WPF application. Here’s what my window1.xaml looked like.</P><PRE class=code><SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">Window
    </SPAN><SPAN style="COLOR: red">xmlns</SPAN><SPAN style="COLOR: blue">="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
    </SPAN><SPAN style="COLOR: red">xmlns</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: red">x</SPAN><SPAN style="COLOR: blue">="https://schemas.microsoft.com/winfx/2006/xaml"
    </SPAN><SPAN style="COLOR: red">x</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: red">Class</SPAN><SPAN style="COLOR: blue">="UntitledProject4.Window1"
    </SPAN><SPAN style="COLOR: red">x</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: red">Name</SPAN><SPAN style="COLOR: blue">="Window"
    </SPAN><SPAN style="COLOR: red">Title</SPAN><SPAN style="COLOR: blue">="Bingo"
    </SPAN><SPAN style="COLOR: red">Width</SPAN><SPAN style="COLOR: blue">="850" </SPAN><SPAN style="COLOR: red">Height</SPAN><SPAN style="COLOR: blue">="900"&gt;

    &lt;</SPAN><SPAN style="COLOR: #a31515">StackPanel </SPAN><SPAN style="COLOR: red">x</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: red">Name</SPAN><SPAN style="COLOR: blue">="LayoutRoot"&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">Border </SPAN><SPAN style="COLOR: red">x</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: red">Name</SPAN><SPAN style="COLOR: blue">="BingoCard" </SPAN><SPAN style="COLOR: red">Margin</SPAN><SPAN style="COLOR: blue">="50,50,0,0" </SPAN><SPAN style="COLOR: red">HorizontalAlignment</SPAN><SPAN style="COLOR: blue">="Left" </SPAN><SPAN style="COLOR: red">VerticalAlignment</SPAN><SPAN style="COLOR: blue">="Top" </SPAN><SPAN style="COLOR: red">BorderBrush</SPAN><SPAN style="COLOR: blue">="#FF000000" </SPAN><SPAN style="COLOR: red">BorderThickness</SPAN><SPAN style="COLOR: blue">="5,5,5,5"&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">ItemsControl </SPAN><SPAN style="COLOR: red">ItemsSource</SPAN><SPAN style="COLOR: blue">="{</SPAN><SPAN style="COLOR: #a31515">Binding </SPAN><SPAN style="COLOR: red">ElementName</SPAN><SPAN style="COLOR: blue">=Window, </SPAN><SPAN style="COLOR: red">Path</SPAN><SPAN style="COLOR: blue">=Images}" &gt;
                &lt;</SPAN><SPAN style="COLOR: #a31515">ItemsControl.ItemsPanel</SPAN><SPAN style="COLOR: blue">&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">ItemsPanelTemplate</SPAN><SPAN style="COLOR: blue">&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">WrapPanel </SPAN><SPAN style="COLOR: blue">/&gt;
                    &lt;/</SPAN><SPAN style="COLOR: #a31515">ItemsPanelTemplate</SPAN><SPAN style="COLOR: blue">&gt;
                &lt;/</SPAN><SPAN style="COLOR: #a31515">ItemsControl.ItemsPanel</SPAN><SPAN style="COLOR: blue">&gt;
                &lt;</SPAN><SPAN style="COLOR: #a31515">ItemsControl.ItemTemplate</SPAN><SPAN style="COLOR: blue">&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">DataTemplate</SPAN><SPAN style="COLOR: blue">&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">Border </SPAN><SPAN style="COLOR: red">Width</SPAN><SPAN style="COLOR: blue">="142" </SPAN><SPAN style="COLOR: red">Height</SPAN><SPAN style="COLOR: blue">="142" </SPAN><SPAN style="COLOR: red">BorderBrush</SPAN><SPAN style="COLOR: blue">="#FF000000" </SPAN><SPAN style="COLOR: red">BorderThickness</SPAN><SPAN style="COLOR: blue">="5,5,5,5"&gt;
                            &lt;</SPAN><SPAN style="COLOR: #a31515">Image </SPAN><SPAN style="COLOR: red">Width</SPAN><SPAN style="COLOR: blue">="Auto" </SPAN><SPAN style="COLOR: red">Height</SPAN><SPAN style="COLOR: blue">="Auto" </SPAN><SPAN style="COLOR: red">Source</SPAN><SPAN style="COLOR: blue">="{</SPAN><SPAN style="COLOR: #a31515">Binding </SPAN><SPAN style="COLOR: red">Path</SPAN><SPAN style="COLOR: blue">=FileName}" </SPAN><SPAN style="COLOR: red">Margin</SPAN><SPAN style="COLOR: blue">="10,10,10,10"/&gt;
                        &lt;/</SPAN><SPAN style="COLOR: #a31515">Border</SPAN><SPAN style="COLOR: blue">&gt;
                    &lt;/</SPAN><SPAN style="COLOR: #a31515">DataTemplate</SPAN><SPAN style="COLOR: blue">&gt;
                &lt;/</SPAN><SPAN style="COLOR: #a31515">ItemsControl.ItemTemplate</SPAN><SPAN style="COLOR: blue">&gt;
            &lt;/</SPAN><SPAN style="COLOR: #a31515">ItemsControl</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">Border</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">Button </SPAN><SPAN style="COLOR: red">HorizontalAlignment</SPAN><SPAN style="COLOR: blue">="Left" </SPAN><SPAN style="COLOR: red">Margin</SPAN><SPAN style="COLOR: blue">="20,20,0,44" </SPAN><SPAN style="COLOR: red">Width</SPAN><SPAN style="COLOR: blue">="97" </SPAN><SPAN style="COLOR: red">Height</SPAN><SPAN style="COLOR: blue">="30" </SPAN><SPAN style="COLOR: red">Content</SPAN><SPAN style="COLOR: blue">="Print" </SPAN><SPAN style="COLOR: red">Click</SPAN><SPAN style="COLOR: blue">="OnPrint" </SPAN><SPAN style="COLOR: red">IsDefault</SPAN><SPAN style="COLOR: blue">="True"/&gt;
    &lt;/</SPAN><SPAN style="COLOR: #a31515">StackPanel</SPAN><SPAN style="COLOR: blue">&gt;
&lt;/</SPAN><SPAN style="COLOR: #a31515">Window</SPAN><SPAN style="COLOR: blue">&gt;</SPAN></PRE><A href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></A><A href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></A>
<P><A href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></A>and here’s the corresponding C# file.</P><PRE class=code><SPAN style="COLOR: blue">using </SPAN>System;
<SPAN style="COLOR: blue">using </SPAN>System.Collections.ObjectModel;
<SPAN style="COLOR: blue">using </SPAN>System.Windows;
<SPAN style="COLOR: blue">using </SPAN>System.Windows.Controls;

<SPAN style="COLOR: blue">namespace </SPAN>UntitledProject4
{
    <SPAN style="COLOR: blue">public class </SPAN><SPAN style="COLOR: #2b91af">ImageData
    </SPAN>{
        <SPAN style="COLOR: blue">public </SPAN>ImageData(<SPAN style="COLOR: blue">string </SPAN>fileName)
        {
            <SPAN style="COLOR: blue">this</SPAN>.FileName = fileName;
        }

        <SPAN style="COLOR: blue">public string </SPAN>FileName { <SPAN style="COLOR: blue">get</SPAN>; <SPAN style="COLOR: blue">set</SPAN>; }    
    }

    <SPAN style="COLOR: blue">public partial class </SPAN><SPAN style="COLOR: #2b91af">Window1
    </SPAN>{
        <SPAN style="COLOR: gray">/// &lt;summary&gt;
        /// </SPAN><SPAN style="COLOR: green">The list of images that are databound to.
        </SPAN><SPAN style="COLOR: gray">/// &lt;/summary&gt;
        </SPAN><SPAN style="COLOR: blue">private </SPAN><SPAN style="COLOR: #2b91af">ObservableCollection</SPAN>&lt;<SPAN style="COLOR: #2b91af">ImageData</SPAN>&gt; m_images = <SPAN style="COLOR: blue">new </SPAN><SPAN style="COLOR: #2b91af">ObservableCollection</SPAN>&lt;<SPAN style="COLOR: #2b91af">ImageData</SPAN>&gt;();
        
        <SPAN style="COLOR: gray">/// &lt;summary&gt;
        /// </SPAN><SPAN style="COLOR: green">The print dialog. We store it as a member variable so any printer settings are preserved
        </SPAN><SPAN style="COLOR: gray">/// </SPAN><SPAN style="COLOR: green">across multiple prints.
        </SPAN><SPAN style="COLOR: gray">/// &lt;/summary&gt;
        </SPAN><SPAN style="COLOR: blue">private </SPAN><SPAN style="COLOR: #2b91af">PrintDialog </SPAN>m_prtDlg = <SPAN style="COLOR: blue">new </SPAN><SPAN style="COLOR: #2b91af">PrintDialog</SPAN>();

        <SPAN style="COLOR: gray">/// &lt;summary&gt;
        /// </SPAN><SPAN style="COLOR: green">Initialize a instance of the Window1 class, that holds a bingo card.
        </SPAN><SPAN style="COLOR: gray">/// &lt;/summary&gt;
        </SPAN><SPAN style="COLOR: blue">public </SPAN>Window1()
        {
            <SPAN style="COLOR: green">// Load the images - in this case I'm just loading them from c:\temp\halloween
            </SPAN><SPAN style="COLOR: blue">for </SPAN>(<SPAN style="COLOR: blue">int </SPAN>i = 1; i &lt;= 25; i++)
            {
                m_images.Add(<SPAN style="COLOR: blue">new </SPAN><SPAN style="COLOR: #2b91af">ImageData</SPAN>(<SPAN style="COLOR: #a31515">@"C:\temp\halloween\" </SPAN>+ i.ToString() + <SPAN style="COLOR: #a31515">".bmp"</SPAN>));
            }

            <SPAN style="COLOR: green">// Randomize them.
            </SPAN><SPAN style="COLOR: blue">this</SPAN>.RandomizeImages();

            <SPAN style="COLOR: blue">this</SPAN>.InitializeComponent();
        }

        <SPAN style="COLOR: gray">/// &lt;summary&gt;
        /// </SPAN><SPAN style="COLOR: green">Gets the collection of images to use for the bingo card.
        </SPAN><SPAN style="COLOR: gray">/// &lt;/summary&gt;
        </SPAN><SPAN style="COLOR: blue">public </SPAN><SPAN style="COLOR: #2b91af">ObservableCollection</SPAN>&lt;<SPAN style="COLOR: #2b91af">ImageData</SPAN>&gt; Images
        {
            <SPAN style="COLOR: blue">get
            </SPAN>{
                <SPAN style="COLOR: blue">return </SPAN>m_images;
            }
        }

        <SPAN style="COLOR: gray">/// &lt;summary&gt;
        /// </SPAN><SPAN style="COLOR: green">Called to print the bingo card. The images are randomized after every print.
        </SPAN><SPAN style="COLOR: gray">/// &lt;/summary&gt;
        /// &lt;param name="sender"&gt;</SPAN><SPAN style="COLOR: green">The sender of the event.</SPAN><SPAN style="COLOR: gray">&lt;/param&gt;
        /// &lt;param name="e"&gt;</SPAN><SPAN style="COLOR: green">The event arguments</SPAN><SPAN style="COLOR: gray">&lt;/param&gt;
        </SPAN><SPAN style="COLOR: blue">private void </SPAN>OnPrint(<SPAN style="COLOR: blue">object </SPAN>sender, <SPAN style="COLOR: #2b91af">RoutedEventArgs </SPAN>e)
        {
            <SPAN style="COLOR: blue">if </SPAN>(m_prtDlg.ShowDialog() == <SPAN style="COLOR: blue">true</SPAN>)
            {
                m_prtDlg.PrintVisual(<SPAN style="COLOR: blue">this</SPAN>.BingoCard, <SPAN style="COLOR: #a31515">"Bingo"</SPAN>);
            }

            RandomizeImages();
        }

        <SPAN style="COLOR: gray">/// &lt;summary&gt;
        /// </SPAN><SPAN style="COLOR: green">Randomly shuffle the images
        </SPAN><SPAN style="COLOR: gray">/// &lt;/summary&gt;
        </SPAN><SPAN style="COLOR: blue">private void </SPAN>RandomizeImages()
        {
            <SPAN style="COLOR: #2b91af">Random </SPAN>random = <SPAN style="COLOR: blue">new </SPAN><SPAN style="COLOR: #2b91af">Random</SPAN>();
            <SPAN style="COLOR: blue">int </SPAN>imagesCount = m_images.Count;
            <SPAN style="COLOR: blue">for </SPAN>(<SPAN style="COLOR: blue">int </SPAN>i = 0; i &lt; imagesCount; i++)
            {
                <SPAN style="COLOR: blue">int </SPAN>randomIndex = random.Next(0, imagesCount);
                <SPAN style="COLOR: #2b91af">ImageData </SPAN>imageData = m_images[randomIndex];
                m_images[randomIndex] = m_images[i];
                m_images[i] = imageData;
            }
        }
    }
}</PRE><A href="https://11011.net/software/vspaste" mce_href="https://11011.net/software/vspaste"></A>
<P mce_keep="true">&nbsp;</P>
<P>Hopefully the code should be self explanatory.</P>]]></content:encoded>
    </item>
    <item>
      <title>Expression Encoder 2 SP1 SDK</title>
      <link>https://docs.microsoft.com/archive/blogs/deanro/expression-encoder-2-sp1-sdk</link>
      <pubDate>Mon, 10 Nov 2008 15:06:15 GMT</pubDate>
      <dc:creator><![CDATA[Dean Rowe]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deanro/2008/11/10/expression-encoder-2-sp1-sdk/</guid>
      <description><![CDATA[As you may have heard Expression Encoder 2 SP1 is now available to download. We've been putting the...]]></description>
      <content:encoded><![CDATA[<p>As you may have heard <a href="https://blogs.msdn.com/expressionencoder/archive/2008/09/23/8962401.aspx">Expression Encoder 2 SP1</a> is now available to <a href="https://www.microsoft.com/downloads/details.aspx?FamilyId=A29BE9F9-29E1-4E70-BF67-02D87D3E556E&amp;displaylang=en">download</a>. We've been putting the final touches to the updated SDK which will included an updated help file, intellisense files and some samples in C# and now also in Visual Basic. The SDK should be released soon.</p>]]></content:encoded>
    </item>
  </channel>
</rss>