开发者

How can I create simulated contacts in a surface table application without the simulator?

开发者 https://www.devze.com 2023-02-11 18:50 出处:网络
In a Microsoft Surface 1.0 SDK project based on WPF, I\'d like to transform contacts captured in a small part of the screen to match the whole screen (like a virtual touchpad).

In a Microsoft Surface 1.0 SDK project based on WPF, I'd like to transform contacts captured in a small part of the screen to match the whole screen (like a virtual touchpad).

After capturing a contact and transforming it's position and orientation I would like to send it back to the event queue. I already figured out that there seems to be no way to create a "new Contact()" or to change anything in the "ReadOnlyContactCollection" (开发者_如何学Pythonlike it's name already says).

Here's what I was trying to do:

private void OnContactDown(object sender, ContactEventArgs e)
{
    base.OnContactDown(e);
    e.Contact.Capture(this);

    // transform the contact's center and orientation
    // and write them back into e.Contact via own private method
    // e.Contact = transformContact(e.Contact);

    // keep transformed contact in the event queue
    // so it can be processed at it's new position
    e.Handled = false;
}

My next idea was to make use of the simulator and automation to create SimulatedContacts, but sadly this doesn't work on the surface table itself, only in the simulator.

Is there any way to send out "virtual" contacts (that don't exist in the raw image) so that they will be recognized by the surface (without the use of the simulator)? How does the SurfaceInput.exe send out the recognized contacts?


Surface v1 doesn't officially support WPF 4.0, but others have figured out how to take Surface v1 input and route it into the standardized & extensible touch APIs that come with WPF 4.0. Take a look at http://nui.joshland.org/2010/07/how-to-write-surface-applications-with.html for creating a custom "touch device" that transforms Surface input into WPF 4.0 input events. Following that same approach, you can create another "touch device" on your own in order to pass in your fake touches.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号