retargeting a baytrail* windows* 8 store sample ... · design best practices recommended for...

14
1 Retargeting a BayTrail* Windows* 8 Store Sample Application to Windows 8.1 Abstract This article discusses the process of retargeting an existing healthcare sample app from Windows 8 to Windows 8.1. In particular, using special features that were added to Visual Studio 2013 for retargeting/importing windows store apps, build errors, and challenges faced. In addition, using 3 rd party libraries and newly available UI controls & features are discussed. Contents Abstract.............................................................................................................................................................................................................. 1 Overview ........................................................................................................................................................................................................... 1 Retargeting Windows Store Apps to Windows 8.1 ................................................................................................................. 2 A Healthcare Windows Store App...................................................................................................................................................... 2 Retargeting sample healthcare app.................................................................................................................................................. 3 Using Visual Studio 2013 to import the app .................................................................................................................... 5 Fixing build errors and 3rd party library issues.............................................................................................................. 7 Summary......................................................................................................................................................................................................... 12 Overview Windows 8.1 brings new features, APIs, UI, and performance enhancements to the windows platform. It is up to the developer to take advantage of new features and re-implement some parts

Upload: others

Post on 18-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

1

Retargeting a BayTrail* Windows* 8 Store Sample Application to Windows 8.1

Abstract

This article discusses the process of retargeting an existing healthcare sample app from Windows 8

to Windows 8.1. In particular, using special features that were added to Visual Studio 2013 for

retargeting/importing windows store apps, build errors, and challenges faced. In addition, using 3rd

party libraries and newly available UI controls & features are discussed.

Contents

Abstract .............................................................................................................................................................................................................. 1

Overview ........................................................................................................................................................................................................... 1

Retargeting Windows Store Apps to Windows 8.1 ................................................................................................................. 2

A Healthcare Windows Store App ...................................................................................................................................................... 2

Retargeting sample healthcare app.................................................................................................................................................. 3

Using Visual Studio 2013 to import the app .................................................................................................................... 5

Fixing build errors and 3rd party library issues .............................................................................................................. 7

Summary ......................................................................................................................................................................................................... 12

Overview

Windows 8.1 brings new features, APIs, UI, and performance enhancements to the windows

platform. It is up to the developer to take advantage of new features and re-implement some parts

Page 2: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

2

of an app that will benefit from the new Windows 8.1 enhancements. Even a simple retarget and

compile can result in benefits such as quick app startup time and automatic windows store app

updates.

This article will look at migrating a sample healthcare app to Windows 8.1.

For an in-depth and general technical discussion of migrating a Windows Store App to Windows 8.1,

please refer to the following white paper.

http://msdn.microsoft.com/en-us/library/windows/apps/dn376326.aspx

Retargeting Windows Store Apps to Windows 8.1

Depending on the functionality and complexity of your app, the process of retargeting Windows

Store Apps to Windows 8.1 is relatively a straight forward process.

Developers can plan their retargeting process to be incremental. Initially, the app can be recompiled

to resolve any build errors so the app takes advantage of the Windows 8.1 platform. Subsequently,

developers can review any functionalities in the app that will benefit from re-implementation using

the newly available APIs. Finally, the retargeting process gives the developer an opportunity to

review the compatibility of 3rd party libraries in Windows 8.1.

When the healthcare sample app was migrated to Windows 8.1, the simple recompile option,

checking usage of 3rd party libraries, and re-implementing the settings control using the new

Windows 8.1 XAML control was performed.

For reference, Microsoft Developer Network has extensive documentation that covers all facets of

migrating an app to Windows 8.1. Please refer the following link.

http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx

A Healthcare Windows Store App

As seen in several other articles in this forum, we will use a sample healthcare Line of Business

Windows Store app.

Page 3: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

3

Some of the previous articles include:

Porting App Life Cycle, Settings and Search Features from iOS* to Windows*

8 - Porting the User Interface from an iOS* Basic App to Windows* 8

Porting Advanced User Interface from iOS* to Windows* 8

Porting iOS* Custom Charts and Graphs to Windows* 8 UI

The application allows the user to login to the system, view the list of patients (Figure 1), access

patient medical records, profiles, doctor’s notes, lab test results, and vital graphs.

Figure 1: The “Patients” page of the Healthcare Line of Business app provides a list of all patients. Selecting an individual

patient provides access to the patient’s medical records.

Retargeting sample healthcare app

Before the sample app is retargeted, it is useful to review different components, UI features, and 3rd

party libraries that are used.

The UI and the core app life cycle handling of the app were implemented using the templates

available in Windows 8. Windows 8.1updated the project & page templates and included a brand

Page 4: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

4

new Hub pattern template. The app uses sqlite* as its backend database to store all patient records.

WinRTXamlToolkit* is used for charts and the 3rd party library Callisto* is used for implementing the

Settings Control. The Settings Control is invoked by the charms bar. Windows 8.1 has a new XAML

based settings controls that can be used instead of a 3rd party library.

The app has search functionality implemented using the charms bar integrated in Windows 8.

Windows 8.1 has a new in-app search UI control that could be used to extend the search experience

to different UI pages of the app, depending on the requirements.

The sample app has several other functionalities like camera usage, NFC and audio recording that

will continue to function in Windows 8.1 without any changes.

As mentioned earlier, Visual Studio 2013 was used to recompile the sample app for Windows 8.1, 3rd

party library build issues were fixed, and parts of the app were re-implemented using new Windows

8.1 features. The app can be refined further in the future by re-implementing more pieces of the

app that benefit from the Windows 8.1 platform. For example, new page templates, view models

for different screen sizes, the new in-app search, or the new tile sizes and templates could be

utilized.

Page 5: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

5

Using Visual Studio 2013 to import the app

To retarget the app for windows 8.1, first download and install Visual Studio 2013 on a Windows

8.1 host machine. After the installation, ensure any 3rd party libraries are updated to the latest

version inside the Visual studio extensions.

The project was opened in Visual Studio 2013 and no errors were seen when compiling the project

out of the box. To retarget the project to Windows 8.1, right-click the project name in the solutions

explorer and the option for retargeting the project to Windows 8.1 is shown in the list (Figure 2)

Figure 2: Option for retargeting the project (captured from Visual Studio* 2013)

Page 6: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

6

Clicking on this option brings up a dialog box asking for confirmation. Verify that the project selected

is correct and press the OK button.

Figure 3: Confirmation Diaglog for retargeting (captured from Visual Studio 2013*)

After Visual Studio completes the action, you should see the project now has “Windows 8.1” next to

the project name in the solution explorer (Figure 4).

Page 7: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

7

Figure 4: Solution Explorer shows the project is retargeted to Windows 8.1 (captured from Visual Studio 2013*)

When trying to compile the project, build errors may occur. Figure 4 also shows some 3rd party

libraries showing build issues. In the next section, resolving build errors and 3rd party library issues is

discussed.

Fixing build errors and 3rd party library issues

Page 8: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

8

Updating the 3rd party libraries to latest version resolves some of the problems. The Visual Studio*

extensions dialog can be used to check for the latest library version available. For Sqlite*, it was

updated to the Windows 8.1 version as shown Figure 5.

Figure 5: Extensions dialog (captured from Visual Studio 2013*)

The usage of some of the 3rd party libraries in the app were re-evaluated after migrating to

Windows 8.1. As mentioned earlier, the Settings UI control has been added to Windows 8.1. It was

decided that it would be best to remove the 3rd party library Callisto* from the app and utilize the

native Windows 8.1 control. To migrate to the native control, all source code references to the

Callisto* library were removed. Please see Figure 6 to see the updated project references in the

solutions explorer.

Page 9: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

9

Figure 6: project references in sample app after retargeting to Windows 8.1* (captured from Visual Studio 2013*)

WinRTXamlToolkit* is still being utilized for charts and other features, so it has been updated to the

Windows 8.1 version.

By using the newly available Windows 8.1 XAML settings control, the app maintains the same look

and feel as when using the 3rd party library. Figure 7 shows the settings control in design mode.

Page 10: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

10

Figure 7: Settings Flyout UI in design mode (captured from Visual Studio 2013*)

Using the new XAML based settings control, SettingsFlyout, is similar to other XAML controls. The

following snippet shows the XAML code used for the sample app’s settings UI.

<SettingsFlyout

x:Class="PRApp.Views.PRSettingsFlyout"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:local="using:PRApp.Views"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

mc:Ignorable="d"

IconSource="Assets/SmallLogo.png"

Page 11: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

11

Title="PRApp Options"

HeaderBackground="{StaticResource StandardBackgroundBrush}"

d:DesignWidth="346"

xmlns:c="using:PRApp.ViewModels">

<SettingsFlyout.Resources>

<c:SessionSettingsViewModel x:Key="myDataSource"/>

</SettingsFlyout.Resources>

<!-- This StackPanel acts as a root panel for vertical layout of the content sections -->

<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >

<StackPanel Orientation="Horizontal" Margin="5" >

<TextBlock Text="{Binding Source={StaticResource myDataSource},

Path=SessionSettings.Loginuser.Login}" Margin="0,0,5,0" />

<TextBlock Text="{Binding Source={StaticResource myDataSource},

Path=SessionSettings.Loginuser.Loginmsg}" />

</StackPanel>

<Button Content="User Home" Margin="5" Command="{Binding Source={StaticResource prAppUtil},

Path=UserHomeCmd}"/>

<Button Content="Logout" Margin="5" Click="Button_Click_1" />

<ToggleSwitch Header="Show Deceased Patients" Margin="5" IsOn="{Binding Mode=TwoWay,

Source={StaticResource myDataSource}, Path=SessionSettings.ShowDeceased}"/>

<StackPanel Orientation="Horizontal" Margin="5" >

<ToggleSwitch Header="Use Cloud Service" Margin="5,0,0,0" IsOn="{Binding

SessionSettings.UseCloudService, Mode=TwoWay, Source={StaticResource myDataSource}}"/>

</StackPanel>

<StackPanel Orientation="Vertical" Margin="5">

<TextBlock Margin="5" FontSize="14" Text="Server Address:" Width="97" HorizontalAlignment="Left"

VerticalAlignment="Center" />

<TextBox HorizontalAlignment="Stretch" FontSize="12" Margin="5" Text="{Binding

SessionSettings.ServerUrl, Mode=TwoWay, Source={StaticResource myDataSource}}" />

</StackPanel>

<Button HorizontalAlignment="Right" Click="Button_Click_Test_Connection" Content="Test Connection"/>

<TextBlock TextWrapping="Wrap" x:Name="StatusText" HorizontalAlignment="Left" Text="{Binding

SessionSettings.TestConnectionStatus, Source={StaticResource myDataSource}}" />

</StackPanel>

</SettingsFlyout> Figure 8: XAML code snippet for settings flyout in sample app

Page 12: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

12

Configuring and initializing the SettingsFlyout is done in the app’s main point of entry (App.xaml.cs

file). SettingsFlyout is added to the ApplicationCommands collection. Please see the following code

snippet in Figure 9 for reference.

protected override void OnWindowCreated(WindowCreatedEventArgs args) { Windows.UI.ApplicationSettings.SettingsPane.GetForCurrentView().CommandsRequested += Settings_CommandsRequested; } void Settings_CommandsRequested(Windows.UI.ApplicationSettings.SettingsPane sender, Windows.UI.ApplicationSettings.SettingsPaneCommandsRequestedEventArgs args) { Windows.UI.ApplicationSettings.SettingsCommand PRSettingsCmd = new Windows.UI.ApplicationSettings.SettingsCommand("PRAppOptions", "PRApp Options", (handler) => { PRSettingsFlyout PRSettingsFlyout = new PRSettingsFlyout(); PRSettingsFlyout.Show(); }); args.Request.ApplicationCommands.Add(PRSettingsCmd); }

Figure 9: Code snippet showing the settings flyout initialization

SettingsFlyout is an excellent feature in Windows 8.1 that iseasy to use and it comes with all the

design best practices recommended for Windows Store Apps. In addition, the effort to transition to

this native control was painless.

Summary

This article discussed retargeting a sample health care Windows Store App from Windows 8 to

Windows 8.1. The steps involved in the retargeting process were covered in detail with relevant

screenshots and code snippets. The article concluded with a discussion about replacing a 3rd party

library with a native Windows 8.1 control.

Page 13: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

13

Notices

INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE,

EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED

BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH

PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED

WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES

RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY

PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.

UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR

INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A

SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.

Intel may make changes to specifications and product descriptions at any time, without notice. Designers must

not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined."

Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or

incompatibilities arising from future changes to them. The information here is subject to change without

notice. Do not finalize a design with this information.

The products described in this document may contain design defects or errors known as errata which may

cause the product to deviate from published specifications. Current characterized errata are available on

request.

Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing

your product order.

Copies of documents which have an order number and are referenced in this document, or other Intel

literature, may be obtained by calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htm

Software and workloads used in performance tests may have been optimized for performance only on Intel

microprocessors. Performance tests, such as SYSmark* and MobileMark*, are measured using specific

computer systems, components, software, operations, and functions. Any change to any of those factors may

cause the results to vary. You should consult other information and performance tests to assist you in fully

evaluating your contemplated purchases, including the performance of that product when combined with

other products.

Any software source code reprinted in this document is furnished under a software license and may only be

used or copied in accordance with the terms of that license.

Intel, the Intel logo are trademarks of Intel Corporation in the US and/or other countries.

Copyright © 2013 Intel Corporation. All rights reserved.

*Other names and brands may be claimed as the property of others.

Page 14: Retargeting a BayTrail* Windows* 8 Store Sample ... · design best practices recommended for Windows Store Apps. In addition, the effort to transition to this native control was painless

14

++This sample source code is released under the Intel OBL Sample Source Code License (MS-LPL

Compatible), Microsoft Limited Public License, and Visual Studio* 2013 License.

Optimization Notice

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for

optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3,

and SSE3 instruction sets and other optimizations. Intel does not guarantee the availability,

functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel.

Microprocessor-dependent optimizations in this product are intended for use with Intel

microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel

microprocessors. Please refer to the applicable product User and Reference Guides for more

information regarding the specific instruction sets covered by this notice.

Notice revision #20110804