Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to write a WinRt (Metro) app that will also work on Windows 7 and Vista?

Tags:

We can’t just leave our customers that are not able to upgrade to windows 8 for a long time in the larch. However there is demand for a “tablet”/”touch” version of our app.

So how can we support both touch with Metro on Windows 8 and our current customers from a single code base?

When WPF come out, after a lot of “Pushing” Microsoft saw since and make it work on Windows XP – has anything like this been talked about for WinRT.

(I am not expecting any solution to work on XP, as XP support is being wound down.)

See Also: Can the ARM version of Windows 8 only run Metro (WinRt) style apps?

like image 745
Ian Ringrose Avatar asked Sep 15 '11 08:09

Ian Ringrose


People also ask

What are Windows Metro apps?

Metro apps are touch-screen-friendly apps written especially for Microsoft's WinRT programming interfaces. ARM-based Windows RT devices, such as the Surface tablet, will require Metro apps. Devices running Windows 8 are expected to be able to run both Metro apps and Win32 apps.

What are WinRT applications?

WinRT applications are applications that use Windows Runtime framework. More specifically, these are Windows Store and Universal Windows Platform (UWP) applications. Note that dotTrace is unable to profile a UWP application if it uses . NET native tool chain.

What is WinRT DLL?

C#/WinRT is a NuGet-packaged toolkit that provides Windows Runtime (WinRT) projection support for the C# language. A projection assembly is an interop assembly, which enables programming WinRT APIs in a natural and familiar way for the target language.


2 Answers

The best answer is that you do not want the same application to run on Windows 7 and Windows 8 Metro style. The UI that works best for mouse and keyboards (windows 7) will not work well for a touch-first presentation and visa versa. It is important to re-imagine the UI for the two different worlds.

That said, you have 2 options if you want to share a lot of the code: 1) Write it largely in JavaScript/HTML5. This will let you re-use many of the assets (especially the business logic parts). 2) Write it in (desktop) Silverlight. The Silverlight XAML is closest to Windows XAML. WPF is further away and will require more re-work later.

In either case, you should look at and follow the principles used when writing cross-platform code. Understand the platform dependencies and isolate them behind indirection boundaries. You want to localize all of the code that will have to change. For instance, you don't want calls to the .Net System.IO.File APIs which you know will have to change to Windows.System.Storage calls being scattered throughout your code. Instead, you want it localized in one function that can be modified later.

like image 171
Steve Rowe Avatar answered Oct 21 '22 09:10

Steve Rowe


The only way I can think of is to implement your application in HTML5/CSS3/JS, and avoid using WinRT APIs inasmuch as possible - this may be feasible depending on what, exactly, your app needs to do (e.g. portable 2D graphics is easy with HTML5 canvas).

Then, for Win8, you'll package this as Metro web app. For Win7 and below, you write a simple app that embeds your browser of choice (not IE9, since it doesn't work on XP - so Firefox or Chrome) with all chrome hidden, and loads your HTML5 app inside that embedded browser.

like image 32
Pavel Minaev Avatar answered Oct 21 '22 10:10

Pavel Minaev