C++/DirectX: Adding a privacy statement to a template app

So you read and read, work through the example code and then you ask yourself this question: Why don’t the template apps include a privacy statement method?  Don’t I almost always have to have a privacy statement?  And why don’t the example apps have a privacy statement?  You might ask yourself the question if there is something extremely hard about privacy statements?

Well I have no idea why the templates don’t include a privacy statement, it seems like missing an important part of development, but that is someone else’s decision.

So let’s start with the VS2013 Windows 8.1 template app, DirectX App (XAML) and add a privacy policy.  Now you will need to change the privacy policy web page to map to your privacy policy, use Azure, it cheap and easy.  Ok, maybe easy and important for your resume, cloud is the big deal.

image

Header file

In the <Project Name>.h here <Project Name> is the name of your project, in this case it might be App11.h

image

Source File (there are a number of images):

Add: using namespace Windows::UI::ApplicationSettings; to the top of the source file (you can add it elsewhere if you want to, but you will use it a lot so this is the best place.)

image

Create the PrivacyPolicy method:

image

Add the method call code between the two braces:

//****************Copy starts here ***********************************************

SettingsPane::GetForCurrentView()->CommandsRequested +=
        ref new TypedEventHandler<SettingsPane^, SettingsPaneCommandsRequestedEventArgs^>(
        [this](SettingsPane^ sender, SettingsPaneCommandsRequestedEventArgs^ args)
    {
         args->Request->ApplicationCommands->Append(
            ref new SettingsCommand(
            "privacyPolicy",
             "Privacy Policy",
            ref new Windows::UI::Popups::UICommandInvokedHandler([=](Windows::UI::Popups::IUICommand^ command)
        {
            // The URI to launch
            // Be sure to replace this string with the URL to your privacy policy.
            auto uri = ref new Windows::Foundation::Uri("https://socalprivacypolicy.azurewebsites.net/privacypolicy.html");

            // Launch the URI
            concurrency::task<bool> launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri));
            launchUriOperation.then([](bool success){});
        })));
    });

//*********************Copy ends here **************************************

Add the privacy policy method call:

image