Reading XMP MetaData Keywords with WPF

WPF has an interesting way to read metadata associated with a photo.  All metadata can be extracted using the BitmapMetaData object.  The BitmapMetaData object supports the various metadata schemas including: Exif, tEXt, IFD, IPTC and XMP.

Here's a simply way to read an existing image's metada with C#:

BitmapMetadata metadata = (BitmapMetadata)myImage.Source.Metadata;

MessageBox.Show(metadata.Title);

Looking at the BitMapMetaData, you can find out all sorts of information such as camera model, date taken, caption, etc.  In particular, I was interested in reading the Tags added by Windows Photo Gallery in Vista.  The Microsoft Photography Blog article states that "All metadata written to photos by Windows Vista will be written to XMP (always directly to the file itself, never to a ‘sidecar’ file)."  Furthermore, I found that the tags are stored in the keywords collection in the metadata. Simple enough. I expanded my sample yesterday to display the tags associated with an image when it's selected. 

I haven't figured a way to programmatically add new tags to the images yet. I have some code in the demo to add new tags using the InPlaceBitmapMetadataWriter object that doesn't work. Let me know if I'm missing something.

An aside, the demo now also supports multiple files drag and drop.  I also cleaned up the styling a bit.

DragDropMedia2

Source: http://blogs.vertigosoftware.com/files/alan/dragdropmedia.zip

Compiled and Programmed with .NET 3.0 Framework.

posted by AlanL with 6 Comments

WPF Intra-App Drag Drop

I wanted to learn about drag and drop to a WPF application so I created this little demo. It's a simple app that accepts jpeg images and will display them when you drag files from windows explorer or photo gallery.  It also shows a copy DragDropEffect and a nsupported effect whether the files are supported or not.

This msdn help article explains more about Drag and Drop support in WPF.

Drag Drop Media

Source: http://blogs.vertigosoftware.com/files/alan/dragdropmedia.zip

posted by AlanL with 4 Comments

Photo Gallery and Windows Experience Index

Vista Photo Gallery Slideshow

I found out recently that your Windows Experience Index score can affect the feature set for certain programs in Vista, in addition to whether you can run Aero and Flip 3D.

For example, with a score of 3.0 or higher, the slideshow feature in Windows Photo Gallery is more robust.  It has nice transitions and themes support for the slideshow, which is very cool.  Definately check this out if you have a score higher 3. With a lower score you get static images that are replaced without transitions or blends between images.

You can read more about the Photo Gallery slideshow feature here.  “On par with the requirements to run Aero Glass, you’ll need a ‘Graphics’ score of at least 3.0. “

For in-depth look at the Windows experience index, check out the Vista Team Blog.

I did a quick search but didn't find a simple way to retrieve the Index score with C#.

posted by AlanL with 0 Comments

Vista Window Preview

One of the Vista features that I really like is the small preview windows as you hover over the taskbar.  I didn't know but discovered that video will play smoothly inside of these little window previews! 

Makes me wonder.. how was this done?  Can these little preview window be persistent.  It'll be great productivity boost for me in terms of multitasking if I can have a small copy of any window in the sidebar or floating about.  I can watch a screencast and code at the same time.  It's worth investigating.

posted by AlanL with 1 Comments

Scott Stanfield's AJAX/Atlas Demo

Vertigo's CEO, Scott Stanfield, just posted the source code for his beginner-level presentation on ASP.NET AJAX ("Atlas") given at the SoCal Technical Summit.  Scott has an uncanny ability to use a technology and explain it in a very understanding, easy to follow manner.  He took a unique approach of explaining ASP.NET AJAX by first showing how to do it directly with the XMLHttpRequest object.  He then shows the same functionality with ASP.NET AJAX and expands on that. He created the code live in his presentation last Saturday! 

You can catch Scott in his upcoming session at the Silicon Valley Code Camp.

posted by AlanL with 0 Comments

ASP.NET "Atlas" becomes ASP.NET AJAX, new header logo

It seems like the name change announced by ScottGu earlier this month is starting to populate.  The official Microsoft ASP.NET 2.0 AJAX Extensions site now states ASP.NET AJAX in a clean aero-like logo header instead of ASP.NET "Atlas".  The name change can also be seen on the ASP.NET AJAX Control Toolkit site.  I will update my ASP.NET AJAX resource list when/if the underlying URLS are changed.

posted by AlanL with 0 Comments

Install path for working with WPF

I want to get started working with Windows Presentation Foundation (WPF).  Good thing for me, Tim Sneath has compiled a complete list of links to the necessary installation files.  Perfect!

Also if you like the "How do I..." set of videos for ASP.NET 2.0 and Atlas, I found Fil Fortes screencast video demo on Channel 9 as the closest thing and an excellent, whirlwind demo of development for WPF.

posted by AlanL with 0 Comments

Running Windows Vista

I've made the jump to Windows Vista RC1 (Build 5728) yesterday.  Two things I did off the bat.

Disable UAC

Why? After a fresh OS installation I will most likely spend the day installing the programs that I use regularly.  Standard User rights and UAC slows the process down.  I pretty sure I know what I'm doing and I take full responsibility for any unsecure actions I may make.  Overall, I'm still undecided about the benefits of UAC for power users; I might not re-enable this feature.

Here's how to disable UAC:
Windows Vista Secret #4: Disabling UAC

Fix the Power Button

The Power Button on Vista defaults to Sleep mode.  There are a few problems with this for me.

  • Most likely when I hit the power button, I intend to Shutdown and not Sleep.  When I think of sleep mode, I think of closing the lid of my laptop.
  • Vista takes it time to wake up from sleep mode.  The OS is awake but my mouse (Logitech MX1000) takes a minute to function.  My keyboard (MS Natural Keyboard) remain unresponsive after sleep mode.

Here's how to change the Power Button to Shutdown:
Vista: Start Menu Power Button

 

Besides these two changes, so far I'm really digging Windows Vista RC1 5728.

posted by AlanL with 2 Comments

MS ASP.NET 2.0 AJAX Extensions (aka Atlas) Resources

I've been using Atlas for a few months now and have collected a number of resources.  I just want to share the list that I've compiled so far. 

Atlas References

I have a live feed in Firefox for quick access to these resources.

Atlas Blogs

Atlas related blogs in my feed reader.

Atlas Articles

Other Atlas Resources List

posted by AlanL with 5 Comments

Yellow Fade Technique with Atlas

After seeing the new animation capabilities in the Atlas Control Toolkit, I wanted to experiment with implementing the Yellow Fade Technique.  I can't believe how simple it is with the new UpdatePanelAnimationExtender.

Demo: http://atlas.vertigosoftware.com/atlasyellowfade/

Source: http://blogs.Vertigosoftware.com/files/alan/atlasyellowfade.zip

The Code

The code should be really straight-forward.  I have an Update panel which contains an ASP.NET Label.  The update panel is triggered by the submit button which will change the label text to say hello to whatever's in the Textbox control.  I also added a server timestamp to the label.

To apply the yellow fade technique, I wrap the update panel around a div container and add the UpdatePanelAnimationExtender with properties to enable animation when the update panel has been updated.  There are two animation configured to fire in parallel for 2 seconds.  The first changes the background color from a shade of yellow back to white.  The second animation fades the content of the updatecontainer.

The work is done in this piece of code.  No knowledge of javascript necessary*!


<
atlasToolkit:UpdatePanelAnimationExtender ID="upae" runat="server">
    <atlasToolkit:UpdatePanelAnimationProperties TargetControlID="UpdatePanel1">
        <Animations>
            <OnUpdated>
                <Sequence>
                    <Parallel duration="2" Fps="30">
                          <Color AnimationTarget="updatecontainer" StartValue="#FFEF3F" EndValue="#FFFFFF" Property="style" PropertyKey="backgroundColor" />
                          <FadeIn AnimationTarget="updatecontainer" minimumOpacity=".2" />
                    </Parallel>
                </Sequence>
            </OnUpdated>
        </Animations>
    </atlasToolkit:UpdatePanelAnimationProperties>
</
atlasToolkit:UpdatePanelAnimationExtender>

* The design time support for the UpdateAnimationExtender shows the animation as simply "(Text)", so you would need to know the syntax for animations to configure it.

posted by AlanL with 12 Comments

Atlas Control Toolkit - September?

I haven't seen an official announcement from the team yet, but it looks like a new release (marked 060914) of the Atlas Control Toolkit is up on the project's site at CodePlex.  From the description, the toolkit features four new controls: Animation, NoBot, Slider, and UpdatePanel Animation.  I linked the new controls to their corresponding pages on the Atlas Control Toolkit sample page.  It doesn't look like the new name change to "ASP.NET AJAX Control Toolkit" has populated to this release of the toolkit yet.

UpdatePanel Animation

I think the UpdatePanel Animation is a necessity.  Since the browser no longer flicker between refreshes with asynchronous callbacks, more clues with animation are needed to catch the user eye when something is being updated.  It looks like we can now easily create the Yellow Fade Technique in Atlas.

AnimationExtender

The animations found in the animation extender are also nice touch.  I need to check to see if it can do the cinematic effects like Rico.

Slider Control

I've been following the slider control when it was on Garbin's blog.  One problem I'm having this control, is getting it to trigger an UpdatePanel when the ValueChanged event is fired.  I'm have a similar problem with the Rating control Rated event.  Maybe someone has an easy way to wire up a javascript event handler to these events to get it to trigger UpdatePanels?

NoBot

Nobot is a contorl to prevent bot spam by identifying bots through 4 different criteria without requiring CAPTCHA.  I need to looke more into how this control works.


Check out these new controls and the existing controls in the toolkit.  Some really excellent stuff!

Update:  I missed this earlier, but there's some really good stuff in the animation department.  Check out the new documentation on "Using Animation".  Try the quick demos within that page.  Also there's an accompanying Animation Reference.
posted by AlanL with 1 Comments

Another way to deal with css differences

I wrote about using condition comments to deal with the styling differences between across browsers.  Nikhil Kothari suggests another method:

The trick is to programmatically set the class attribute on the HTML tag based on the browser, and you're done. This is obviously where a little bit of javascript comes into play to do detect the browser along with its version and programmatically set the class value as appropriate.

The css would then look like:

div#foo {
  background-color: red;
}
HTML.IE div#foo {
  background-color: yellow;
}
HTML.IE7 div#foo {
  background-color: blue;
}

While its good to know this approach, I would still prefer using IE conditional comments since it just seem clearer to me. There is a main css for Firefox and separate css files for IE6 and IE7 that only contain the css to address the css differences.

posted by AlanL with 1 Comments

Theme vs StyleSheetTheme

I wrote about using conditional comments to serve different css to IE browsers.  There is a little gotcha when using this this with ASP.NET Themes.

When applying themes by setting the "theme" property in the page directive or in web.config, the conditional comments appears before the the App_Theme code in the html source.  The effect is that this will overwrite your conditional comments due to the cascading nature of CSS and precedence.  One way to make the conditonal comments appear out after the css links from App_Theme is to use the StyleSheetTheme attribute instead of the Theme attribute.  This little talked about property will link App_Theme as the first thing in the Head tag (instead of the last).  Now your conditional css comments will take precedence over the styles in the App_theme.

You can read more about this on The Microsoft MSDN Library.

http://msdn2.microsoft.com/en-us/library/ykzx33wh....

Hope this helps.

UPDATE:  Steve Clements writes about another benefit from using StyleSheetTheme.  The StyleSheetTheme property gets applied much earlier during the page lifecycle than the Theme property.  With StyleSheetTheme, your theme will show up during design time. Steve also writes a caveat, "One thing to note is that setting EnableTheming=false doesn't stop applying the styleSheetTheme."

posted by AlanL with 1 Comments