Natural User Interface library

 image

Blake.NUI is a new open-source library for multi-touch NUI (Natural User Interface) development.  It can be found at blakenui.codeplex.com and is under a MS-PL license.

The library is still in undergoing changes but here are some of the things currently included in Blake.NUI:

  • Controls
    • ZoomCanvas – an infinite canvas control that is the heart of NaturalShow
    • CircleText – layout text along the circumference of a circle
  • Gestures
    • TapGestureTrigger – a configurable Blend Trigger that fires when the user completes a tap gesture
    • DoubleTapGestureTrigger – a configurable Blend Trigger that fires when the user completes a double tap gesture
  • TouchDevices
    • MouseTouchDevice – promotes mouse input to WPF 4 touch events
    • SurfaceTouchDevice – promotes Microsoft Surface vision system input to WPF 4 touch events
  • Common classes and utilities
    • DisplayMatrix
    • AnimateUtility and SurfaceAnimateUtility
    • ScatterMatrixHelper
    • MathUtility
    • VisualUtility
  • NaturalShow
    • Common models, views, factories, and other classes

Fluent DateTime for .NET

 

A set of (Ruby inspired) C# Extension Methods for easier and more natural DateTime handling and operations in .NET.
Allows you to write code like this: Alpha

DateTime.Now + 1.Week() + 3.Days + 14.Minutes();
3.Days().Ago();
5.Days().After(new DateTime(2000, 1, 1));
DateTime.Now.NextDay();
DateTime.Now.WeekAfter();
DateTime.Now.Midnight();
DateTime.Now.SetTime(11, 55, 0);

Fluent DateTime – Home

Processing Global Windows Mouse and Keyboard Hooks in C#

 

Processing Global Windows Mouse and Keyboard Hooks in C#

By George Mamaladze


This class allows you to tap Window keyboard and mouse and/or to detect their activity even when an application runs in the background or does not have any user interface at all.

Introduction

This class allows you to tap keyboard and mouse and/or to detect their activity even when an application runs in the background or does not have any user interface at all. This class raises common .NET events with KeyEventArgs and MouseEventArgs, so you can easily retrieve any information you need.

Using the code

To use this class in your application, you need just to create an instance of it and hang on events you would like to process. Hooks are automatically installed when the object is created, but you can stop and start listening using appropriate public methods.

UserActivityHook actHook;
void MainFormLoad(object sender, System.EventArgs e)
{
    actHook= new UserActivityHook(); // crate an instance
    // hang on events
    actHook.OnMouseActivity+=new MouseEventHandler(MouseMoved);
    actHook.KeyDown+=new KeyEventHandler(MyKeyDown);
    actHook.KeyPress+=new KeyPressEventHandler(MyKeyPress);
    actHook.KeyUp+=new KeyEventHandler(MyKeyUp);
}

Now, an example of how to process an event:

public void MouseMoved(object sender, MouseEventArgs e)
{
    labelMousePosition.Text=String.Format("x={0}  y={1}", e.X, e.Y);
    if (e.Clicks>0) LogWrite("MouseButton     - " + e.Button.ToString());
}

+ Don’t forget to read the comment sections

CodeProject: Processing Global Mouse and Keyboard Hooks in C#. Free source code and programming help

Application-wide Wait Cursor – Automatically Shows when App is busy

 

From a developer’s point of view, using the WaitCursor library could not get any simpler. Add a reference to the WaitCursor assembly and then add the following line to your application start-up code:

ApplicationWaitCursor.Cursor = Cursors.WaitCursor;

That’s it!

You can of course use any Cursor you like, you can use one of the predefined Cursors or you can create a new cursor and use that instead. You can also fine tune the amount of work time that will elapse before the Cursor is shown:

ApplicationWaitCursor.Delay = 
             new TimeSpan(0, 0, 0, 1, 0);  // Delay of 1 second

CodeProject: Automatic Application Wait Cursor. Free source code and programming help