Solved Exception in Passing Relative URI to Windows Runtime

While working today on a Windows Store Application I had a requirement to work with URI. Business class was as follows,

 

image

And I created instance of Product class in usual way setting values for both properties. I had put all images in ProductImages folder.

 

image

 

On running application I got following exception that given System.Uri cannot be converted.

image

 

After small research I found that WinRT does not support Relative URI. It only supports Absolute URI.

 

image

 

Now I fixed above problem by converting Relative URI to Absolute URI.

 

image

 

Exception got fixed after changing URI as absolute URI. I hope you find this quick fix useful. Thanks for reading.

Presented on Windows 8 development for JavaScript developers

image

Download resources of the session from here

My next presentation. Find details and register here

For updated from Delhi User Group events join Facebook Group here

On 9th March I presented on Windows 8 development for JavaScript developers. This event was conducted by Delhi User Group. There was decent number of participants in the event. I presented on “Windows 8 Development for JavaScript developers “. I covered following topics in my sessions

  • How development for Win8 is different?
  • Different JavaScript based project templates.
  • Work with Services and Data Source
  • Working with List View
  • Working with Templates
  • Working with Grouping
  • Working with Semantic Zoom
  • Working with Share Contract

Download resources of the session from here

My next presentation. Find details and register here

For updated from Delhi User Group events join Facebook Group here

My next session is on 23rd March. You can find details and register for that session here . See you seen in next community event.

Presenting on “Developing Windows 8 Apps using JavaScript “for Delhi User Group

Register for the Event here

clip_image002

I am presenting on Developing Windows 8 Apps using JavaScript for Delhi User Group on 9th March. Venue of the event is Microsoft India Gurgaon.

Find Details and Register for the Event here

I will adhere to my style of speaking and will present in step by step manner. I will discuss or rather code on following topics in my presentation

  • How development for Win8 is different?
  • Different JavaScript based project templates.
  • Work with Services and Data Source
  • Working with List View
  • Working with Templates
  • Working with Grouping
  • Working with Semantic Zoom
  • Working with Share Contract

We will create “Netflix Movie Explorer “in order of learning above topics.

It does not matter whether you are a beginner developer or a seasoned programmer, this session will offer you some learning.

Find Details and Register for the Event here

Quick details of event is as following

Date: Saturday, 9th March 2013

Time: 9 AM to 1PM

Venue: Microsoft, DLF Cyber Greens. 9th Floor, Tower A, DLF Cyber City, Sector 25 A, Gurgaon. Near to Sikandarpur Metro station on Yellow Line.

Find Details and Register for the Event here . I am excited to see you there.

What is Namespace in WinJS

Let us first try to understand, why we need Namespace? I will try to explain you with an example, let us suppose you have a function named GreetingMessage in JS file named Library.js

image

Now you need to use this function on default.js. When you try to call that function from other js file , you get following exception.

 

image

Essentially, you cannot access a function or variable outside its scope. Namespace in WinJS library allows you to access a function outside its scope.

  • Namespace allows you to access a function outside its scope.
  • Namespace allows you to use a function in different files along with file it is defined.
  • Namespace helps you to organize your code
  • Any type created in Namespace can be referenced outside the scope of Namespace

Now let us see that how can we define a Namespace in WinJs . You can define Namespace by calling the define function

 

image

There are two parameters need to be passed to create Namespace.

  1. Namespace name is a string
  2. Members of the Namespace as object

You can create a Namespace in Library.js as following,


(function () {

 function GreetingMessage() {

return "Hello from WinJS";

 }

WinJS.Namespace.define("MyLibrary.Function", {
 GreetingMessage: GreetingMessage
 });

})();

There are few points you need to take care here

  • Enclosed all the Namespace definition in self executed function
  • Make sure you are not forgetting the braces at the end.
  • We have defined a function named GreetingMessage
  • We have defined a namespace and function inside that can be accessed as following

image

We have defined a Namespace and now we want to access the function GreetingMessage() on the default.js file. To do this first step you need to do is to refer MyLibrary.js on default.html file. You can refer that as following,

image 
Now you can access GreetingMessage() function on default.js as following ,

var res = MyLibrary.Function.GreetingMessage();
 var output = document.getElementById("output");
 output.innerHTML = res;

In this way by using Namespace, you can access functions and objects in different files and beyond scope of the declaration. I hope you find this post useful. Thanks for reading.

Thanks to Student created Windows 8 App of my Blog

I am very pleased to write here that one student Akrita Agarwal has shown her love to my blog and voluntarily created Windows 8 Application of my blog. I am very touched by this kind effort. You can get that app from App Store from here


Link to download Application from Store


   

This is two column application. You can browse blog posts on selecting a particular blog post from left. There is feature of searching a blog post and about author as well.

   

 

This may not be the best application but we are celebrating proactive step taked by a student to create an Application for Windows Store here.

Thanks to Akrita and their friends.

Presented: Windows 8 App Development for web Developer

I had an opportunity to present on “Windows 8 App Development for Web Developers” at Microsoft Gurgaon on 13th October 2012. It was nice experience presenting in front of more than 125 enthusiast audiences.

I presented on the topic “Windows 8 App Development for Web Developers” and shown demos on

  1. Migrating CSS based HTML Web Application to Windows 8 Application
  2. Understanding App Package
  3. Understanding different capabilities
  4. Understating different Development options
  5. Create “Netflix Movie Explorer” App for Windows Store

Read step by step documentation shown in this demo

Please find below slides from the presentation,

Thanks for attending the presentation.

Create App Package for Windows Store

 

 

In this post we will follow step by step procedure to create app package for Windows Store. Let us suppose you have created a “Hello World “application for Windows Store and want to create an App Package for the same. To create that from menu select PROJECT

 

image

 

From the POROJECT menu, select Store->Create App Package

 

image

 

Next you will get Create App Package wizard. At the point, we do not want to upload package to Windows Store so select the option No and click on Next

 

image

 

In next screen you need to choose Platform for the package. You can create package for

 

  1. 64 bit platform
  2. 32 bit platform
  3. ARM
  4. Neutral platform

 

Subsequently you need to choose whether you want to create package for Release Mode or Debug Mode. Here, I am creating a package for Neutral platform. Select that option and click on Create to create package.

 

image

 

After clicking on create in bottom of Visual Studio you can notice Build Succeeded message. And in next window you will get Success Message with path of the created package.

 

image

 

When you browse to path you will find package has been created to upload.

clip_image001

In this way you can create application package for Windows Store. I hope you find this post useful. Thanks for reading.