Control your LED with Cortana(Lights Demo)

In this tutorial you will end up by controlling and LED connected to Arduino Uno with a UWP Application on Windows 10 using Cortana via Bluetooth Interface.

First of all you will need some tools such as:

  • Arduino Uno
  • Breadboard
  • LED
  • Bluetooth Module
  • Jumpers
  • Windows 10 and Visual Studio 2015 installed on your PC

This tutorial is divided into three parts:

  • First one the Hardware ConnectionYou will connect the LED to the Arduino Uno, and connect the Bluetooth Module to the Arduino as well. (as shown in the scheme below)
  • Second step is to write an Arduino Sketch that receives serial messages which turn on/off the LED and then create UWP App which will connect to the Arduino through Bluetooth.
  • Third one is to Activate and Handle Cortana voice commands.

You will find the source code below demonstrating all of these steps.

This is the final result you should get by the end of this tutorial.

 

And this is a complete tutorial to walk you though.

 
Here’s the scheme:BLE LED
Advertisements

Migrate your Win/WP 8.1 Apps to Windows 10 (UAP)

Win10_Windows_ProductFamily_Web

 

In this blog post, we will walk through How to integrate your Windows/Windows Phone 8.1 apps to Windows 10 Apps (Universal App Platform).

“Writing for Windows 10, is writing for all devices.”

First of all, we will have to make some modifications in package.appxmanifest but, unfortunately there’s no tools in Visual Studio CTP and Windows 10 Developer Tools yet.

But, to solve this problem at the meanwhile, there’s a Powershell script is written to do most of work till the full version, and you can get this file from HERE.

After you download the Powershell file, unzip it and place unzipped folder in the C Drive.

And you can get these tools from HERE.

Now, Let’s Start 🙂

  1. Open your Win/WP 8.1 Project and Right Click the project and hit Open in File Explorer.
  2. Click File > Open command prompt > Open command prompt as shown:
  3. Then, write following command.
    C:\ProjectUpgradeUtility\Run_UpgradetoUAP_Powershell_script.bat
    And hit Enter.
    CMD
    This will convert the .csproj to UAP and will update the package.appxmanifest
  4. Now, you will find your project migrated to UAP.
  5. Make some edits in package.appxmanifest by adding uap: before some capabilities and Application Extensions and Protocols like shown below:
    appxmanifest
  6. And if you are migrating Windows 8.1 App, Change the tile size like shown below:
    Win8.1 Tile size
  7. Before you run, you have to add some extensions to solve Platform Specific issues (e.g phone back button), Right Click References and then hit Add Reference > Universal App Platform > Extensions
    Add: Windows Desktop Extension SDK and Windows Mobile Extension SDK
    Extensions
  8. Now, Run your App, you might face some issues in xaml like Phone Styles, change them to public style that could run in Windows 10 UAP.
  9. About the Charms, they are not existed anymore in Windows 10 with the same UI but, you should replace them with in-app UI for (Search – App Settings – Sharing).

And Here are some tips to put in your consideration while migrating to Windows 10:

  • Don’t forget to add Reference to Platform Extension SDKs, if needed.
  • Review conditional code (#if…) and convert to adaptive code where appropriate.
  • Replace calls to deprecated APIs, if any.
  • Replace references to undefined styles in XAML (as we mentioned above).
  • Update code that integrates with Charms bar.
  • Extend your UI to create a great, adaptive UI that works across multiple device families.(The most Important)

This was a very simple scenario for migrating you Win/WP 8.1 App to Windows 10.
Keep in mind, it’s still a preview 😉

App Bar, Rate and Share

In this blog post, you will learn the following:wp_ss_20150316_0001

  • Add App Bar (XAML)
  • Add Rate and Review Button in your App
  • Add more apps Button “related to you on the store”
  • Add App details Button
  • Add Share Button

Let’s get started 😉

Add App Bar (XAML)

  1. Open Visual Studio, Create new project (Windows Phone 8.1 > Blank Template).
  2. In Solution Explorer, Open MainPage.xaml and Add this code outside the main Grid:
    AppBar

Now, you have been created an App Bar but, we need to handle these AppBarButtons 😀

Add Rate and Review Button

In Solution Explorer, Open MainPage.xaml.cs and Add this code in RateBtn_Click event handler:

await Launcher.LaunchUriAsync
 (new Uri("ms-windows-store:reviewapp?appid=" + Windows.ApplicationModel.Store.CurrentApp.AppId));

Add More Apps Button

This button navigates to related apps in the store, maybe other apps for you in the store or any related apps to you using a keyword in store search bar.

Add this code in moreAppsBtn_Click event handler:

string keyword = "Mohammed Emam";
var uri = new Uri(string.Format(@"ms-windows-store:search?keyword={0}", keyword));
await Windows.System.Launcher.LaunchUriAsync(uri);

Add App Details Button

This button navigates to your app details page on the store.

Add this code in detailsBtn_Click event handler:

var uri = new Uri(string.Format("ms-windows-store:navigate?appid={0}", Windows.ApplicationModel.Store.CurrentApp.LinkUri));
await Windows.System.Launcher.LaunchUriAsync(uri);

Add Share Button

This button will share your app’s link.

Add this Method in MainPage.xaml.cs



private void RegisterForShare()
 {
     DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
     dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager,
     DataRequestedEventArgs>(this.ShareLinkHandler);
 }

private void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs e)
 {
     DataRequest request = e.Request;
     request.Data.Properties.Title = "Title";
     request.Data.Properties.Description = "Description";
     request.Data.SetWebLink(new Uri(""+ Windows.ApplicationModel.Store.CurrentApp.LinkUri));
 }


Then, call this method in shareBtn_Click event handler and add this line of code:

RegisterForShare(); //Calling the method
 DataTransferManager.ShowShareUI();

 

Download the entire code sample from HERE

Camera Capture Task – Universal App

This blog post is About Camera Capture Task and how to use our Device’s Camera in my App if it was Windows 8.1 App or even Windows Phone 8.1 App, Let’s Start 🙂

  1. Open Visual Studio 2013
  2. Create New Project and select Visual C# > Store Apps > Universal Apps > Blank App
  3. In the Solution you will find 3 projects:
    – Windows 8.1 Project
    – Windows Phone 8.1 Project
    – App.Shared Project (Anything will be Shared between the previous two projects)
  4. In Windows 8.1 Project, Open MainPage.xaml and Write the following xaml Code in the Main Grid:
    Grid xaml
  5. Open MainPage.xaml.cs file and write the following code:
    Windows C#
  6. Then Run the Windows 8.1 App 😉

Now, we will do the same in the WP 8.1 but in MainPage.xaml for WP 8.1 we will add this line of code before <image/> tag
<CaptureElement x:Name=”capturePreview” Width=“320” Height=“240” />
and let the width and height the same for the image in WP.

and then in MainPage.xaml.cs write the following block of code:
WP C#

And then run the on your device 🙂

Download Code Sample HERE!

 

Arabic Video on Youtube 🙂

Thanks for your time 🙂
You will find my contacts in the Blog, Feel free to contact me anytime 😉

Localization Using Multilingual App Toolkit

Today, we are going to know and learn how to make Localized Windows Store Apps.

What is Localization ?

Localization is that process to translate the App resources(strings) into many other languages.

Why should i learn localization ?

To publish your app into several markets with different cultures and languages than enables your to get thousands of downloads 🙂

The most important advantage of Localization is that makes you build just one app with different versions in many languages and cultures instead building multiple apps each one in language differ than the other.

How to use Localization ?

In this lesson we will be using Multilingual App Toolkit that should be downloaded.

Let’s Start!

Continue reading

Windows Game Development With Unity3D

I just wanted to share these helpful resources to get started in Developing Windows Games and for familiar to Game Development there many helpful resources too to advance your experience. 

Beginner tutorials

Continue reading