Grant Hinkson Blog

Silverlight, WPF, Fireworks, Flash, XAML, .NET, User Experience, Graphic Design, Web Programming and more!

Archive for the ‘.NET’ Category

Live Photo Gallery Flickr Plugin

Sunday
Feb 8,2009

Shortly after Christmas, I downloaded the Windows Live Photo Gallery SDK and tinkered for a couple of hours one afternoon. I have yet to find (or create) the ultimate Flickr upload and sync tool, but I’m always searching for and thinking about it. Someday, when the earth’s rotation slows and we finally have 36 hour days, I’ll create this ultimate tool, but until then, you can check out my moderately nice updates to the Sample Flickr Plugin that ships with the SDK. If you have no idea what I’m talking about, you can:

Photo Gallery includes a publishing API that can be used to create custom plugins to publish your photos to any site. The app ships with a Flickr plugin and the SDK includes the source for the plugin. Without any modification, you can select a number of photos from your library then publish either to an existing Flickr Set or a new set. Along the way, you can set the permissions (public, friend, family, friend & family) for all of the photos you’re uploading.

So, this is where my modification comes in. There are times when I want to tag a few photos as public and the rest as private. With the default plugin, this would require two upload operations. With my updates, the plugin looks for specific tags on each photo that set flickr permissions:

switch (keyword.InnerText) { case "flickr: public" : isPublic = true; break; case "flickr: family" : isFamily = true; break; case "flickr: friends" : isFriend = true; break; case "flickr: friends+family" : isFriend = isFamily = true; break; default : tags.Add(keyword.InnerText); break; }

I can now quickly add a tag using Photo Gallery and let the plugin handle the permissions for me automatically. This is by no means a perfect solution, but something that has saved me some time. I had to change the plugin in a few places throughout the project, but you can find the heart of the change in the SessionLoadItemInfo method of XmlHelper.cs. If you just want to take the plugin for a spin, run PluginSample.msi found in the bin\Debug folder of the zip.

Download Source: Windows Live Photo Gallery Flickr Uploader

Sunday
Oct 26,2008

UPDATE: Click Here for the Latest Version
If you’re using Fireworks CS4 and the Fireworks to XAML Exporter, chances are you’ve seen a problem with the quotation marks in the rendered XAML. I first saw this several months ago, but assumed it was just an issue with a beta version of Blend I was using at the time. As it turns out, changes to the core Fireworks text rendering engine were actually causing the problem – a result of the way I was copying text to the clipboard.

The original version of the panel creates a Fireworks text block, pastes the generated XAML inside the text block, then does a clipCut() to remove the text block from the stage and copy it to the clipboard. The latest version (posted here), sends the XAML back to the Flash panel and, using the System.setClipboard() method, pastes the XAML to the clipboard. The result is a noticeably faster export operation, a very nice surprise.

I’ve also done a little additional housecleaning, adding support for the new pixel-based rounded corners feature of Fireworks CS4. This is actually one of my favorite new features — where previously the CornerRadius of rectangles in Fireworks was percentage-based (meaning the amount of roundness would change as you resized the rectangle) you can now specify a pixel-based CornerRadius. This approach ensures the same CornerRadius regardless of the size of the rectangle. (This is how both WPF and Silverlight do it also). The updated panel will honor both percentage and pixel-based roundness modes.

I also updated the way text is converted to paths. Now, instead of a group of individual path objects (the result you get when you select Text > Convert to Paths in Fireworks, I go two steps further, first ungrouping the indivual paths, then joining them into a single path. The result is a much cleaner single Path object.

One last fix I made over the weekend addresses a problem exposed by Silverlight. The FW to XAML panel automatically adds a .Resources collection to the outermost panel, should any of its children need to define a brush resource. Often, this Resources collection was rendered as an empty node <Grid.Resources />, something that the Silverlight engine does not like (WPF just ignores it). So, this latest update removes the Resources node if it’s empty. You’re welcome!

Summary of Changes

  • New Clipboard Logic – supports Fireworks CS4, improved performance
  • Support for both percentage and pixel-based rectangle roundness modes (pixel-based mode introduced with FW CS4)
  • Text to Paths operation results in fewer XAML objects
  • No longer render empty Resources collection (exposed via Silverlight)
Additional Notes
As always, you’re guinea pigs. Please let me know if you run into any problems with this update. I have run it through my standard gauntlet of tests, but I may have missed a use case.

DevScovery Redmond Session Files

Sunday
Sep 7,2008

A couple of weeks ago I presented two sessions at DevScoveryBlend for Developers, and Meeting in the Middle, designer/developer workflow (co-presented with Josh Smith). I’ve posted zip files for both presentations. The zip for the Blend session includes just the presentation itself, which may or may not be helpful. It basically defines a rough outline for the presentation. I’ve given that presentation a few times now, and each time it’s a little bit different, depending on the audience. I try to keep the session as interactive as possible, focusing on areas of the tool that are of interest to the current audience. I actually ended up spending a considerable amount of time discussing the different panels available in WPF, a little low-level for a Blend presentation, but necessary if you don’t have that fundamental knowledge of WPF layout.

Download DevScovery: Introduction to Blend Presentation

The Meeting in the Middle zip file includes the presentation, a demo project, and a Fireworks source file used for layout. This is the third time I’ve done this presentation and the second time I’ve done it with Josh. This time, we worked through the slides, covering core concepts in WPF that enable an effective designer/developer workflow and concluded the presentation by creating a simple XML-bound layout. Josh created the rough, developer-styled layout in Visual Studio, then I stepped in and imported artwork from Fireworks and tweaked the layout in Blend. We made it through without any problems – a miracle considering how many moving pieces there were. We kept the scope of the application extremely small though, so that worked in our favor.

Download DevScovery: Meeting in the Middle Presentation

NetAdvantage for WPF 2008.2 Public CTP

Wednesday
Aug 13,2008

If you don’t know about it yet, Infragistics posted a Public CTP of NetAdvantage for WPF 2008.2, which includes the new xamOutlookBar and Reporting features. From the post…

In an effort to get more code to the public faster, Infragistics’ WPF team has shipped an interim build of NetAdvantage for WPF controls planned for the 2008 Volume 2 release. This release includes two major enhancements: xamOutlookBar and Printing Capabilities that not only easily print the xamDataGrid, but allow for the creation of a fully stylized report. The xamOutlookBar is styled and has functionally modeled off of Outlook 2007 which greatly increases the developers ability to create line of business applications. The Printing Capabilities allow not only printing, but allow for publishing documents out as XPS.

Infragistics Silverlight CTP Posted

Monday
Jun 9,2008

The Infragistics Silverlight June CTP is now available for demo and download, compiled against Silverlight 2 Beta 2 released last Friday.

The CTP includes a Silverlight Chart and Silverlight Gauge both of which you can see in the online demo. So download the bits, take them for a test drive, then send us feedback and help shape the final shipping product!

Meta


Recent Comments