windows 7 – a developer’s guide to building killer windows 7 applications bijoy singhal │...

28
Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal Developer Evangelist, Microsoft India

Upload: moris-higgins

Post on 17-Jan-2018

235 views

Category:

Documents


0 download

DESCRIPTION

Windows 7 Developer OverView Lots of new features for development Aero, Taskbar & Desktop Libraries Sensors Multi-Touch DirectX including DirectWrite and Direct2D App Restart & Recovery And much, much more…

TRANSCRIPT

Page 1: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications

Bijoy Singhal │ Developer Evangelist, Microsoft India

Page 2: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

AgendaWindows 7 Developer OverviewIntroducing the Windows API Code PackA Lap around Windows 7 “goodness”Easy ways to “light up” your application

Taskbar buttonsThumbnail toolbarsOverlays and ProgressCustom ThumbnailsJumpLists

Other Light Up scenarios

Page 3: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Windows 7 Developer OverViewLots of new features for development

Aero, Taskbar & Desktop LibrariesSensorsMulti-TouchDirectX including DirectWrite and Direct2DApp Restart & RecoveryAnd much, much more…

Page 4: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

The Windows API Code Pack for .NET

• Windows Platform SDK – for native code• Windows API Code Pack – for managed code– Gives access to most of the features in Win7– Full source code available– Current version: 1.1– All features degrade gracefully on older Windows– Tons of samples in the package– Get it @ http://code.msdn.microsoft.com/WindowsAPICodePack

Page 5: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Windows API Code Pack Structure• Consists of a number of projects for different items– Core: Consists of core services like network, power, app

recovery service, property system etc.– Shell: Works with the UI – aero, taskbar, controls,

common dialogs and more…– DirectX: allows .NET apps to use D2D, D3D & DW– Sensors: to use light, motion and position

• Lighting up apps is very easy with Core & Shell

Page 6: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Windows 7 UI Design Goals

• Clean, noise-free & simple• Single launch surface for most used apps and

files• Get to information faster without needing to

“switch” to application• User has control on apps, desktop, icons

Page 7: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

“Light Up” Features for Free!

• Apps running on Win7 get some light up features for free– Aero Peek– Aero Snap– Aero Shake– Taskbar Fixed Positioning– Mouse Hot Tracking Free

!

Page 8: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoAero PeekAero SnapAero ShakeTaskbar PositioningMouse Hot Tracking Free

!

Page 9: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Light Up Feature I: Aero Glass

• Add Aero Glass forms to your app• Detect availability of Aero• Option to turn off Aero as well

• WACP Code public partial class Form1 : GlassForm

Page 10: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoMaking a WinForm Glassy

Page 11: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Light Up Feature II: Application ID• Configures application taskbar button grouping• Default is program name• Scenarios to customize– Single app, multiple icon– Multiple apps, single icon

• WACP CodeTaskbarManager Taskbar = TaskbarManager.Instance;Taskbar.ApplicationId = “MyAppName”;

Page 12: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoApplication ID TaskBar Button Grouping

Page 13: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Light Up Feature III: Overlay Icons

• Add icon overlay to application icon• Use to display “state” of application• Makes icon the place to view

• WACP Code

TaskbarManager Taskbar = TaskbarManager.Instance;Taskbar.SetOverlayIcon(SystemIcons.Asterisk, “My Status");

Page 14: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoOverlay Icons

Page 15: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Light Up Feature IV: Taskbar Progress

• Show progress bars in application icon• Multiple progress states to show running

status• Can only show one progress bar at a time

• WACP Code

TaskbarManager Taskbar = TaskbarManager.Instance;Taskbar.SetProgressState(TaskbarProgressBarState.Normal);Taskbar.SetProgressValue(CurrentValue, MaximumValue);

Page 16: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoTaskbar Progress

Page 17: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Light Up Feature V: Thumbnail Toolbars

• Allow interacting with application from thumbnail

• Add up to 7 buttons in thumbnail• Cannot remove buttons, but can hide

• WACP Code

ThumbnailToolbarButton btn = new ThumbnailToolbarButton(Icon, “Tooltip”);

btn.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(btn_Click);

Taskbar.ThumbnailToolbars.AddButtons(this.Handle, btn);

Page 18: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoThumbnail Toolbars

Page 19: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Light Up Feature VI: Thumbnails Clipping

• Sometimes the default thumbnail is not good enough

• Display the most important part of the window

• Can reset back to full window

• WACP Code

Taskbar.TabbedThumbnail.SetThumbnailClip(WindowHandle, Rectangle);

Page 20: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoThumbnail Customizing with Clipping

Page 21: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Light Up Feature VII: Jump Lists• Mini Start menu for each application• Consists of:– Categories– Tasks– Destinations– Recent, Frequent & Pinned items

• Registered extensions are automatically handled• WACP Code – next slide

Page 22: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Jump Lists WACP Code// Declare and instantiateJumpList jl;jl = JumpList.CreateJumpList();// Show from Recent, Frequent or None. (Pinned is auto)jl.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;// Add taskjl.AddUserTasks(new JumpListLink(Path), “My Task"){Icon}jl.AddUserTasks(new JumpListSeparator());// Add categoryJumpListCustomCategory c1 = new JumpListCustomCategory("Documents");jl.AddCustomCategories(c1);// Add Destinationc1.AddJumpListItems(new JumpListItem(PathToFile));// Refreshjl.Refresh();

Page 23: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoJump ListsTasksCategoriesDestinationsKnown Types Recent Frequent Pinned

Page 24: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Light Up Feature VIII: Sensors

• Many different types of sensors in Windows 7– Light– Accelerometer– Location

• WACP Code (sample)

SensorList<SensorType> sl = SensorManager.GetSensorsByTypeId<SensorType>( );

SensorManager.SensorsChanged += new SensorsChangedEventHandler(S_Changed);

Page 25: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

DemoWorking with Sensors

WACP Sample – AccelerometerWACP Sample - AmbientLight

Page 26: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

Summary• Windows 7 is a developer’s delight• Tons of new stuff that you can add to your apps• The Windows API Code Pack lets you get these

features in .NET apps very easily• The easiest way to get your app to light up on

Windows 7 is to use the Taskbar and UI features

Page 28: Windows 7 – A developer’s Guide to Building Killer Windows 7 Applications Bijoy Singhal │ Developer Evangelist, Microsoft India

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED

OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.