windows 7 – a developer’s guide to building killer windows 7 applications bijoy singhal │...
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
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
Windows 7 Developer OverViewLots of new features for development
Aero, Taskbar & Desktop LibrariesSensorsMulti-TouchDirectX including DirectWrite and Direct2DApp Restart & RecoveryAnd much, much more…
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
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
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
“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
!
DemoAero PeekAero SnapAero ShakeTaskbar PositioningMouse Hot Tracking Free
!
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
DemoMaking a WinForm Glassy
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”;
DemoApplication ID TaskBar Button Grouping
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");
DemoOverlay Icons
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);
DemoTaskbar Progress
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);
DemoThumbnail Toolbars
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);
DemoThumbnail Customizing with Clipping
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
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();
DemoJump ListsTasksCategoriesDestinationsKnown Types Recent Frequent Pinned
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);
DemoWorking with Sensors
WACP Sample – AccelerometerWACP Sample - AmbientLight
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
© 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.