From iLab Cookbook

Toolkits: HowToStartANewApplicationForTheFiduciaryGlove

<< Back to the Fiduciary Glove Toolkit page

Using the Fiduciary Glove Application template

First, start the Visual Studio IDE:

Once the Visual Studio IDE has been loaded, open the dialog window to create a new development project. This can be done by either selecting the "File" menu, "New", and "Project..." (1), or by clicking the "Project..." entry of the welcome screen (2)

In the new project dialog window, select the "Fiduciary Glove Application" template (under "Fiduciary Glove Toolkit"), change the project name, and select "OK".

A new Fiduciary Glove Application project will be created based on the template. The component you should start from when developing consists of two parts - "Windows1.xaml" and "Windows1.Xaml.cs". Window1.Xaml is primarily used to define the static user interface in an xml-like structure. Window1.Xaml.cs is used to code dynamic user interface parts and the application logic in C#.

Editing the C# code

To start with the development, you can click on the "Window1.cs" file to edit the application in C# code.

The code view will open, and you will see the code skeleton the template created for you.

public partial class Window1 : GloveWindow{
  public Window1(){
    InitializeComponent();

    //Creates a glove for every glove model in the glove repository
    this.LoadGloves();

    //Alternatively you can also instantiate glove by glove;
    //Glove glove = new Glove(this, "Glove1");

    //Creates posture recognizer and loads all postures from the posture repository into the recognition engine
    this.PostureRecognizer = new PostureRecognizer(this);
    this.PostureRecognizer.LoadPostures(PostureRepository);

    //Creates gesture recognizer and loads all gesture from the gesture repository into the recognition engine
    this.GestureRecognizer = new GestureRecognizer();
    this.GestureRecognizer.LoadGestures(GestureRepository);

    this.HandpartDown += new EventHandler<GloveTouchEventArgs>(Window1_HandpartDown);
  }

  void Window1_HandpartDown(object sender, GloveTouchEventArgs e){
    Console.WriteLine(e.Glove.Hand + " " + e.Handpart.Identifier);
  }
}

Editing the XAML code

Alternatively, the "Window1.xaml" file can be selected to edit the XAML structure in the Visual Studio Designer.

The Visual Studio Designer view is split horizontally in WYSIWYG-editor and XAML-code view.

To start with the development, you can now click on the Visual Studio toolbox to access the programming building blocks of the toolkit. Gloves, Users, and GloveButtons can be dragged and dropped into the WYSIWYG-editor. They can be also created and adjusted in XAML-Code.

Retrieved from http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/Toolkits/HowToStartANewApplicationForTheFiduciaryGlove
Page last modified on February 26, 2011, at 10:34 AM