1. Trang chủ
  2. » Công Nghệ Thông Tin

windows vista for developers delivery guide phần 3 doc

21 183 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 21
Dung lượng 1,46 MB

Nội dung

Session 1: Introduction to Windows Vista Application Development 15 Developing Gadgets for the Windows Sidebar Introduction One of the important new features in Windows Vista is the Windows Sidebar and the gadgets that are hosted by the Sidebar. This section introduces these features and describes how to build these features in Windows Vista. Objectives After completing this section, you will be able to: • Describe the Windows Sidebar. • Describe gadgets. • Install and use gadgets. • Explain how gadgets work. • Develop a gadget. • Package a Sidebar gadget. 16 Session 1: Introduction to Windows Vista Application Development What Is the Windows Sidebar? Windows Sidebar is a pane on the side of the Windows Vista desktop that organizes gadgets and makes them easy to access. Windows Sidebar is the perfect complement to widescreen monitors and also works seamlessly on standard displays. You can easily customize Windows Sidebar to suit how you want to interact with it—whether you want it always on top or resting below maximized windows. Why use the Windows Sidebar? The Windows Sidebar is designed to: • Enhance productivity by hosting mini-applications for the desktop and the Web that are optimized for work and home situations. • Be non-intrusive. Windows Sidebar development should follow the Less is more model and provide native support for standard and widescreen displays. • Provide a personalized experience with which each user gets more choice and control. • Experience great developer support. The Windows Sidebar is simple to deploy using the tools provided by Microsoft, and it is secure by design. Session 1: Introduction to Windows Vista Application Development 17 What Are Gadgets? Gadgets are mini applications that perform specific functions, such as displaying a clock face, converting international currencies, displaying CPU performance, or games. A gadget is a lightweight and task-specific application that appears in the Windows Sidebar. By default the Sidebar displays the Slideshow, the Clock and the RSS Feed Watcher to new users. There are three types of gadgets. • Information gadgets • Application gadgets • Utility gadgets 18 Session 1: Introduction to Windows Vista Application Development Why use gadgets? Gadgets are designed to: • Fill the need for lightweight applications. Gadgets are designed to fit in the gap between complete applications and icons in the notification area. A Windows Sidebar gadget can provide information and functionality at your fingertips in the form of a lightweight application hosted in the Sidebar. The developer can build a Sidebar gadget that integrates with a full-blown application to expose some data from the application. • Alleviate information overload. People are barraged with information, and launching full applications or a browser is often more than is required. People want easy-to- view and relevant information at their fingertips. • Take advantage of the increase in screen sizes. Many computers now use 16 x 9 displays and multi-monitor configurations. Gadgets extend the Windows shell to take advantage of the new hardware configurations. Session 1: Introduction to Windows Vista Application Development 19 Installing and Using Gadgets Supported platforms for gadgets Gadgets can run in several different platforms: • Gadgets for Windows Sidebar will run on your desktop or dock into Windows Sidebar. • Gadgets for the Web (Live.com) provide a fast, customizable home page with a clean user interface—putting the users in control of more of their online experience. These gadgets can easily support docking into the Windows Sidebar. • Gadgets for Windows SideShow allow users to view information on devices that are attached to the computer. Gadgets for Windows SideShow run on the PC and use COM interfaces to send data to devices. Installing gadgets All gadgets for Windows Sidebar reside on a user’s computer. The gadgets may be acquired when a user downloads them from a Web site, when someone e-mails one, or when an application installs one. When a user encounters a .gadget file, that user can double-click to install the gadget, starting a process that informs the user about any risks associated with gadgets and extracts the files for use by the Sidebar. The gadget file remains available for the user to archive or delete. 20 Session 1: Introduction to Windows Vista Application Development Running multiple instances of gadgets Each gadget can be started multiple times. For example, users could use a gadget to have many different clocks for various time zones or slideshow viewers of different picture collections. This is possible because the gadget platform provides methods for developers to store settings and associates settings with the correct instance of each gadget automatically. The gadgets also run automatically and with the same settings when the users log out or restart their computer. User interaction with gadgets Each gadget can respond to user interaction. Users may click within the gadget buttons, images, or text or move the gadget around the screen. Developers can respond to both of these events through script by changing the gadget’s appearance as necessary. Session 1: Introduction to Windows Vista Application Development 21 How Gadgets Work Each gadget is developed using HTML and any Internet-capable scripting language such as JavaScript or VBScript. A gadget also has access to extra information about itself and Windows when the HTML is run as a gadget. This allows a gadget to interact with Windows files and folders so that it can show images from the users’ Pictures folder or display information about a wireless connection. Gadgets can also display a settings dialog box and store those settings by using script. You can create very complex and rich gadgets by using only script and without using other binary objects. To create a gadget, you need a minimum of two items: an HTML file and a manifest file, which must be named gadget.xml. The HTML file that makes up the gadget itself is actually the same as any Web page that uses dynamic HTML. The manifest file is an XML-formatted file that contains the configuration information for a gadget. 22 Session 1: Introduction to Windows Vista Application Development The following table lists the tags that should be used in the gadget.xml file. Tag Description <name> Name of the gadget as it appears in the Gadget picker dialog box <author> Name of the person who wrote the gadget <copyright> Copyright information, including name of the copyright holder and copyright date <description> Brief description of the gadget and what it does <icon> Name of the icon file <code> Name of the HTML file that is core part of the gadget <website> Web site associated with the gadget When you click a particular gadget, the author, copyright, description tags, and icon all appear. Session 1: Introduction to Windows Vista Application Development 23 Developing a Gadget Process for creating a gadget Creating a gadget is a process that should be familiar to any Web page author: 1. Create a directory to contain the gadget files. 2. Create an HTML page that does something interesting. 3. Create the XML file for the gadget manifest. 4. Test the newly created gadget from the Sidebar. 5. Close the gadget to make changes as necessary. 6. Open the gadget again in the Sidebar to view changes. You can use DHTML and XML to develop gadgets written with Microsoft Visual Web Developer™ Express 2005. Visual Web Developer Express 2005 can be downloaded from the Microsoft MSDN download site. 24 Session 1: Introduction to Windows Vista Application Development Gadget Object Model Windows Sidebar and gadgets use the following object model which is exposed to the scripting environment. • Exposed Sidebar events • Dock and Undock events. These events are triggered when the gadget is being docked or undocked. The specified script code runs when the event occurs. • Settings events. Show, Closed, and Closing events are triggered by the settings dialog event and specify the script code that should be executed. • Exposed system functionality. A Sidebar gadget developer needs to use only DHTML to access the public interfaces through available methods to provide control over the gadget. The following table is just a sample of the exposed functionality. Object Explanation System.Debug Exposes a method that allows for debugging functionality of a running Sidebar gadget by outputting strings containing debugging information to a physical or virtual debugging terminal. System.Diagnostics Exposes a method that allows for extra gadget execution information by allowing entries to be written to an event log for the gadget session. System.Environment Used to derive environment information regarding the user’s current session in which Sidebar is running. System.Gadget Defines methods, events, and properties that are used to identify and specify gadget configuration options within the Sidebar environment. System.Gadget.Settings This object and its methods are used to see if there are stored settings for the gadget, such as when settings are saved from an earlier session of a particular gadget instance. For more information see the Windows Sidebar Reference page on the Microsoft MSDN Web site. [...]... Standard User Analyzer 29 30 Session 1: Introduction to Windows Vista Application Development Testing Applications for Vista Compatibility To test and determine if an application is compatible with Windows Vista, complete these steps: 1 Install Windows Vista on a test machine If you are upgrading the operating system from Windows XP, first verify all application functionality in Windows XP 2 Install the... Problem area Description Remedies Operating system versioning Any application that specifically checks for the OS version will get a higher version number For applications and installers that check for the OS version, a Compatibility mode is provided in Windows Vista The internal version number for Windows Vista is 6 Application installers may not be able to install the application, and applications may... prompts Windows Vista 64-bit Applications or components that use 16-bit executables, 16-bit installers, or 32 -bit kernel drivers will either fail to start or will function improperly on a 64-bit edition of Windows Vista All 16-bit components should be removed from applications and replaced with 32 -bit or 64-bit equivalents All 16-bit installers should be converted to 32 -bit or 64-bit installers All 32 -bit... converted to 32 -bit or 64-bit installers All 32 -bit kernel drivers should be converted to 64-bit drivers For a more complete resource, refer to The Windows Vista Developer Story: Application Compatibility Cookbook page located on the Microsoft MSDN Web site 33 34 Session 1: Introduction to Windows Vista Application Development What Is the Microsoft Application Compatibility Toolkit? The Microsoft Application... Microsoft Virtual Server 2005 to test applications and host legacy applications that do not work on Vista 32 Session 1: Introduction to Windows Vista Application Development Known Application Incompatibility Issues The following table provides an overview of the known application incompatibility issues in Windows Vista and provides a brief description and some remedial techniques that can be applied Problem... that an organization may need to deal with as it prepares to deploy Windows Vista is testing the existing applications to ensure that they will run correctly on Windows Vista Microsoft provides several tools to ease this process Objectives After completing this section, you will be able to: • Describe how to test applications for Vista compatibility • Describe the different known application incompatibility... image (icon) for the Gadget picker Session 1: Introduction to Windows Vista Application Development 27 Gadget Deployment Package You can deploy gadgets via two primary file formats: • A Zip file In this package type, the gadget files are collected and compressed into a single file Many tools, including Windows itself, can create, extract, and edit Zip files • A cab file A cab file, or Windows Cabinet... that would typically be used to test the application on Windows XP Session 1: Introduction to Windows Vista Application Development 31 If the application does not install or launch successfully, or if it crashes, encounters an error, or fails major functionality tests, it may be one of the small set of applications that are impacted by Windows Vista changes As a best practice, consider using virtual... to Windows Vista Application Development • 35 Application programming interfaces for independent software vendors (ISVs) This provides extensibility and a set of APIs for ISVs and non-Microsoft applications through a software development kit (SDK) This also includes a Web service that can be used to get the latest compatibility data Microsoft Application Compatibility Toolkit version 5.0 supports Windows. .. 1: Introduction to Windows Vista Application Development 25 Demonstration 3: Developing a Gadget In this demonstration, you will see how to create a simple gadget and modify its settings Key Points The key points of this demonstration are that: • Gadgets are fairly easy to develop • You can modify gadget settings to display custom properties 26 Session 1: Introduction to Windows Vista Application Development . Introduction to Windows Vista Application Development 15 Developing Gadgets for the Windows Sidebar Introduction One of the important new features in Windows Vista is the Windows Sidebar. Supported platforms for gadgets Gadgets can run in several different platforms: • Gadgets for Windows Sidebar will run on your desktop or dock into Windows Sidebar. • Gadgets for the Web (Live.com). can easily support docking into the Windows Sidebar. • Gadgets for Windows SideShow allow users to view information on devices that are attached to the computer. Gadgets for Windows SideShow

Ngày đăng: 14/08/2014, 02:22

TỪ KHÓA LIÊN QUAN