Camera Hack – About page

About pages are mandatory in Windows Phone apps. You may occasionally come across apps that don’t have them because Microsoft was rather loose with the rules when they were first getting the marketplace approval processes worked out. An application must include the application name, version information, and technical support contact information that are easily discoverable. (I think they could have just supplied that info in the marketplace and made it discoverable via long tap on the app icon, but I’m not in charge.) So now, what was once a complete, simple, one page app of single purpose, gets all muddied up with some kind of navigation and another page and extra things you weren’t planning on adding to your app when you started.

And you figure if you’ve got to add a whole other page anyway, it might as well be pretty, and link to the full version (but only if you’re using the trial) and link to the app’s rating page and show a change log and jeez, this is sounding like an entire other app and a lot more testing to do. At this point, rather than reinventing the wheel, we do as all good developers do, and try to find some code. Preferably open source, free to use in commercial software code. And Windows Phone has a wonderful library for just such an occasion. Known as Your Last About Dialog, it’s hosted on Codeplex if you want to check out the source. But the recommended way of getting it into your project is using NuGet.

NuGet side note: If you use Visual Studio and third party libraries, and you don’t know what NuGet is, go make yourself familiar right now. Once it’s installed, you can right-click on your project in Visual Studio and click “Manage NuGet Packages…” and just add all sorts of stuff your project. It will add all the files you need to your project, make any configuration changes you need, and bam! you’re good to go. And if you start using a package and decide it’s just not working out, go back into the package manager and just uninstall. It will clean out all the settings, all the files, put everything back to how it started (except any code you may have written against it, you’ll still have to fix that yourself.)

Once installed via NuGet, you only need to write one line of code…. if you don’t count the actual button or menu item XAML and the code for the actual event. But still, it’s hardly anything.

So, I used an Application Bar Menu Item so my about page link would be out of the way in the hidden part of the AppBar.

<phone:PhoneApplicationPage.ApplicationBar>
	<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
		<shell:ApplicationBar.MenuItems>
			<shell:ApplicationBarMenuItem Text="About" Click="AboutMenuItem_Click"/>
		</shell:ApplicationBar.MenuItems>
	</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

And then in the code-behind I have my click event.

private void AboutMenuItem_Click(object sender, EventArgs e)
{
	NavigationService.Navigate(new Uri("/YourLastAboutDialog;component/AboutPage.xaml", UriKind.Relative));
}

Everything else is configured and managed by an XML file that magically appeared at \Content\About\Data.xml when the YLAD package was installed. And while I’m sure there is all sorts of extra neat functionality available in the XML file, all I did was enter my name and put my support email information into it. It handled figuring out if the user has the trial version and linking to the marketplace. It handled linking to the review page for users to review the app. It’s easy, it’s quick, it doesn’t require much extra testing. It would probably add less size to my final application file to code it myself, since there are some extra things that it can handle that I probably don’t need, but overall it added less than 60k to my file size, so I believe the ease of use and time savings outweigh that issue.

Advertisements

One thought on “Camera Hack – About page”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s