Rajendran SP

Sunday, December 30, 2012

In this
blog post I am going to demonstrate on how to manipulate cursor for WinRT UI control
as like in WPF control.

In WPF, you
will find a property (Cursor) in UI control which allows you to get/sets the
cursor which displays when mouse pointer is over the UI (ex: Textbox) element.
Whereas in WinRT environment there is no cursor property for each UI control
instead we can manipulate the cursor used by the window using the current core
window pointer cursor.

//Gets or sets the
cursor used by the window.

Window.Current.CoreWindow.PointerCursor

In the
below sample (referred from WinRTXamlToolkit
samples) I have
manipulated the cursor used by the window when hovering over (pointer entered
and pointer exited event) the text block element.

Thursday, September 6, 2012

CodeProjectIn
this blog post, I am going to demonstrate on how to access a simple XML file embedded
in the WinRT assembly.

One
of the easier way to retrieve an assembly in .Net application is by using below
method.

//
This will return the assembly whose code is currently executing.

Assembly.GetExecutingAssembly();

Alternate
one is to use Type object of the classes present in the assembly.

Assembly assembly = typeof(DemoClass).GetType().Assembly;

From
the assembly object we can retrieve the manifest resource stream (embedded
file) using GetManifestResourceStream() method. All we need is to pass the name of the embedded
resource. The name of the embedded resource is the combination of root
namespace, folder path and the file name.

For example consider the root namespace of a demo application to
be MyApp and the XML file (Embedded.xml) is available under Resources folder of
the assembly. Then the name of the embedded resource is
“MyApp.Resources.Embedded.xml”.

In
WinRT, Both GetExecutingAssembly() and GetType().Assembly
are not available, instead you can retrieve the assembly object from the classes
declared in the assembly by means of using TypeInfo object. Now the remaining
part to access the manifest resource is same as in .Net application. Please
find the code snippet from below.

Monday, July 16, 2012

CodeProject
In this blog post, I am going the demonstrate the steps
involved in implementing “Infinite Scroll” in web application for loading
images just like in Bing and Google image search.

Infinite Scroll –
Infinite scroll has been called auto paganize/endless pages. But essentially it
is pre-fetching content from a subsequent page and adding it directly to the
user’s current page.

One of the most annoying thing when working with large data
is how to continuously loading the data on demand to your page?

The common solution is paging but paging itself will not
help too much you can end with hundreds or thousands of pages. So a new
solution now is on the surface and it's called "Infinite Scroll". It allows
you to load chunk of data when you scroll down of the page and inject it inside
the page, it will load data each time you scrolling down on the page.

Step 5: For now
we have loaded 48 images to the list view. In the next step we are going to use
the script and the code behind to load the next set of images dynamically on
scroll down just like in Google and Bing.

a.Add below script the aspx
file

<script type="text/javascript">

$(document).ready(function () {

var Skip = 48; //Number of image to skip

var Take = 14; //

function
Load(Skip, Take) {

//Post below loader image as progress bar

$('#divPostsLoader').html('<imgsrc="ProgressBar/ajax-loader.gif">');

//send a query to server side
to present new content

$.ajax({

type: "POST",

url:
"Default.aspx/LoadImages", //Call the LoadImage method in the code behind

data: "{ Skip:" + Skip + ", Take:" + Take + "
}",

contentType:
"application/json; charset=utf-8",

dataType: "json",

success: function (data) {

if (data != "") {

$('.thumb').append(data.d); //Append the retrieved
images next to list view

}

$('#divPostsLoader').empty();

}

})

};

//Larger
thumbnail preview

//When
scroll down, the scroller is at the bottom with the
function below and fire the lastPostFunc function

This post provides just an introduction (basic) on the
usage of “Infinite Scroll” feature. However the likes (immense potential) of
which we have already seen in “Facebook updates”, “Flip kart item search” and “Bing
and Google image search” etc.,.