Sunday, August 25, 2013

Integrate Microsoft Translator API in Windows Store App

Microsoft Translator is a hosted service, accessed via an API that provides language translation. It can be used to build applications, web sites, utilities, or any scenario where you need language translation. In this article, you’ll walk, step-by-step, through everything you need to get started with using the Translator API to translate content by signing up for the service, registering an application, and getting your Client ID and Client secret.

Before you begin

There are a couple things you’ll need in order to be able to proceed.
Make sure that you have a free Microsoft account. You’ll need this to sign-in to Windows Azure Marketplace, subscribe to the service, and to build Windows 8 applications. You can sign up for one at http://login.live.com
Get Windows 8 and the Windows 8 developer tools from here: http://msdn.microsoft.com/en-
US/windows/apps/br229516.aspx. You can download an evaluation copy of Windows 8 if you aren’t an MSDN subscriber. The Visual Studio 2012 Express tools are also free.

Get an account on Windows Azure Marketplace

The Microsoft Translator API is accessible through Microsoft Windows Azure Marketplace. You can see it here:
https://datamarket.azure.com/.
To begin developing using the Microsoft Translator API, you need to do the following:
1. Register for an account on Windows Azure Marketplace.
If you already have an account, you can use it, but it’s recommended that you follow through these
steps to ensure that you configure the service correctly
2. Sign up for the Microsoft Translator API using your registered account.
3. Register your application on Windows Azure Marketplace.
4. Get the Client ID and Client Secret for your registered application.
The following instructions will show you how to do this. When you’ve completed them, you’ll be ready to start coding.

Step 1. Sign in and Register.

Sign-in to Windows Azure Marketplace. If this is your first time, you’ll likely see this registration page.
Fill out your details, and press the ‘Continue’ button.You’ll be taken to the Terms of Use page. Read it carefully, and if you accept it, check the box at the bottom of the screen that says ‘I accept the Terms of Use’, and press the ‘Register’ button.
Once you’ve done this, you’ll be taken back to the main Windows Azure Marketplace webpage.

Step 2. Subscribe to the Microsoft Translator API.

In this section you’ll subscribe to the Microsoft Translator API in the Windows Azure Marketplace. There are a number of service options you can choose, and in this walkthrough you’ll see how to use the free one.
Step 2.1. Find the Microsoft Translator API service in the Windows
Azure Marketplace
If you’ve completed the Windows Azure Marketplace registration (Step 1), then visit
https://datamarket.azure.com/ to see the main Marketplace home page. At the top of the screen, you’ll see a
‘Search’ box. Type ‘translator’ into this box and press enter, or click the button on the right that is shaped like a magnifying glass.
In the search results, you’ll see the Microsoft Translator API:

Step 2.2. Subscribe to the Translator API service.

Click on ’Microsoft Translator’ and you’ll be taken to the Microsoft Translator API Offer page on Windows Azure Marketplace.
(Note: For a short cut, you can also go directly to the screen by visiting this URL:
https://datamarket.azure.com/dataset/bing/microsofttranslator)
On the right hand side of the screen, you’ll see a number of different monthly volume offers. Choose the one that meets your monthly volume usage needs. For this guide, you’ll use the free 2 million characters per month subscription offer, which you can find at the bottom of the list.
Press the ‘Sign Up’ link on your chosen offer and you’ll be taken to a page where you are asked to confirm and
agree that you will adhere to the Translator API ‘Offer Terms and Privacy Policy’.
If you agree, check the box and press the Sign Up button.
You’ll then be taken to the page confirming that you’ve successfully subscribed to the service and the volume goes
into effect at that time. In the next step, you’ll get your developer credentials from Windows Azure Marketplace, and you’ll use these when building your apps.

Step 3. Getting your Developer Credentials

This step assumes that you have:
· Completed Steps 1 and 2
· You have registered for a Windows Azure Marketplace account
· You have used your Marketplace account to subscribe to the Microsoft Translator API service.

Step 3.1. Registering your application on the Windows Azure Marketplace.
Sign in to https://datamarket.azure.com/, and you’ll see the familiar welcome page. At the bottom of the page, you’ll see a number of links, organized into columns.

One of these reads ‘Develop’, and under it you’ll see a link that says ‘Register your Application’.
Select this and you’ll be taken to the screen that allows you register your application.

Step 3.2. Getting your Client ID and Client Secret

You use this to get the Client ID and Client Secret values that your application will need to authenticate your service
when you build your application.

Fill out the Client ID, and Name fields.
· The Client Secret field is already completed for you. Do not change it.
· Fill out the ‘Redirect URI’ field with any valid URL that uses https, for example https://microsoft.com. This field is
not used by the Microsoft Translator API.
You can also leave the ‘Enable subdomain access’ checkbox unchecked, as Translator doesn’t use it.

Remember and note the Client ID and Client Secret fields. You will need these when you write your app.
Here’s an example:

If, in the future you want to create new apps, you can go straight to this screen:
https://datamarket.azure.com/developer/applications/register
To see a list of the apps you have on Marketplace, and see their Client ID and Client Secret visit:
https://datamarket.azure.com/developer/applications and press the ‘Edit’ link to see the details for your app.
Next, you’ll be taken to a page containing the list of your applications. (Note: For future reference, here’s a
shortcut: https://datamarket.azure.com/developer/applications)
You should see your application at the bottom of this screen, like this. If you want to change the Client ID, you can
do so from the ’Edit’ link, or you can register new applications with the Register button.

Monday, August 19, 2013

Implementation of Bing Maps in Windows 8 app



Application Name: This can be anything you want. It’s mainly meant for your own information and to make it easier for you to manage your keys.
Application URL: This is an optional value that is mainly meant for your own information.
Key Type: There are three choices. If you are creating an asset tracking or internal application then you will need an enterprise key. Otherwise choose basic. Note you need a licensed account to create enterprise keys.
Application type: If you are creating an asset tracking or internal application then you will need to choose either private website for internal or Business Asset Management. Otherwise choose Windows Metro Style App.
To do this, right click on the References folder and press Add Reference. Select Windows -> Extensions select Bing Maps for C#, C++ and Visual Basic. If you do not see this option ensure that you have installed the Bing Maps SDK for Windows 8 style apps. While you are here also add a reference to the Microsoft Visual C++ Runtime Package as this is required by the Bing Maps SDK when developing using C# or Visual Basic.
A reference to the Microsoft Visual C++ Runtime Package is required by the Bing Maps SDK when developing using C# or Visual Basic.
You may notice that there is a little yellow indicator on the references that you just added. The reason for this is that the Bing Maps SDK requires that you set the Active solution platform in Visual Studio.

Open up the MainPage.xaml page or the XAML file you want to include Bing Maps in. Add a reference to the Bing Maps API in the namespaces. In the body of the page add a Map element and insert a Bing Maps key. This is where the Bing Maps control will be displayed.

Press F5 for run the app. Start reading more and more about Bing Maps and create something impressive.

Saturday, August 17, 2013

How to write Windows Store Privacy Statement in C#

One of the most common reasons Windows 8 apps fail certification is lack of a privacy statement, this blog explains when you need one and gives tips on how to do it.

Do I need a privacy policy for my app?

“Your app must have a privacy policy if it collects personal information”
Now most of us building apps read that and think, hey I’m not collecting anyone’s email address or phone numbers with my app so I don’t need a privacy statement. Then you submit your app for certification and it fails! Why?
Personal information includes: Webcam snaps, Audio/Video recordings, Photos, Documents, Contacts, and so on. So if you are using the webcam to take pictures or creating a document that access contact information or users files you need a privacy statement.
Personal information also includes: IP Addresses. That means if your app has the ‘internet client’ capability enabled in your app you are going to need a privacy statement. By the way, the default templates in Visual Studio include the ‘internet client’ capability, so unless you change the default manifest, you will need a privacy statement.
What do I put in a privacy policy?
“In general, an acceptable privacy policy is one that:
  • Informs users of the information collected by your app
  • Informs users how that information is used, stored, secured and disclosed
  • Describes the controls that users have over the use and sharing of their information
  • Describes how they may access their information
  • Complies with applicable laws and regulations
STEPS to create privacy policy in your app:
1.Create or host a website either in Windows Azure or blog in blogger.
2. Write your privacy policy in a post.
3.When you submit your app for certification, and you fill out the description section of your app, be sure to enter the URL to the privacy policy you created above.

Now add Privacy Statement in Windows 8 Charm Settings 

//Do the following in your App.xaml.cs:

//1) Add the namespaces

using Windows.UI.ApplicationSettings; 
using Windows.UI.Popups;

//2) Add the handler during app initialization

SettingsPane.GetForCurrentView().CommandsRequested += SettingCharmManager_CommandsRequested;

//3) Add my handler that shows the privacy text

private void SettingCharmManager_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            args.Request.ApplicationCommands.Add(new SettingsCommand("privacypolicy", "Privacy policy", OpenPrivacyPolicy));
        }


//4) Add OpenPrivacyPolicy method

private async void OpenPrivacyPolicy(IUICommand command)
        {
            Uri uri = new Uri("<insert web url to your privacy policy here>");
            await Windows.System.Launcher.LaunchUriAsync(uri);
        }


That's should help you get your connected apps through this certification requirement... good luck!

Wednesday, August 14, 2013

Download Windows 8 app templates

Download windows 8 app templates and give your apps a impressive design and styling.
Templates are available in two programming language: C# and JavaScript with complete source code.

Links for downloading the templates:

Windows 8 App Design Reference Template: Baby Journal 
Windows 8 App Design Reference Template: Basic Game 
Windows 8 App Design Reference Template: Block Style Color
Windows 8 App Design Reference Template: Block Style Picture
Windows 8 App Design Reference Template: Blocks 
Windows 8 App Design Reference Template: Brick Style
Windows 8 App Design Reference Template: Cook Book
Windows 8 App Design Reference Template: Drawing 
Windows 8 App Design Reference Template: E-Commerce Electronics
 Windows 8 App Design Reference Template: E-Commerce Fashion 
Windows 8 App Design Reference Template: ECommerce Jewellery 
Windows 8 App Design Reference Template: Education Dark Banner
 Windows 8 App Design Reference Template: Education Guide 
Windows 8 App Design Reference Template: Finance 
Windows 8 App Design Reference Template: Financial Adviser 
Windows 8 App Design Reference Template: Fitness 
Windows 8 App Design Reference Template: Food 
Windows 8 App Design Reference Template: Food and Dining 
Windows 8 App Design Reference Template: Food Light 
Windows 8 App Design Reference Template: Food Variable
 Windows 8 App Design Reference Template: Forum 
Windows 8 App Design Reference Template: Health & Fitness
 Windows 8 App Design Reference Template: Health Management
 Windows 8 App Design Reference Template: Invitation 
Windows 8 App Design Reference Template: Language Convertor
 Windows 8 App Design Reference Template: Lifestyle 
Windows 8 App Design Reference Template: Lifestyle Light
 Windows 8 App Design Reference Template: Magazine
 Windows 8 App Design Reference Template: Matching
 Windows 8 App Design Reference Template: Measurement
 Windows 8 App Design Reference Template: Music
 Windows 8 App Design Reference Template: Music and video 
Windows 8 App Design Reference Template: Music Zone 
Windows 8 App Design Reference Template: News 
Windows 8 App Design Reference Template: News and Weather
 Windows 8 App Design Reference Template: News Big Image
 Windows 8 App Design Reference Template: News Dark 
Windows 8 App Design Reference Template: News Grey
 Windows 8 App Design Reference Template: News Light Theme
 Windows 8 App Design Reference Template: News Variable Tile
 Windows 8 App Design Reference Template: Notes
 Windows 8 App Design Reference Template: Photo Browser
 Windows 8 App Design Reference Template: Photo Viewer 
Windows 8 App Design Reference Template: Pillar Block
 Windows 8 App Design Reference Template: Planning Diary 
Windows 8 App Design Reference Template: Product 
Windows 8 App Design Reference Template: Recipe
 Windows 8 App Design Reference Template: Restaurant 
Windows 8 App Design Reference Template: Shoe Store
 Windows 8 App Design Reference Template: Shopping
 Windows 8 App Design Reference Template: Simple Grid
 Windows 8 App Design Reference Template: Solution 
Windows 8 App Design Reference Template: Standard Square 
Windows 8 App Design Reference Template: Text Keyboard
Windows 8 App Design Reference Template: Tracking 
Windows 8 App Design Reference Template: Translator
Windows 8 App Design Reference Template: Travel and Tourism 
Windows 8 App Design Reference Template: Travel Dark Theme 
Windows 8 App Design Reference Template: Travel Light Theme
Windows 8 App Design Reference Template: Travel Picture
Windows 8 App Design Reference Template: Trekking Planner
Windows 8 App Design Reference Template: Tutor
Windows 8 App Design Reference Template: Tutor Advanced 
Windows 8 App Design Reference Template: Unit Convertor 
Windows 8 App Design Reference Template: Variable Grid Style A
Windows 8 App Design Reference Template: Variable Grid Style B
Windows 8 App Design Reference Template: Variable Grid Style C 
Windows 8 App Design Reference Template: Variable Grid Style D 
Windows 8 App Design Reference Template: Weather Clock 
Windows 8 App Desing Reference Template: Education Big Picture
Winodws 8 App Design Reference Template: Social Feed

Happy Coding.