Updating Your Desktop Apps for Windows 8

Embed Size (px)

Citation preview

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    1/12

    Updating Your Desktop Application for Windows*8

    By Bill Sempf

    Windows* Store apps in the Microsoft design style are all the rage right now, but many of us have

    existing Desktop applications that are going to stay Desktop applications. From network access to

    user interface (UI) considerations, there are a host of reasons to update a Desktop application to

    extend its useful life while you explore your options with the Windows Store. But how to keep the

    application looking and acting up to date in the new modern application world? Fortunately, a

    host of new, useful features will help to make Windows 7 apps more at home on Windows 8,

    including touch application programming interfaces (APIs) and new storage features. This article

    provides some straightforward recommendations for updating your Desktop app for Windows 8,no matter if it is running on an actual desktop, an Ultrabook device, or a tablet.

    Embrace Touch

    One of the most visible changes in Windows 8 from the application developers point of view is the

    inclusion oftouch. Windows Store apps are largely touch driven, and the same can be true of

    Desktop apps.

    Working in Windows 8 on contemporary hardware is an interesting transition, as a touch-enabled

    laptop changes the way users work with the machine. Getting to the charms bar has a keyboard

    shortcut (Windows+C), for example, but very quickly, one becomes used to reaching up and

    swiping from the right edge of the screen with a quick flip of the thumb.

    Desktop applications can embrace touch, as well. The best current example of this is Microsoft

    Office 2013, which has a Touch/Mouse Mode button at the top of the quick access toolbar. The

    usual Ribbon in Microsoft Office in Figure 1 is much better suited to a mouse.

    Figure 1.The Mouse Ribbon in Microsoft Office 2013

    With a change to Touch mode, the space between iconsand even the style of iconschanges

    dramatically. You can see that change in Figure 2.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    2/12

    2 Updating Your Desktop Application for Windows 8

    4 March 2013

    Figure 2.The Touch Ribbon in Microsoft Office 2013

    The difference is in the size guidelines. Microsoft recommends that to support touch interaction,

    touch points should be at least 50 pixels wide and high, with an 10-pixel gutter between targets.

    This guideline supports the majority of users in the majority of situations. So handling touch in an

    application is really a matter of managing the size of your targets, at least in Touch mode, like

    Microsoft Office has done.

    Consider the Microsoft Design Style

    Microsoft has developed a unique design style for Windows Store apps. In fact, the change in user

    interaction with Windows Store apps is arguably the largest single change in the new model.

    Applications that dont use the style guidelines are rejected from the Windows Store.

    A Desktop app isnt expected to follow the Microsoft design style. Even if it is going into the

    Windows Store for marketing, there is no declaration that you have to use the new design style. In

    fact some of the design guidelines are pretty difficult to implement in a Desktop app.

    That said, some tenants of the Microsoft design style make sense for a Desktop app. Revisiting the

    app layout and information architecture is worth considering. Reducing chrome and unnecessary

    UI elements is another good idea.

    Clear Up Your Information Hierarchy

    Using typography to clearly show users the information hierarchy is a good idea no matter

    whether you are working in a Windows Store app, a Desktop app, or a website. Microsoft design

    style defines a typographic ramp to clearly define for the user what the most important thing on

    any given page is. The typographic ramp is shown in Figure 3.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    3/12

    Updating Your Desktop App for Windows 8 3

    4 March 2013

    Figure 3.The typographic ramp

    While doing this, consider your ontology. Information architecture is key in application design,

    and using the typographic ramp makes you consider on what tier each piece of information in

    your application sits.

    Reduce Chrome

    Increasing space between buttons often means reducing the number of buttons used in the

    interface. To really embrace touch, developers need to reduce the number of options in front ofthe user at any one time.

    Desktop applications have too many buttons, anyway. Look at GIMP, in Figure 4.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    4/12

    4 Updating Your Desktop Application for Windows 8

    4 March 2013

    Figure 4. Gimp and its buttons

    Alternatively, look at Trimble SketchUp*, a Windows Store app, shown in Figure 5. Although it is

    unlikely that a desktop app could go to that level, considering streamlining of the UI is a good step

    toward a more Windows design style experience.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    5/12

    Updating Your Desktop App for Windows 8 5

    4 March 2013

    Figure 5. Trimble SketchUp*

    Open Up Your Layout

    As discussed, making more space between your elements can make the whole app look better,

    take advantage of higher-resolution screens, and make touch-enabled screens a benefit to your

    users. The application cannot depend on touch because the mouse and keyboard are still in use

    and will be for a while. However, if you take touch into consideration while slimming up your

    information architecture and reducing unnecessary UI elements, youll find that your interface has

    a lot more space to play, and your users will be happier.

    Head to the CloudsModern applications are connected. They use information from a variety of sources and are

    available anywhere, anytime, on any device. Cloud computing is information provided as a utility.

    Thats different from a hosted web application. Using service-based information access is the core

    of the modern application.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    6/12

    6 Updating Your Desktop Application for Windows 8

    4 March 2013

    Modern Applications

    A modern application is one that uses cloud services to maintain the data and state of anapplication across devices. The promise is that no matter whether users are using a PC, a laptop, a

    tablet, or a phone, all of the data for the application remains in sync.

    The modern application name was coined for tablet applications (especially Windows 8 Store

    apps), but the same term can apply to an existing desktop app. Storage can be maintained in a

    central system, and business logic can be moved to an online middleware system.

    Use Windows Azure

    Windows Azure* storage is a great place to keep your stuff. You have three options for keeping

    data in Azure. SQL Database is exactly what it sounds like: a Microsoft SQL Server* database in thesky. Azure Tables are a NoSQL-style solution to storage. Just make a put call with data, and its

    there. Blob storage is the simplest of the three: It just stores big blocks of stuff and doesnt care

    what it is.

    SQL Database provides the kind of enterprise data management that corporate developers are

    used to. All of the transaction processing, schema management, and pinpoint control come with

    the massive scaling that accompanies the use of a cloud-hosted solution. In addition,

    SQL Federation provides easy movement of data between corporate SQL Server installations and

    the cloud-based SQL Database.

    Azure Tables are unstructured blocks of data broken into three types: accounts, tables, and

    entities. The accountrepresents an application. The table represents a logical grouping of data. Anentityrepresents . . . well, anything. The application determines what goes in an entity. Figure 6

    shows an example.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    7/12

    Updating Your Desktop App for Windows 8 7

    4 March 2013

    Storage Account Table Entity

    Bill

    Tasks

    Events

    Date=

    Time=

    Place= ...

    Task =

    Complete = ...

    Task=

    Date Due = ...

    Figure 6.Azure Tables architecture

    Tables can be a fantastic simple storage system for an application that just needs to keep some

    data in the cloud.

    Move Business Logic to Services

    Another option toward making a desktop application more modern is simply moving business

    logic that cant be easily built in a cross-platform way with JavaScript* to the cloud. Windows

    Azure is helpful for that, but there isnt much of a platform for templating the services. Developers

    are a bit more on their own, but the benefit is that the logic doesnt have to be written over and

    over for other platforms.

    Manage the Life Cycle

    Windows 8 allows for a new level of interaction between low-level operating system operations

    and desktop applications. Windows Store apps are totally managed by the operating system,

    which is not appropriate for a Desktop app. However, some level of interaction between the

    operating system and the application gives the user an experience of having things taken care of,

    and that is what were shooting for.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    8/12

    8 Updating Your Desktop Application for Windows 8

    4 March 2013

    Access Logging

    Knowing when a user logs in can be a real boon for security and user experience alike, especiallywhen you just want to let the user know that you are paying attention. That information is

    available to Desktop applications through User Access Logging in Windows 8.

    Saving user access to a server is available in ual.h in the Windows software development kit

    (SDK). The application will need to store information about the IP address that is accessing the

    application in a data blob, and then pass it to the UalInstrument function, as the following code

    snippet shows:

    UAL_DATA_BLOB ualDataBlob;ZeroMemory(&ualDataBlob, sizeof(UAL_DATA_BLOB));ualDataBlob.Size = sizeof(UAL_DATA_BLOB);

    ualDataBlob.RoleGuid = RoleIdentifier;ualDataBlob.TenantId = TenantIdentifier;

    UalRegisterProduct(L"MyProduct", L"UserRole", L"{3D1A8E20-AD01-457B-B044-79113F30C54C}");

    if (S_OK == UalStart(&ualDataBlob)){

    ualDataBlob.Address.ss_family = AF_INET;InetPton(AF_INET, ip_number, &(reinterpret_cast(&ualDataBlob.Address)-

    >sin_addr));UalInstrument(&ualDataBlob);

    }

    The application can then use Windows Management Instrumentation to get information from the

    event log about user access at the server level and use it in the UI. For instance, Google Mailinforms the user about access from other IP addresses right on the main mail page. This kind of

    information is good for both reference and security.

    Machine State Management

    To a user, the machine appears to be on or off. Really, though, machines can be in any number of

    other states, and that number grew a lot in Windows 8. A Desktop application can use that

    information to its advantage when deciding how to manage its own state by checking

    SYSTEM_POWER_STATE . Some of the states a machine can be in are shown in Table 1.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    9/12

    Updating Your Desktop App for Windows 8 9

    4 March 2013

    Table 1. Machine states available in Windows 8

    Machine State User view Power usage

    S0 Working Fully on, everything working

    S1 Sleep Appears off but quickly resumable

    S2 Appears off and monitor off

    S3 Appears off and hard drive stilled

    S4 Hibernation Memory saved to hard drive

    S5 Soft off Only resumable by LAN or power

    G3 Mechanical off Power off to all components

    In Windows 8, hybrid shutdown (S4) stops user sessions, but the contents of kernel sessions are

    written to hard disk. This enables faster startup. You can use that fact to your advantage when

    checking power state on launch in Microsoft .NET and C++, although in JavaScript, that

    information isnt yet available.

    Got Games?

    In the world of gaming, most of the improvements available in the Windows Store for Windows 8

    are also available to Desktop apps. For example, Microsoft XAudio2 is a new set of sound APIsavailable as part of the Windows 8 SDK.

    Games that are using Microsoft DirectSound* on the Windows Desktop platform should certainly

    look at XAudio2. XAudio2 now supports per-voice filtering and digital signal processing effects as

    well as submixing with voices. New audio formats are supported, and runtime decompression of

    compressed audio is finally available. This brings the Windows game sound up to par with the

    awesome video control in Microsoft DirectX*. Also, the XAudio2 APIs will not block the audio

    processing enginea critical feature for the development of crash-free desktop games.

    Microsoft XInput lets an application take input from the Xbox* controller from Windows. Using an

    Xbox controller in a Windows game takes user interaction to a whole new level. XInput has beenenabling Xbox controllers for Windows since Windows XP and has a new 1.4 version for

    Windows 8. The new version supports upcoming features of the controllerforce feedback,

    wireless, voice, plug-in devices, and navigation buttons. You can find XInput 1.4 in the Windows 8

    SDK.

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    10/12

    10 Updating Your Desktop Application for Windows 8

    4 March 2013

    Use Sensors

    Although sensors are more a mobile development feature, desktop apps run on Ultrabook andtablet devices, too. Desktop-style apps likely can be improved with some integration with the

    sensor array in an Ultrabook device, laptop, or tablet.

    Windows uses physical sensors to provide some logical sensor objects for application use. These

    logical objects include:

    Light sensor. How much light is in the users environment Global positioning system. Uses the Global Positioning Satellite network Accelerometer. Determines changes in the movement of the device Compass. Magnetic direction changes Orientation. General sensor for figuring out how the user is viewing the device

    Of course, not all sensors are available on all devices, so take care. That said, integration with the

    machine at the sensor level gives the user a much more modern experience.

    Do Data Differently

    Data access is a moving target in modern applications. Windows Store apps cant directly connect

    to most databases and require use of a service layer for most storage options. Big data and huge-

    scale reporting are changing the face of both storage and access. The Windows API is changing a

    bit to support this movement in access options.

    Compression API

    Moving data into and out of applications is time-consuming and expensive. Use of compression

    can mitigate these problems, and the Compression API is the first low-level toolset for

    compression in Windows. It supports:

    MSZIP XPRESS XPRESS_HUFF LZMS

    Storage Management API

    In previous versions of Windows, the Virtual Disk Service supported a subset of storage options. In

    Windows 8, the Storage Management API provides an interface to disks and disk-like units that

    implement a storage management provider. Windows PowerShell* is really the target for the

  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    11/12

    Updating Your Desktop App for Windows 8 11

    4 March 2013

    Storage Management API, but if an application is file-centric and focused on the enterprise, there

    will still be a use for the interface.

    Conclusion

    Existing Desktop apps do have a place in the new Windows 8 ecosystem. With a little updating for

    touch interaction, cloud storage, and new user interaction APIs, existing apps are ready for listing

    in the Windows Store. Get the Windows App Certification Kit today, run your existing Desktop app

    through it, and see what has to change. Then, implement the recommendations above to be ready

    for Windows 8!

    References Designing for Ultrabook Devices and Touch-enabled Desktop Applications:

    http://software.intel.com/en-us/articles/designing-for-ultrabook-devices-and-touch-

    enabled-desktop-applications

    How to use the Table Storage Service:http://www.windowsazure.com/en-us/develop/net/how-to-guides/table-services

    Whats new in Microsoft .NET 4.5:http://msdn.microsoft.com/en-us/library/ms171868.aspx#core

    XAudio2 APIs:http://msdn.microsoft.com/en-us/library/windows/desktop/hh405049(v=vs.85).aspx

    XInput API:http://msdn.microsoft.com/en-us/library/windows/desktop/ee417003(v=vs.85).aspx

    Windows SDK for Windows 8:http://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspx

    Compression API:http://msdn.microsoft.com/en-us/library/windows/desktop/hh437596(v=vs.85).aspx

    Ultrabook and Tablet Windows 8 Sensors Development Guide:http://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-

    development-guide

    http://software.intel.com/en-us/articles/designing-for-ultrabook-devices-and-touch-enabled-desktop-applicationshttp://software.intel.com/en-us/articles/designing-for-ultrabook-devices-and-touch-enabled-desktop-applicationshttp://software.intel.com/en-us/articles/designing-for-ultrabook-devices-and-touch-enabled-desktop-applicationshttp://www.windowsazure.com/en-us/develop/net/how-to-guides/table-serviceshttp://www.windowsazure.com/en-us/develop/net/how-to-guides/table-serviceshttp://www.windowsazure.com/en-us/develop/net/how-to-guides/table-serviceshttp://www.windowsazure.com/en-us/develop/net/how-to-guides/table-serviceshttp://msdn.microsoft.com/en-us/library/ms171868.aspx%23corehttp://msdn.microsoft.com/en-us/library/ms171868.aspx%23corehttp://msdn.microsoft.com/en-us/library/ms171868.aspx%23corehttp://msdn.microsoft.com/en-us/library/ms171868.aspx%23corehttp://msdn.microsoft.com/en-us/library/windows/desktop/hh405049(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh405049(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh405049(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh405049(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/ee417003(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/ee417003(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/ee417003(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/ee417003(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspxhttp://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspxhttp://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspxhttp://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh437596(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh437596(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh437596(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh437596(v=vs.85).aspxhttp://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-development-guidehttp://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-development-guidehttp://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-development-guidehttp://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-development-guidehttp://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-development-guidehttp://msdn.microsoft.com/en-us/library/windows/desktop/hh437596(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh437596(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspxhttp://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/ee417003(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/ee417003(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh405049(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/hh405049(v=vs.85).aspxhttp://msdn.microsoft.com/en-us/library/ms171868.aspx%23corehttp://msdn.microsoft.com/en-us/library/ms171868.aspx%23corehttp://www.windowsazure.com/en-us/develop/net/how-to-guides/table-serviceshttp://www.windowsazure.com/en-us/develop/net/how-to-guides/table-serviceshttp://software.intel.com/en-us/articles/designing-for-ultrabook-devices-and-touch-enabled-desktop-applicationshttp://software.intel.com/en-us/articles/designing-for-ultrabook-devices-and-touch-enabled-desktop-applications
  • 7/30/2019 Updating Your Desktop Apps for Windows 8

    12/12

    12 Updating Your Desktop Application for Windows 8

    4 March 2013

    About the Author

    In 1992, Bill Sempf was working as a systems administrator for The Ohio State University andformalized his career-long association with internetworking. While working for one of the first

    ISPs in Columbus, Ohio, in 1995, he built the second major web-based shopping center, Americash

    Mall, using Adobe ColdFusion* and Oracle. Bills focus started to turn to security around the turn

    of the century. Internet-driven viruses were becoming the norm by this time, and applications

    were susceptible to attack like never before. In 2003, Bill wrote the security and deployment

    chapters of the often-referenced Professional ASP.NET Web Services for Wrox and began his career

    in pen testing and threat modeling with a web services analysis for the State of Ohio. Currently,

    Bill is working as a security-minded software architect specializing in the Microsoft space. He has

    recently designed a global architecture for a telecommunications web portal, modeled threats for

    a global travel provider, and provided identity policy and governance for the State of Ohio. In

    addition, he is actively publishing, with the latest being Windows 8 Application Development withHTML5 for Dummies.Intel, the Intel logo, and Ultrabook 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.