ENG [#IOT] Different behaviors for an App based on the app architecture (9 on N) #RaspberryPi2 #Windows10

Hello!

New post for Windows 10 and Raspberry Pi 2 series

  1. Hardware and software (1 on N)
  2. Boot from SD card in the device (2 of N)
  3. Hello World mode! (3 of N)
  4. Visual Studio deployment process and Web Management app (4 on N)
  5. Hello Blinky !!! (5 on N)
  6. Some admin tasks, like change password and change name (6 on N)
  7. List of connected devices in the Raspberry Pi 2 (7 on N)
  8. Deploy an app using the deploy package (8 on N)
  9. Different behaviors for an App based on the app architecture

If you’re an old school developer when you find a change one of the oldest APIs, for sure you’ll suffer a heart attack. That’s what happened with the classical System.Environment. The following image shows the difference that we have between a classic WPF app with .net 4.5 and a Universal App for Windows 10.

Clipboard07

Now a Universal App will execute in a controlled environment (Sandbox), whether on a laptop, a smartphone or a device. This implies that the app capabilities are tied to this Sandbox. For example, what formerly used to get from the Environment, now perhaps we must look for it in the Package of the application. The architecture of the processor is an example, and the following code shows an example to validate if the app is running on an ARM processor.

Clipboard10

While the idea behind Universal Apps is to have the maximum code unified for all platforms, should take into account the capabilities of each platform. For example, in ARM we don’t have the possibility to use MessageDialogs so if we want to show a message we have to do a bit of defensive programming .

Clipboard12

This allows us to display a message in the mode dialog on a laptop or tablet

Clipboard14

And for the case of ARM, the message in a TextBlock as part of the app.

Clipboard01

The sample code on github

https://github.com/elbruno/W10Rpi2/tree/master/SystemInfoV02

Saludos @ Madrid

/El Bruno

References

Environment.Is64BitProcess, https://msdn.microsoft.com/en-us/library/system.environment.is64bitprocess(VS.100).aspx

MessageDialog, https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.popups.messagedialog.aspx

Advertisements

3 thoughts on “ENG [#IOT] Different behaviors for an App based on the app architecture (9 on N) #RaspberryPi2 #Windows10

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s