320 likes | 461 Views
‘Metro’ / Modern – ‘WinRT’. Also known as ‘Windows Store Apps’ --o-0-o-- Windows 8 comes as two parts Win32 and WinRT The Traditional Desktop is Win32 The new WinRT is ‘Metro’ or ‘Modern’ --o-0-o-- I will call it METRO
E N D
‘Metro’ / Modern – ‘WinRT’ Also known as ‘Windows Store Apps’ --o-0-o-- Windows 8 comes as two parts Win32 and WinRT The Traditional Desktop is Win32 The new WinRT is ‘Metro’ or ‘Modern’ --o-0-o-- I will call it METRO http://www.winclickstartvulcan2.net/WebNotes/ClickStartMETRO/ClickStartMETRO.html
The ‘Surface’ Tablet Microsoft make and sell :- - a ‘Surface RT’ – which runs ‘WinRT’ only - a ‘Surface Pro’ which runs Win32 & ‘WinRT’ ‘Surface RT’ is designed for personal on-the-move use. ‘Surface Pro’ is for nerds like us – we can use it to create and develop apps for Phone and Tablet. The ‘Pro’ model can be run as a powerful workstation running VS 2012, SQL Server, TFS, and with Hyper-V run virtual machines – so the phone8 ‘Emulator’ works.
Windows 8 – on a Desktop We can use Win8 on our desktops to create apps for the WinRT ‘Surface’ tablet, and test run them, without having a real Tablet device. The ‘Simulator’ is what is used by VS2012. The ‘Simulator’ does not use a VM & Hyper-V But app development for Phone8 does and the test platform is called the ‘Emulator’.
‘WinRT’ – GUI and XAML mark-up WPF, ‘WinRT’ and ‘Phone8’ all use the same UI technology, based on XAML script. We can transfer 95% of learned skills and knowledge across all three Microsoft platforms. Along with XAML comes data binding, and this too is consistent across the platforms.
‘Licence’ - Creating Apps As soon as we try to use VS to create apps for Tablet and Phone, we get a dialog to get a licence.
Restrictions – ‘File Access’ There is a ‘Sandbox’ in both ‘WinRT’ for Tablet as well as ‘WP8’ for Windows smartphone. Without the user’s consent, files can only be accessed from the local folder. Local folders can’t be seen from outside the app. Other user files are available only through a file dialog tool. This is NOT as bad as it sounds !
‘Restrictions’ – Asynchronous operations Any ‘external’ operation has to be asynchronous. We as developers are NOT allowed to ‘block’ the operation of the Tablet / Smartphone. C# code has ‘await’ and ‘async’ as well as ‘Task’ in its keywords. This is new to many, and takes a little getting used to – BUT – it is quite useable once we have a few good examples, to copy and adapt.
‘Task’ – return type Often we need to return something – simple data, or a custom object. The ‘Task’ with a type is the way to do this :-
“Goodbye” – ‘MessageBox’ ! You will see stuff like this from time to time :- [ I suggest just give it up – no message boxes at all !? ]
“Goodbye” – ‘MessageBox’ (b) Here is what ‘Mr. Windows himself has to say :- (Charles Petzold, that is …)
Style of Apps – ‘Page’ driven We need to add our own page navigation – app bar icons. Loss of data if controls not ‘bound’ to project properties.
MVVM patterns – ‘Prism’ and ‘light’ Both are available to Metro. I prefer ‘Prism’ as it is from Microsoft, and is not a “one man band” effort. This is my personal choice on how I approach things. I got good results with ‘Prism’ but read that the ‘Light’ version from “Laurent Bugnion” (GalaSoft) works okay. I will try it out for my eNotes.
MVVM – lots of choices …… Or ‘nothing’ !
‘Touch’ – is what its all about ! Whether on Desktop, Tablet, or Phone – its TOUCH !!! … for ‘Windows 8’. Acer do a 23” ten point touch-screen. Ten point tracking is the Microsoft standard. Surface does 10 points. Other tablet oriented devices may be less, like 5. The events for ‘WinRT UI’ elements no longer have ‘click’ everywhere, and ‘mouse’. Checkout ‘pointer’, ‘tap’ and ‘press’. [ Only a Button still has a ‘click’ ]
“Data” – using SQL, on Tablet As yet Microsoft have not provided us with SQL provision – strangely!? ‘Phone8’ has L2S (LINQ to SQL) and it works fine. For the moment, I am using ‘SQLite’ and it works fine enough, but lacks good LINQ support. I would expect something soon from M$, perhaps with MSSS 2014 ? --o-0-o-- Since ‘Entity Framework’ works with WP8 we can expect something soon for ‘WinRT’. --o-0-o--
The “Thread Pool” Plenty of ‘Timer‘ choices – Dispatcher, as well as Delay and Periodic via the “Thread Pool”. { .. it is easy to use .. } Guidelines advise up to use the pool for tasks outside of the main UI thread. Here is a set of six UserControls (UCs) which each use a timer from the pool. All six are ticking away and refreshing the local times in the time zones indicated. See ‘ClickStartMETRO’ for more details on how to do this.
Metro dragging – more fun ! ‘FlipView’ – ‘ListView’ – ‘GridView’ : above are two ‘ListView’ controls
Last, but ‘yes’ LINQ !‘last but not least’ ‘LINQ to Objects’ works for Tablet and Phone8. If collections are in-memory then LINQ works. ‘LINQ to SQL’ is not as yet available to ‘WinRT’. ‘SQLite’ is available to Metro, but it has some limited ability with LINQ – through ‘sqlite-net’, a wrapper. In my trial apps I use basic LINQ to retrieve a collection for a Table, and then ‘LINQ to Objects’, to do the rest.