Update on another post
You may have seen my post in the 31 Apps in 31 Days blog. If you haven't already seen the 31 Apps in 31 Days blog, definitely check it out! There's already a week's worth of applications you can make using the Atalasoft family of tools in one way or another.
I got some requests to expand the functionality of my autorotater application, namely that it have some additional rotational functionality. Sometimes you'll stumble on those pictures that were taken with an orientation 90 degrees to the right or left, or even upside-down. Some viewers will read this orientation information and rotate the picture for you while viewing, but at the same time they don't update the orientation flag of the image. As a result the image may continue to be rotated by other viewers, or in this case, it'll be rotated by the AtalaAutoRotater.
To fix this, I've added two new buttons to the autorotater. This functionality was pretty easy to add with these few steps (technical stuff here, skip to MultiSelect if you don't like techie stuff).
- Modify the selectedIndexChanged event handler to enable/disable the rotation buttons. This is just an added visual to let users know they must select one or more images before rotating
- Add two buttons, and give them appropriate names btnRotLeft and btnRotRight.
- Add a wrapper function rotate_() that will gather a collection of thumbnails into a new ICollection<Thumbnail>() before calling rotate()
- Add a new enum that contains Left, Right, All
- Have the btnRotLeft and btnRotRight (modify btnRotate) call the wrapper with its direction
- Modify rotate() so that it accepts an ICollection<Thumbnail> and a Rotation enum. Check, before the switch, whether it's rotating all images, or a selection and update the orientation int if it's a selection Left/Right.
- Let the rest of the code do the work!
MultiSelect
But wait! You don't want your users having to select individual files and hit rotate buttons each time. So we'll make it possible to select a whole set of images to rotate. To select multiple images, users can either hold down the Ctrl key while selecting individual pictures, or the Shift key to select two endpoints of a range of photos.
For this functionality, the FolderThumbnailViewer needs to be updated as well. This might be a bit confusing, because there are two spots where you need to change options to get multiselect working, both in the FolderThumbnailView properties matrix. First, you have to enable MultiSelect, then you have the change the SelectionMode to MultiSelect from Single. Once that's done, the app is ready to go!

To make this a bit easier, I've included the source in the installer this time so there's only one file to download.
Get the installer