Thursday, May 7, 2009

Identifying Finger Tag and Blob in Surface using Contacts class

If you are not much familiar with Microsoft surface just have a look here in my another blog and get start in Surface development from here.

There is an attached event called ContactDown in the class Contacts.We can subscribe to that in any visuals and process according to that.

<s:SurfaceWindow x:Class="SurfaceApplication.SurfaceWindow1"
<TextBlock>Place contact here</TextBlock>
<Rectangle Grid.Row="1" Fill="#0fff0000"
Width="100" Height="100" s:Contacts.ContactDown="Rectangle_ContactDown" />

Code behind

private void Rectangle_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
if (e.Contact.IsTagRecognized)
case Microsoft.Surface.Presentation.TagType.Byte:
MessageBox.Show(string.Format("Byte tag identified value={0}", e.Contact.Tag.Byte.Value));
case Microsoft.Surface.Presentation.TagType.Identity:
MessageBox.Show(string.Format("Identity tag identified value={0}", e.Contact.Tag.Identity.Value));
return ;
if (e.Contact.IsFingerRecognized)
MessageBox.Show("Finger contact identified");
MessageBox.Show("Blob identified");

This code just shows a message box. Processing the contacts such as showing something upon placing a contact and all will be discussed later in the post ‘Using TagVisualizer and TagVisualization’.

1 comment:

  1. I think that using Contacts class in order to Identifying Finger Tag and Blob in Surface is such a great idea! It is as brilliant as
    viagra online