DCSIMG
Finally – Our Windows 7 .NET Wrappers are out - class Alon : public CPP, public Architecture

class Alon : public CPP, public Architecture

The smart virtual home of Alon Fliess

Syndication

Finally – Our Windows 7 .NET Wrappers are out

During the last few months a small team from Sela, has developed course materials, exercises and demos for the DPE Metro Program, that show how to develop with the new features of Windows 7. As you may know, all of the new feature of the system are exposed to native developer, using Win32 API and COM. To use C# and .NET we developed set of wrappers. Sasha developed the Taskbar wrappers, and also wrote about it in his blog. Dima developed the Sensor & Location Platform wrappers and I developed the Shell Libraries wrapper and the Multi-touch wrappers.

You can download these wrappers from here:

Taskbar & Libraries

Sensor & Location Platform

Multi-touch

For the Taskbar & Libraries we have used the Vista Bridge project with few modifications. The other wrappers don’t depend on the Vista Bridge. Currently the Windows Bridge team is looking at our wrappers as a prototype for the next version of the bridge, and they are in contact with us.

So, what is in there for you?

Sasha has wrote a lot about the Taskbar. I will talk briefly about the other wrappers and in future posts I will dive into the gory details.

Sensor & Location Platform

The Sensor API is designed for working with sensors (light, accelerometer, buttons, temperature, etc.) in a vendor-independent manner. In previous Windows versions you had to learn and target each vendor's specific API.

The Location API builds upon the Sensor API and provides location information for location-aware application. The location information may be provided from many different sources: GPS, WiFi hotspot or GSM cell triangulation. Windows 7 Sensors and Location platform selects for you the best source automatically with no need to even understand the different providers. For the developer, this new set of APIs provides an abstraction of the underline infrastructure freeing the developer to handle the high level of application logic.

The API has many benefits (a partial list):

1. Frees you from the burden of interpreting various protocols used by GPS receivers (NMEA +non-standard extensions, NMEA2000 and others.

2. Not bound to any particular technology or vendor. No need for serial port/emulation.

3. Multiple applications may use the information simultaneously.

The S&L (Sensor & Location) wrapper is a framework that provide a managed access to the S&L Platform. It is a framework, because the design allows hardware vendor to extend the wrapper to support new .NET sensor types.

As opposed to the native API that are based on COM GUID for any type information the .NET wrapper is based on strong type design. This means that the developer knows the sensor type that she uses, and the exact report that she gets. For example for ambient light sensor, a specific data report will be generated with a strong type property telling the light intensity reading in LUX. In future post I will talk more about the wrapper.

Shell Library

Windows 7 introduces a new concept of Libraries as destinations where users can use their files as collections of items that may span multiple locations across computers. Libraries supersede the functionality of previous Windows versions known folders (e.g. Documents, Pictures, Music) and replace them as a main “storage” destination. Applications have a straightforward method for interacting with Libraries programmatically with the Library API. They can create, interact with and support Libraries as first-class items in their experiences.

In previous versions of Windows, each application had its own proprietary library. For example, Windows Media Player had a different set of scopes than iTunes and neither was consistent with your Music Folder. With the Library API applications can define and consume a consistent set of user-defined scopes.

Libraries may also contain network folders. This enables a better user experience at work and at home. Whenever the user opens a common file dialog he or she gets an aggregation view of all of the library locations that are available.

image

 

The Shell managed wrapper can be found under the Windows7.DesktopIntegration.dll. It contains wrappers for the new Windows Shell Taskbar and the new Windows Shell Libraries which in turn depends on the Windows Vista Bridge. The Vista Bridge that comes with this project is based on version 1.4, and it is slightly modified to support some of the new Windows 7 features.

To support the Windows Shell Libraries operations, the Windows 7 Integration Library contains the ShellLibrary class. The class has few static functions to create, load or delete a library and many other instance methods to work on the library instance itself.

Using the class is just a matter of using one of the static functions to get a ShellLibrary instance and then calling a method on that instance. The following code opens an existing library and adds new folder location to it:

public static void AddFolder(string name, string folderPath)

 

 

{

 

 

    using (ShellLibrary library =
            ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(name), true))

 

 

    {

 

 

        library.AddFolder(folderPath);

 

 

    }

 

 

}

 

 

More on Shell Libraries in future posts.

Multi-touch

One of the more exiting features of Windows 7 is the multi-touch support. First I have to admit that I had so much fun writing code and cool demos for multi-touch. I have two multi-touch machines, one is the HP Touchsmart, a 25.5” dual touch all-in-one computer which runs the Windows 7 beta 64 bit version, and another Dell latitude XT machine, that has a true multi-touch support from N-Trig which runs the 32bit version of Windows 7.

TouchSmart              Dell Latitude XT

Windows application can target one of 3 levels of touch integration:

Good: No specific touch APIs are used but the application UI is appropriately sized and
works well with the built-in gestures

Better: The gesture APIs are supported to give
smooth natural interactions

Best: Deep touch focused experiences designed
to take advantage of Multi-touch

 

 

 

Windows 7 User32 controls have built-in support for multi-touch, for example you can scroll text in a Window using your fingers.

When you want to add touch support to your application you need to get touch information from Windows. There are two different approaches to choose from. The easiest approach is to let Windows understand the user intent. The user uses her fingers to take actions like rotate, translate, scale, double finger tap, and so on. You can ask Windows to interprets these actions to a simple Windows message called gesture, that informs your application about the specific action with the related data. For example the user did scaling operation with 2.5 scaling factor. There are two main problems with this simple approach. The first is that you get only one interpretation for the user action. If the user rotate and scale in the same time, you will get only one gesture, not both. The second problem is that is the user needs to manipulate more then one object in the screen, let say by using her two hands, or another user’s hand, you will not get the correct interpretation at all.

To overcome these problems you should register to get the low level Windows Message, which is the WM_TOUCH message. This gives you the row touch information. You need to decode the message, there is a good chance that this one message contains many different touch messages from each and any of the fingers that simultaneously touch the screen. The next action is to decide which message is belong to which item. Suppose you have many pictures on the screen, you need to correlate the touch message to the target picture. This can be done by doing hit-test using the location information of the touch event. Now you have to figure out what is the user intent. This is a hard task if you need to do it yourself, but don’t worry, Windows 7 provides a Manipulation Processor that does it for you. All you need to do is to pass the row touch message to the Manipulation Processor, and to get the Manipulation Delta event from it, which in turn is very similar to the gesture information, but include all the actions together. If you also want to have an inertia on each of the object you can use the Inertia Processor. This Processor is a little bit complicated and I will write about it in a future post.

All of those messages and API are native Win32 and COM based. WPF 4.0 will have a full support for touch enabled applications, including Manipulation and Inertia. If you don’t want to wait to WPF 4.0 or you need to crate WinForms base touch enabled applications, you can use our wrapper. The wrapper lets you create a touch handler for WinForm, or WPF (or even for any User32 Windows Handle). This handler can be GestureHandler or TouchHandler. After creating the handler you should register for the gesture or touch events. If you use the TouchHandler you will probably create at least one instance of ManipulationProcessor or ManipulationInertiaProcessor which wrapps the native COM based processors.

image

If you have a WPF 3.5 application you can use the stylus events as touch events, just use the WPF handler to enable WPF touch events.

To get better understanding of how to use the touch wrapper we created many demos, for WinForm, WPF and even a C++/CLI Win32 application that uses the wrapper. I will write a future post with more details.

Summary

Windows 7 is a cool operating system. The end-user gets a better experience when using the Shell and the built-in applications, but it is our task to use the cool features in our own applications. For the .NET developer, we will get better support in the future, whether in .NET 4.0 or from the Windows Bridge team, but for now you can enjoy using the wrappers that we developed for DPE.

Comments

# re: Finally – Our Windows 7 .NET Wrappers are out@ Saturday, March 14, 2009 4:56 AM

The current version of the wrappers is for the beta (build 7000), we will publish a new version when the RC is out

# re: Finally – Our Windows 7 .NET Wrappers are out@ Thursday, April 02, 2009 2:48 PM

This is great stuff. Thank you all for helping in this effort.

by Yochay

# re: Finally – Our Windows 7 .NET Wrappers are out@ Monday, April 06, 2009 11:50 PM

Hi, Alon! What is API I must use for WPF 3.5 development for Touchsmart exactly? Where I can download it? Where I can read more about the issue? Thank you!

by David Kossoglyad

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, April 07, 2009 12:40 AM

Is it possible to develop for multi-touch with a non multi-touch environment such as regular PC with Vista installed? Do you know some simulator for this?

by David Kossoglyad

# Windows7 RC Multitouch API changes from the beta version@ Wednesday, April 15, 2009 6:53 AM

In these days we are upgrading the Windows7 Integration Library sample code. Most of the APIs have not

# re: Finally – Our Windows 7 .NET Wrappers are out@ Monday, October 05, 2009 5:08 AM

Is there any way to use the Multitouch wrappers in VB.NET? Thanks

by Logix5

# Bookmarks for August 13th through August 17th | The Wahoffs.com@ Tuesday, August 17, 2010 11:29 PM

Pingback from  Bookmarks for August 13th through August 17th | The Wahoffs.com

# re: Finally – Our Windows 7 .NET Wrappers are out@ Wednesday, March 21, 2012 12:03 AM

I haven't tried out the new packaging yet but inamkg it easier to open is a HUGE PLUS!!!  The wrappers I have been fighting with the struggling to tear, then resorting to teeth, pens, scissors, whatever looks sharp is what I've used to open the previous wrappers.  BUT  the contents were so worth it every single time!  Looking forward to placing an order online here (Amazon stopped carrying Bumble Bars!) and getting the new and improved wrapper.

by Seba

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, September 18, 2012 1:07 AM

 Excuse, that I can not participate now in discussion - there is no free time. But I will be released - I will necessarily write that I think on this question.

P.S. Please review <a href="jpeger.deviantart.com/.../Settings-Icon-133088993">Settings Icon from jpeger</a>

by icons

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, September 18, 2012 10:36 AM

 I consider, that you commit an error. Write to me in PM, we will discuss.

P.S. Please review <a href="martinking33.deviantart.com/.../iPhone-Menu-Icons-311178604">iPhone Menu Icons from martinking33</a>

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, September 18, 2012 11:43 AM

 I can not participate now in discussion - there is no free time. I will return - I will necessarily express the opinion.

P.S. Please review <a href="tsenitelikon.deviantart.com/.../App-Tab-Bar-Icons-for-iOS-282539163">App Tab Bar Icons for iOS from tsenitelIkon</a>

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, September 18, 2012 12:24 PM

 I consider, that you are not right. Let's discuss. Write to me in PM, we will communicate.

P.S. Please review <a href="happy-icon-studio.deviantart.com/.../Glossy-Data-Icons-281013817">Glossy Data Icons from Happy Icon Studio</a>

by icons

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, October 23, 2012 1:47 AM

My spouse and i 2nd this. Ended up being our gateway site away from The planet pandora to locate a great deal better music sites.

# re: Finally – Our Windows 7 .NET Wrappers are out@ Sunday, February 24, 2013 6:04 PM

I don't know whether it's just me or if everyone else experiencing

problems with your site. It appears as though some of the written

text within your content are running off the screen.

Can somebody else please provide feedback and let me know if this is happening to them too?

This may be a issue with my internet browser because I've had this happen before. Appreciate it

by Victor

# re: Finally – Our Windows 7 .NET Wrappers are out@ Wednesday, February 27, 2013 3:01 PM

Its like you read my mind! You seem to know so much about

this, like you wrote the book in it or something.

I think that you could do with some pics to drive the message home a

bit, but other than that, this is fantastic blog. A great read.

I will certainly be back.

by Frank

# re: Finally – Our Windows 7 .NET Wrappers are out@ Monday, March 04, 2013 7:42 PM

I don't even know how I ended up here, but I thought this post was good. I don't know who you are but certainly you're going to a famous blogger if you are not already ;) Cheers!

by Goldman

# re: Finally – Our Windows 7 .NET Wrappers are out@ Saturday, March 23, 2013 1:33 AM

each time i used to read smaller articles or reviews that as well clear

their motive, and that is also happening with this article which I am reading at this

place.

by Pulley

# re: Finally – Our Windows 7 .NET Wrappers are out@ Monday, March 25, 2013 5:35 AM

This site was... how do I say it? Relevant!! Finally

I have found something which helped me. Thank

you!

by Larose

# re: Finally – Our Windows 7 .NET Wrappers are out@ Monday, March 25, 2013 7:11 AM

Thanks for sharing your info. I truly appreciate your efforts and I will be waiting

for your further post thank you once again.

by Powell

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, March 26, 2013 3:17 PM

You ought to take part in a contest for one of the most useful sites on the net.

I most certainly will recommend this web site!

by Marcum

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, March 26, 2013 8:19 PM

Have you ever thought about creating an

e-book or guest authoring on other websites? I have a blog based on the same subjects you discuss and would really like to have you share some stories/information.

I know my audience would value your work. If you are even remotely interested, feel free to send me an e-mail.

by Becker

# re: Finally – Our Windows 7 .NET Wrappers are out@ Thursday, March 28, 2013 12:14 AM

Thanks for the good writeup. It in fact used to be a enjoyment account it.

Glance complicated to far introduced agreeable from you!

By the way, how could we keep up a correspondence?

by Meyers

# re: Finally – Our Windows 7 .NET Wrappers are out@ Friday, March 29, 2013 12:11 PM

What's up all, here every one is sharing these kinds of knowledge, thus it's fastidious to read this web site, and I used to pay

a quick visit this blog everyday.

by Alcorn

# re: Finally – Our Windows 7 .NET Wrappers are out@ Sunday, March 31, 2013 8:12 PM

Saved as a favorite, I really like your web site!

by Staton

# re: Finally – Our Windows 7 .NET Wrappers are out@ Sunday, March 31, 2013 9:50 PM

Somebody necessarily help to make critically articles I'd state. This is the very first time I frequented your web page and up to now? I surprised with the research you made to create this particular put up amazing. Wonderful job!

# re: Finally – Our Windows 7 .NET Wrappers are out@ Monday, April 01, 2013 7:16 AM

I love it when folks come together and share views. Great blog, stick with it!

by Rickard

# re: Finally – Our Windows 7 .NET Wrappers are out@ Monday, April 01, 2013 10:11 AM

Hello, Neat post. There is a problem with your site in internet explorer, might test this?

IE nonetheless is the marketplace chief and a huge element

of people will pass over your wonderful writing because of this problem.

by Hassell

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, April 09, 2013 2:31 PM

Thanks to my father who shared with me about this blog, this web site

is actually remarkable.

# re: Finally – Our Windows 7 .NET Wrappers are out@ Wednesday, April 10, 2013 9:19 AM

With havin so much written content do you ever run into any problems of plagorism or copyright infringement?

My blog has a lot of completely unique content I've either written myself or outsourced but it seems a lot of it is popping it up all over the internet without my authorization. Do you know any methods to help protect against content from being ripped off? I'd really appreciate

it.

by Dillon

# re: Finally – Our Windows 7 .NET Wrappers are out@ Thursday, April 11, 2013 2:31 PM

Howdy I am so excited I found your blog page, I really found you by mistake,

while I was browsing on Aol for something else, Nonetheless I

am here now and would just like to say many thanks for a tremendous post and a all round entertaining blog (I

also love the theme/design), I don’t have time to read through it all at the minute but I have bookmarked it and also added

your RSS feeds, so when I have time I will be back to read more, Please do keep up the

fantastic jo.

by Mullins

# re: Finally – Our Windows 7 .NET Wrappers are out@ Friday, April 12, 2013 2:09 AM

If some one wants to be updated with most recent technologies after

that he must be pay a visit this website and be up to date

every day.

by Bernier

# re: Finally – Our Windows 7 .NET Wrappers are out@ Friday, April 12, 2013 5:31 AM

Hello! Someone in my Myspace group shared this website with us so

I came to look it over. I'm definitely loving the information. I'm bookmarking and will be tweeting this to my followers!

Excellent blog and wonderful style and design.

by Chun

# re: Finally – Our Windows 7 .NET Wrappers are out@ Monday, April 22, 2013 12:24 AM

These are actually great ideas in concerning blogging.

You have touched some good things here. Any way

keep up wrinting.

by Presley

# re: Finally – Our Windows 7 .NET Wrappers are out@ Thursday, April 25, 2013 12:58 AM

Hi just wanted to give you a brief heads up and let you know a few of the images aren't loading properly. I'm not

sure why but I think its a linking issue. I've tried it in two different internet browsers and both show the same results.

by Wilhite

# re: Finally – Our Windows 7 .NET Wrappers are out@ Friday, April 26, 2013 9:14 PM

Hello! I understand this is somewhat off-topic however I needed to ask.

Does building a well-established website such as yours require a massive amount work?

I am completely new to running a blog however I do write

in my journal everyday. I'd like to start a blog so I will be able to share my personal experience and feelings online. Please let me know if you have any kind of ideas or tips for new aspiring bloggers. Thankyou!

by Mowery

# re: Finally – Our Windows 7 .NET Wrappers are out@ Wednesday, May 01, 2013 9:20 AM

Fantastic beat ! I would like to apprentice while you amend your site, how can i subscribe for a blog web site?

The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear concept

by Gatlin

# re: Finally – Our Windows 7 .NET Wrappers are out@ Thursday, May 02, 2013 5:42 PM

Peculiar article, totally what I was looking for.

# re: Finally – Our Windows 7 .NET Wrappers are out@ Thursday, May 02, 2013 11:08 PM

I know this website gives quality depending content and other material,

is there any other website which gives these kinds of information in quality?

by Earley

# re: Finally – Our Windows 7 .NET Wrappers are out@ Saturday, May 11, 2013 1:47 PM

Hi there, You've done an incredible job. I will certainly digg it and personally suggest to my friends. I am sure they will be benefited from this site.

# re: Finally – Our Windows 7 .NET Wrappers are out@ Wednesday, May 15, 2013 9:30 PM

Amazing! Its in fact amazing piece of writing, I have got much clear idea

concerning from this paragraph.

by Gamez

# re: Finally – Our Windows 7 .NET Wrappers are out@ Sunday, May 19, 2013 10:28 PM

Amazing issues here. I am very satisfied to peer

your article. Thanks so much and I'm having a look forward to touch you. Will you kindly drop me a mail?

by Gass

# re: Finally – Our Windows 7 .NET Wrappers are out@ Tuesday, May 21, 2013 4:23 AM

Hello there, I found your blog by way of Google even as searching for a similar topic, your site got here up, it

appears good. I have bookmarked it in my google bookmarks.

Hello there, simply was aware of your blog thru Google, and located that it's really informative. I'm going to

be careful for brussels. I'll be grateful should you continue this in future. Lots of other people might be benefited out of your writing. Cheers!

by Noonan

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: