Posts Tagged JavaScript

Windows Store Apps: Add a Privacy Policy link to Settings Charm (C# & JavaScript)

In my (little) spare time recently, I’ve been playing around with developing Windows 8 Store apps. I submitted my very first app to the Store this week and unfortunately the app failed the certification process.

The reason for failure was simple… I requested Internet Connection permissions in the app and therefore, based on the Windows Store App certification requirements, I should have included a Privacy Policy link within the app. In fact, I needed to include the Privacy Policy link from the Settings Charm.

Of course, having never done this before I had no idea how to do this. After much searching, I finally figured out how to do this.

So if your app has failed in your quest to be certified, here’s the simple steps required to get a Privacy Policy link included in the Settings Charm for your Windows Store app….

C# Solution

1. Add the following name spaces
using Windows.UI.ApplicationSettings;
using Windows.UI.Popups;

2. Add the event handler to your app initialisation
SettingsPane.GetForCurrentView().CommandsRequested += SettingCharmManager_CommandsRequested;

3. Then add the following methods…
public SettingCharmManager()
{

SettingsPane.GetForCurrentView().CommandsRequested += SettingCharmManager_CommandsRequested;
}
private void SettingCharmManager_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
args.Request.ApplicationCommands.Add(new SettingsCommand(“privacypolicy”, “Privacy Policy”, PrivacyPolicyLink));
}

private async void PrivacyPolicyLink(IUICommand command)
{
Uri uri = new Uri(“<enter the full URL to your Privacy Policy here>”);
await Launcher.LaunchUriAsync(uri);
}

JavaScript Solution

var settingsPane = Windows.UI.ApplicationSettings.SettingsPane.getForCurrentView();
function commandsRequested(eventArgs) {
    var applicationCommands = eventArgs.request.applicationCommands;
    var privacyCommand = new Windows.UI.ApplicationSettings.SettingsCommand('privacy', 'Privacy Policy', function() {
        window.open('<enter your Privacy Policy URL here');
    });
    applicationCommands.append(privacyCommand);
}
settingsPane.addEventListener("commandsrequested", commandsRequested);

 

Assuming your Privacy Policy link is valid, you should not fail for this reason on your next app submission! :)

Enhanced by Zemanta

Tags: , , , , , , , , ,

No Comments

Simple image gallery & slideshow with Scriptaculous and Prototype

We’re currently working on a project using quite a lot of AJAX, which is great fun. We decided to go with the prototype and scriptaculous javascript framework for a number of reasons, but that did bring some difficulties.

One of the requirements of the project was a simple image gallery to show a number of images related to a particular record from the database. Obviously, since the site was predominantly AJAX’ed, we wanted a nice image gallery that would pup up on a mouseover from a dynamic URL that was called using AJAX.

However there were no simple “already built” javascript image galleries out there that use scriptaculous & prototype. Most of the more basic ones were developed on the MooTools framework and this caused a conflict with our other code.

So I set out to create a simple image gallery that we could use for the site.

I’m sure other people have had this problem, so I thought it would be a good idea to give it out to you all to play with yourself.

This isn’t the final version to be used as it’s been a while since I coded and I’m sure I haven’t done a very good job. But it works none the less and you can of course clean it yourself if you need to!

in terms of design I’ve also left it quite messy so that you can style it yourself. It’s very easy to template.

I don’t think I’ll bother boring you with the details of the script, I personally never read them and just download the code. Here’s the script to download – have fun!

Oh and here’s a demo example of it in action!

UPDATE:
Dave from ISOTOPE Communications has improved the script – you can get his version here:
http://www.icommunicate.co.uk/articles/all/simple_slide_show_for_prototype_scriptaculous_38/

Tags: , , , , ,

24 Comments