Gestures using MVVM light toolkit - windows-phone-7

I am using the MVVM light toolkit in a WP7 application and I am trying to wire up a canvas element's appropriate event to my view model using the 'EventToCommand' behavior. The event I am looking to intercept is the 'swipe up' gesture.
I have currently tried relaying the 'KeyUp' event but that doesn't behave like I had assumed it would. Is this even possible using behaviors or should I be doing something else? All the events I wire up to the viewmodel using the EventToCommand behavior work fine, but my basic problem is that I can't find an event for a swipe. I'm guessing gestures are handled differently?

What you need is a way to enable a gesture to trigger the behaviour.
Fortunately, Kevin Marshal wrote just such a thing and blogged about it.

Related

How to call a c# method from javascript in window phone 7?

I want to detect swipe in web browser control in C# using JavaScript. I want to add some JavaScript to my web content and then if swipe occurs, call a method that loads another web content in the same web browser control.
I would like some sample code or any other suggestion to do this.
Thanks in advance
You'll need to use something to detect the swipe in javascript. I've been recommended to use touch.js but haven't had a chance to try this yet.
When you detect the swipe you can call out to native code using window.external.notify().
Be sure to set IsScriptEnabled="True" on the WebBrowser control and register an handler for the ScriptNotify event.
It's this event handler which would load the new content.
First of all, consider that gestures for a webbrowser control have it's own handlers. Now, if you don't need to pan/zoom or the like in the webbrowser control, it's not a problem.
Then you simply set the IsHitTestEnabled attribute to false, so that the web-browser no longer receives input. Then you can simply use the GestureService from the Silverlight Toolkit to handle the swipe/flick inputs.
I wrote some code on how to handle this, in another question: wp7 horizontal swipe selection

How i can NOT handle the selectionchange event in Panoramic View in WP7?

i have developed my own map control (similar Bing Maps control), but when i move this map to right or left, Panorama changes view, but when i move the same bing map, view doesn't change. How i can do the behaviour of my control similarly as in Bing maps
The issue is that your control is trying to handle gestures and so is the Panorama. This was a big issue for a lot of people in the early version of the tools. The standard response was always to avoid this situation as it has implications for usability. Unfortunately there are some situations where you really need this.
The NoDo update (March 2011) included a "fix" to work around this issue for the built in controls. That doesn't help you though.
Fortunately there is a work around.
When contact is made with your control you disable the "IsHitTestVisible" property on the container so that it doesn't also receive the gestures you are capturing. Be sure to set it abck afterwards though.
See http://mine.tuxfamily.org/?p=111 for more details.

Windows Phone Map control has unresponsive pinch zoom

I'm seeing very spotty/unresponsive behavior with the silverlight map control on Windows Phone 7 (Microsoft.Phone.Controls.Map). The map control doesn't seem to pick up a lot of my pinch gestures. Is anyone else seeing this? Is there a way a workaround?
Just as an experiment I hooked up custom gesture listeners to PinchStarted, PinchDelta and PinchCompleted. My event handlers are getting fired every time I pinch, but the Silverlight map control doesn't pick them "most" of the times.
PS. I'm using the most up to date SDK/Toolkits.
After talking to our Microsoft contact we have no answers for the pinch performance problems. The official side stepped our question but and recommend putting a +/- buttons on the map for zooming in and out of the Map. To show the +/- buttons use the ZoomBarVisible property.

Mac OSX, Cocoa event model in NPAPI , NSView, and Out of process plugins

Well, currently chrome has out of process plugins. and firefox 4 will use same model.
That means plugin process is now seperated from browser process.
Plugin process might NOT have window at all.
My plugin is based on NSView.
Before cocoa event model, when I can access NSWindow in browser process, All I have to do is just add my_view as a subview of the contentView in the window.
[[the_window contentView] addSubview:my_view]
I do NOT need to process events myself. It worked itself.
But now, I convert NPCocoaEvents into NSEvents in event process code.
Do I have to change it myself?
Also some instance of NSEvents, I can not make them for example, wheel mouse events.
What should do I do?
Did I approach a wrong way?
Please enlighten me.
Do I have to change it myself?
If you plan to use the approach of forwarding NSEvents to your existing NSView then yes; there's no way to get access to the original NSEvents. They don't exist in the plugin process.
Another option would be to move away from trying to use native controls, and do your own drawing and event handling. This is the way most NPAPI plugins work.
A third possibility would be to open a separate window for your plugin content, and put your view in that window. This isn't technically supported by NPAPI, and it won't be perfect, but it might be a short-term way to get your plugin working while you explore long-term options.
Did I approach a wrong way?
Yes, what you were doing before was an unsupported hack, and not how NPAPI was intended to be used. Adding a view to a browser's window assumes things about the browser's view hierarchy that are implementation details, and subject to change at any time.
One option would be to use the FireBreath framework to create your plugin, as it already has a lot of the abstraction for negotiating the event and drawing models as well as an event abstraction. It's pretty straightforward to get up and going.

multi touch events to mouse events for java application

I have a rich complex Java Swing Application. I would like the multi touch events to be converted into Mouse events for the Swing Applications.
Is there a way to do it without changing significantly the existing Java Application ?
When I did something that sounds similar to what you're asking, I ended up using the java.awt.Robot class to create mouse clicks according to the touch notifications. I was not using mt4j, though, but rather a proprietary multitouch screen's API that wasn't especially mature.

Resources