WPF vs XNA vs Surface for gesture based interface - wpf

I wonder which of these 3 frameworks / combination of them is most suitable for gesture-based interface (based on touch or motion recognition)?
I see online some directions, of using WPF and Surface, but nothing concrete.
I will appreciate if someone who already worked on this can suggest an approach.

If you are talking about targetting Windows 7, WPF 4 + the "Surface Toolkit for Windows Touch" are the most efficient way to go. WPF 4 has built in low level APIs for touch and the Surface Toolkit extends that with a suite of controls that are optimized for touch and gestures. See my presentation on this topic from PDC '09: http://www.microsoftpdc.com/2009/CL27

Not sure why Adrman deleted his post, but I'm going to re-post his link to Shawn Hargreave's post about the touch API on windows:
http://blogs.msdn.com/b/shawnhar/archive/2010/09/09/touch-input-on-windows-in-xna-game-studio-4-0.aspx
If you're interested in still using XNA for your project, there are definitely still options as Shawn "touches" upon in the end of his post. For example, here is an article on the XNA UK UG site that shows how to implement touch on windows:
http://xna-uk.net/blogs/randomchaos/archive/2010/02/10/xna-and-windows-7-multi-touch.aspx
Now, that pretty much ties you to the API, but it stands to reason that you could refactor this so that it was more generic, and then eventually just use the built-in touch API (assuming they implement touch on windows, which I believe they will).

Related

MVVMCross and Prism combination

I've been looking into adopting MvvmCross in developing our next generation of software, mainly with the aim of developing tablet UIs for it. I understand that MvvmCross does not currently support WPF but I can see ourselves developing that and contributing it back.
However, I've also noticed that MvvmCross seems to be very light weight in that there is little support for composite UI as described in the Prism guide.
Unfortunately, we do need to allow for more complex composited UI scenarios.
Given what is stated in https://stackoverflow.com/questions/10224376/mvvmcross-experiences-hindsight-limitations about forking or rolling your own with MvvmCross as a reference, and given that we do need more complex UI scenarios than those that MvvmCross provides, what would the best course of action be, fork and reimplement the parts of prism we need, try to get MvvmCross to work together with Prism as is, or develop our own from the inspiration of MvvmCross and MonoCross?
Update: See Second answer below...
I might need to write a longer answer to this tomorrow...
As an initial answer:
someone has already done a port of MvvmCross to Silverlight and the developers have suggested this might become available to the wider community
the PCL version of MvvmCross should be quite straight-forward to port to WPF - although possibly not if older .Net Runtime versions are required
as the chief dev of MvvmCross to date, I'm personally interested in supporting WPF - especially right now for my project http://github.com/slodge/BallControl which needs a desktop to run in (Windows Store is crippled - pah!)
composite UIs are supported in MvvmCross - e.g. tabs, pivots, panoramas, splits, modal children, etc - but there's not much work been done yet on a full composite UI like often seen in Prism.
I have seen people combine MvvmCross with other IoC frameworks, but (no work that I know of) has been done to date on combining MvvmCross with MEF (which is often used with Prism?)
If I were tackling this problem area, then I'd come at this:
Make sure we try to get a working app out first and foremost - the app matters more than the framework.
For framework, I'd try porting the basic IoC setup across first and some simple navigation
For the custom navigation (for displaying UIs in regions) I'd look at the role of the Presenter in MvvmCross - this is what I use in Tab examples, in iPad split view examples, etc to provide complex UI features.
If this custom navigation isn't enough I'd look at how it might be changed/replaced/extended - my guess is that the genuine requirements for WPF/Prism will actually be quite similar to the genuine requirements for bigger iPad, Surface and Nexus tablet apps.
I'd try to keep everything modular and optional so that small phone apps don't have to pull in big navigation processes that bigger apps might need. The downside of this might be lots of projects and DLLs!
I'd also be open to this splitting into separate project(s) - much of the modern software world is ruled by small targetted apps rather than bigger, sprawling frameworks.
Because I'm part time on Mvx, and this is your full time job, I'd definitely recommend you don't let Mvx hold you back!
My initial reaction is 'yes, I'd be really interested in working on this' - the downside (as above) is that I'm only spare time on mvx....
Here's the second answer...
I took the WinRT version of MvvmCross as a base (but also used elements of Console, WP7, Touch and Droid too)
I produced a simple WPF version of MvvmCross - https://github.com/slodge/MvvmCross/tree/vnext/Cirrious/Cirrious.MvvmCross.Wpf
The main feature of this version is that it doesn't contain much in the way of navigation
e.g. don't try calling Back!
e.g. the main presenter is left abstract for the application UI to implement - see https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Wpf/Views/MvxWpfViewPresenter.cs
I then took the TwitterSearch demo app - https://github.com/slodge/MvvmCross/tree/vnext/Sample%20-%20TwitterSearch/TwitterSearch.UI.Wpf
created some simple views (using cut and paste of Xaml from WP7 version)
created a simple Region based presenter - see how RegionAttribute is used in https://github.com/slodge/MvvmCross/blob/vnext/Sample%20-%20TwitterSearch/TwitterSearch.UI.Wpf/MultiRegionPresenter.cs and in https://github.com/slodge/MvvmCross/blob/vnext/Sample%20-%20TwitterSearch/TwitterSearch.UI.Wpf/MainWindow.xaml.cs
that was kind of it... give or take a couple of hours of debugging
There's a video of this in action - with some explanation at: http://youtu.be/pYkLxqpu_5E
This is obviously only a first step in Wpf support, but I suspect it is already going to satisfy quite a few use cases... Please feel free to fork the source tree and to extend or replace this first attempt. Also, if it doesn't work for you, then feel free to abandon it and try something else instead.
I will try to work on this more - but can't really prioritise it above paid work... but I am open to being paid to work on mvvmcross too :)

Future of PivotViewer control and HTML 5 equivalent

As Silverlight's future seems to be quite unsure, does anybody know if the PivotViewer control will still be maintained and updated?
I wish to develop an application based on this amazing control but I am not confident whether it will be maintained or not.
Is there any HTML5 initiative for developing such data visualization behavior?
Thanks.
I've been working on a HTML5 version of PivotViewer for a while now, you can see it here: http://pivot.lobsterpot.com.au/html5.htm.
This first prototype version doesn't have pan or zoom, but I do have a later version in the works that supports pan, zoom and tile templates.
I know this is an old question, but this control has been one of those awesome ones. The lobsterpot control is open sourced on github by openlink:
https://github.com/openlink/html5pivotviewer
if you're a budding dev for js, fork and improve :)
The short answer is that Silverlight as a whole will be "maintained and updated" for years.
There is so much talk of the death of Silverlight, but it and XAML are still top-tier Microsoft technologies. Nothing should stop you using the PivotViewer control and Silverlight in your application. If, in several years you're still working on the same thing and you feel support is lacking, cross that bridge then and reassess this decision.
There's an HTML5 version of PivotViewer around now by members of the original team that made the Silverlight version. It's sad that there is no WPF and WinRT version of it by Microsoft btw.
see links I've gathered on PivotViewer here
https://www.dropbox.com/sh/kf7pir9gf0wwdwy/AABmsm5LDcGYoA7UDGH33tTha?dl=0
those were collected during the development of ClipFlair project (http://ClipFlair.net - see http://clipflair.codeplex.com for the source code). Choose the "Gallery" option to see Silverlight PivotViewer in use there inside a zoomable floating window container that can host other components too along with it.

Silverlight Webcam

Is it possible to access a webcam in Silverlight
From what I've read it's not possible in Silverlight 1.0 but what about 2.0... 3.0 ... 4.0?
It is now possible in Silverlight 4.0. Developer preview is available at http://silverlight.net/getstarted/silverlight-4-beta/
I'm afraid webcam support isn't available in Silverlight 2.0. You might hope for it to be added in a future version, but there's no easy way of doing it now... Saying this, some people have invented various hacks that use other technologies in combination with Silverlight to capture video from the webcam. They typically involve interfacing with Flash, which of course is perfectly capable of utilising webcams. See this article for an example (with source code included). It's not a pretty solution (at least in my opinion), and may not be 100% stable across browsers/platforms, but I think it's the best you're going to get for now. Perhaps you should submit feedback directly to Microsoft if you really want to see support in Silverlight 3.0 (though it's certainly been mentioned elsewhere, so it may already be on the to-do list).
Silverlight 4 supports web cams. To capture images you can use www.glo6.com/camera1.aspx
It saves encoded images to web server. If there is a need to motion tracking, save images regularly, and then compare them on your server with another application.
I asked a member of the Silverlight team when they would be coming out with webcam support, and he said, in effect, "Let's just say that it's a really high priority for Silverlight 4.0." That said, it hasn't been officially announced yet, so I wouldn't count on it until MS does make the announcement.
I've used the Silverlight -> JavaScript -> Flash hack in production code, and while it does work, it doesn't work very well. Among other things, it's a pain to keep the Flash camera synchronized with your Silverlight UI. The camera shows up on top of SL child window controls, for instance, and of course, doesn't obey the clipping rules for when, say, it should be scrolling out of sight in a list box. And animations are a PITA as well. It's all possible, just slow and unpleasant, and several orders of magnitude more work than it would be if MS just supported web cams in Silverlight.

How can I use WPF's D3DImage with managed DirectX or XNA?

I'd really like to get into some D3D coding, but I don't have the time lately to learn C++ for what will amount to a hobby project.
If you're looking for a managed way to do Direct3D programming, I would recommend SlimDX. It's an open source .NET wrapper over DirectX. Since managed DirectX is not being supported any longer by Microsoft, this is a good way to use managed code with D3D. It's updated quite frequently and I've had very good luck using it thus far. There's a thread here that talks about using SlimDX with D3DImage.
It's not officially supported as far as I know. Looks like some folks hacked it to make it work.
Looks like this might not be an issue for much longer, at least come .NET 4.0. Microsoft showed off a demo of XNA integration with WPF at PDC on Tuesday. If you want to see it in action, you can see the session video at the PDC site:
https://sessions.microsoftpdc.com/public/timeline.aspx
The session is PC46 (WPF Roadmap), XNA demo is around the 38 minute mark. I'm hoping they'll go into more details during the WPF Graphics Futures talk today (Session PC07). Might be a bit down the road, but it's encouraging that they're working on it.
Another alternative to managed DirectX and XNA is MOgre, which is a C# wrapper around a great open source C++ graphics engine that uses Direct3D, called Ogre3D. (If it is a hobby project, I think you might get going quicker by using an engine like this rather than straight-up D3D. I don't know much about XNA or SlimDX.)
Here is a CodeProject article by Leslie Godwin that takes the D3DImage class (from the Dr. WPF article mentioned by Ian) and shows how to use it with MOgre.
Edit: I created an open source project, called MogreInWpf, for using D3DImage with Mogre, based on Leslie Godwin's code referenced above, and with an alternative sample app.

What exactly is WPF?

I have seen lots of questions recently about WPF...
What is it?
What does it stand for?
How can I begin programming WPF?
WPF is a new technology that will supersede Windows Forms.
WPF stands for Windows Presentation Foundation
Here are some useful topics on SO:
What WPF books would you recommend
What real world WPF applications are out there
From my practice I can say that WPF is a truly amazing technology however it takes some time to get used to because it's totally different from the WinForms.
I would recommend you to take a look at this demo.
WPF is the next frontier with Windows UIs.
Built on top of DirectX, it opens up hardware acceleration support for
your .Net 3.0+ user-interfaces.
Emphasis on Vector Graphics - UIs scale and render better
Composable UIs. You could nest animated buttons in combo boxes.. the world's your oyster.
Is a rewrite with only minimal core components written in unmanaged code VS GDI-User Dll based Winforms approach which is a thin managed layer over largely unmanaged code.
Declarative approach to UI programming, User Interfaces are largely specified in a XML variant called XAML (eXtensible Application markup language) pronounced Zammel. This opens up WPF to designer folks who can specialized tools to craft UIs that the developers can then code up. No translation losses between wireframes to final product.
MS 'allegedly' will not provide any future updates to Winforms. Heavily invested in WPF as the way forward
Oh yeah, before I forget. Works best on Vista :)
You can get either Adam Nathan's WPF Unleashed Book or Chris Sells Programming WPF .. those seem to be the way to go. I just read the first chapter of Adam's (Lead for WPF at MS) book. Hence the WPF praise fountains :)
Take a look here http://windowsclient.net/ and here Windows Presentation Foundation (WPF)
Basically WPF is created to make windows form easier to design because of the use of XAML, designers can work on the design and programmers on the underlying code
WPF is the Windows Presentation Foundation. It is Microsoft's newest API for building applications with User Interfaces (UIs), working for both standalone and web-based applications.
Unsurprisingly, there is a very detailed but not all that helpful Windows Presentation Foundation page at Wikipedia.
The WPF Getting Started Page at the Microsoft MSDN site is probably a better place to start.
Is the new Windows Gui system. I don't believe its aim is to make development easier per se but more to address fundamental issues with WinForm, such as transparency and scaling, neither of which WinForm can effectively address. Furthermore it seeks to address the "one resolution only" paradigm of WinForm by mapping sizes to real-pixel sizes and making flow layout easier and more fundamental.
It's also based on an XML derivative making it easier to change the UI and forcing a separation of the UI and the core code (although technically you can still badly hack it together in this manner).
This separation also drives a desire to be able to divide the work into two camps, the designers taking charge of the XAML and layout and the programmers taking care of developing the objects used in the XAML.
Check out Eric Sink's Twelve days of WPF 3D.
Windows Presentation Foundation. It's basically Microsoft's latest attempt to make development easier, and provide a whole heap of nice functionality out of the box. I'm not sure where to start, but googling "WPF 101" should throw up a few useful links.
WPF is part of the .net 3.0 stack. Its microsoft's next generation Graphical User Interface system. All the information you need can be found on wikipedia and msdn's wpf site
To Get Started programming I guess check out the essential downloads on windows client

Resources