O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a navegar o site, você aceita o uso de cookies. Leia nosso Contrato do Usuário e nossa Política de Privacidade.
O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a utilizar o site, você aceita o uso de cookies. Leia nossa Política de Privacidade e nosso Contrato do Usuário para obter mais detalhes.
Do you want to port your app rapidly or invest in greater maintainability? See the Improving maintainability section for a few techniques that you can use to single-source your project or to help reuse code and binaries between projects targeting different platforms. The resolution of a Windows Phone 7 device is 800x480 (WVGA) in landscape mode, and 480x800 in portrait mode. A Windows 8 device can have multiple possible portrait and landscape resolutions, in a variety of aspect ratios. How will your interface and assets scale? See Plan for different form factors for some ideas.A Windows Phone 7 interface is touch-specific. Your Windows 8 interface should support touch as well, but also support other input methods like mouse and keyboard. Will your interface feel cumbersome to someone who is not using touch? See Plan for accessibility for info on keeping your app useful regardless of user input method. Do you have phone-specific functionality in your Windows Phone 7 app? Are you aware of equivalent networking technologies in the Windows Runtime? If you have extensive support for phone or provider features, you may need to redevelop them to be more network or provider independent.Is your app a game that relies on XNA components for graphics rendering? If so, you must port your graphics code to Microsoft DirectX using C++. For more info, see Creating a DirectX game. You can also use DirectX in combination with XAML and with components written in managed languages. For more info, see DirectX and XAML interop and Creating Windows Runtime Components.
Launch Microsoft Visual Studio Express 2012 for Windows 8 and create a new Windows Store app using C++, C#, or Visual Basic. Choose a project template that best matches your app layout and functionality. For more info, see Jumpstart your Windows Store app using templates (C#, C++, Visual Basic).Copy the folders, code, and asset files that you want to reuse in the new project. In the Visual Studio Solution Explorer, click Show All Files. Select the files and folders that you copied, and then right-click them and select Include In Project.Perform a global search and replace to replace "System.Windows" with "Windows.UI.Xaml". Copy any reusable parts of your original XAML code into the new project's XAML files, or into newly created XAML files as necessary. You can sometimes copy and reuse small chunks of XAML such as styles and data templates or the contents of simple layout elements, but not the outermost elements (typically PhoneApplicationPage elements). Build the project to generate errors, then use these errors to identify parts of your code to update or replace. Sometimes the updates required will be as minor as parameter type changes. Other updates will require you to use Windows Runtime APIs instead of .NET APIs for Windows Store apps. To identify which APIs are supported, use this topic for guidance in combination with .NET for Windows Store apps overview and Porting Silverlight or WPF XAML/code to a Windows Store app.Comment or stub out any code that you cannot easily update until your project builds.Update or replace the commented-out code one issue at a time until your port is complete
Before you port your code, refactor it to make it as reusable as possible. In particular, you can avoid issues with UI API differences by applying design patterns such as Model-View-ViewModel (MVVM), which separate your UI logic from your business logic. With MVVM, your model and view model code will be largely unchanged on different platforms, while your view code (your XAML) will be customized for the platform.Share reusable code files between projects instead of maintaining multiple copies targeting different platforms. To do this in Visual Studio, right-click the project in Solution Explorer, select Add Existing Item, select the files to share, and then click Add As Link.If you want to include some platform-specific code in your shared files, use conditional compilation. This works only with C#, C++, and Visual Basic code. For XAML, you must maintain separate code files.Create cross-platform library assemblies using the Portable Class Library. The portable class library includes the subset of .NET APIs that are available in the .NET Framework for Silverlight, the .NET APIs for Windows Store apps, and the full .NET Framework. Portable class library assemblies are binary compatible with all three platforms, and therefore represent the easiest way to reuse code. However, to create projects that target the portable class library, you must use Microsoft Visual Studio Professional 2012 or better.
Most of the layout types from Silverlight, such as Canvas, Grid, and StackPanel, are also present in the Windows Runtime XAML namespaces. Migrating a basic user interface structure should be straightforward, although you should adjust your Grid and layout settings to accommodate multiple resolutions greater than 800x480.Of course, your phone UI is likely designed specifically for the small screen size of the phone, and simply scaling it up is not necessarily the best design. Instead, you should re-imagine your UI for the capabilities of Windows Store apps and the different form factors of Windows 8 devices. Of course, one of these capabilities is the snapped view, for which your phone UI design might be useful.
The XAML controls in the Windows Runtime are based on the Silverlight controls, but may have different or missing functionality. For example: The Windows Runtime does not include the Pivot and Panorama controls available in Silverlight for Windows Phone. These controls are designed for the phone form factor, and help users navigate experiences that are larger than the phone screen. Your Windows Store apps will usually have more screen space, and should take advantage of the greater flexibility of the Grid control. You can also use the FlipView control to provide a simple paging experience.The AppBar control in the Windows Runtime provides a similar experience to the phone ApplicationBar, but is significantly more flexible, supporting custom layouts and data binding. Windows Phone apps can declare which device orientations they support, and can thereby restrict the layout flexibility required. For Windows Store apps, you should design your UI to look great regardless of device orientation and screen size. For more info, see Plan for different form factors.For more info on controls, see Controls by function.Tiles and notificationsTiles for Windows Store apps have behaviors similar to Live Tiles for Windows Phone 7, although there are some differences. For more details on the use of tiles in a Windows Store app using C++, C#, or Visual Basic, read Creating tiles.Notifications are an extension of the push notification model in Windows Phone 7. For more details on the use of notifications in a Windows Store apps, read Sending toast notifications.For info and tutorials on using tiles, toast, and notifications in a Windows Store app using C++, C#, or Visual Basic, read Working with tiles, badges, and toast notifications. Data scenariosWindows Store apps do not currently include built-in support for data-intensive scenarios such as line of business (LOB) scenarios. For example, there are no APIs for client-side SQL and no local database. However, you can still retrieve data from the network by using custom services and OData calls, shape and format the data by using client-side LINQ, and bind to it by using XAML-based controls. Data binding is mostly unchanged. For example, you can implement INotifyPropertyChanged and INotifyCollection to receive change notifications and update your UI accordingly. However, the data-related features of Windows Store apps currently have the following limitations:There is no built-in support for data-entry validation and the IDataErrorInfo and INotifyDataErrorInfo interfaces.The Binding class does not include the extended formatting properties available in Silverlight. However, you can still implement IValueConverter to provide custom formatting.The IValueConverter methods take language strings as parameters instead of CultureInfo objects. The CollectionViewSource class does not provide built-in support for sorting and filtering, and grouping works differently. For more info, see Data binding with XAML and the Data binding sample.NavigationSilverlight for Windows Phone apps require a page-based navigation structure in order to integrate with the platform and make use of the hardware Back button. There is a similar navigation framework available for Windows Store apps, but because of the different platform requirements, there are a few differences:When you navigate to a page in a Windows Store app, you do not use a URI addressing scheme. Instead, you specify the type of the target page as indicated in the x:Class attribute of the page's XAML definition. You can optionally pass a parameter object as well. The navigation framework for Windows Store apps does not include support for fragment navigation, journal (back stack) modification, or URI mapping.
MigrandoAplicações O que considerer ao Migrar uma App WP para W8
Apresentação • Aline Firmino Brito • Analista de Sistemas • Formada pela FATEC e pelo IFSP