Windows Sidebar & Gadgets

Windows Sidebar & Gadgets

Vvoj Windows Sidebar Gadgets Jaroslav Klma, MFF UK 12.4.2007 Vvoj Windows Sidebar Gadgets

Co jsou to Microsoft Gadgets? Sidebar gadget overview Nstroje pro vvoj Hello World Lokalizace

Manifest Windows Sidebar API Instalace COM interop Co jsou to Microsoft Gadgets? Jednoduch jednoelov miniaplikace Na desktopu, na webu, na jinm zazen V budoucnu: Univerzln gadgety

Nyn: Windows SideShow gadgets Web gadgets Windows Sidebar gadgets Device gadgets Windows SideShow (pdavn display na telefonu, na dlkovm ovldn a podobn)

Web gadgets nkdy t Live Gadgets Windows Live Spaces Live.com Desktop gadgets Windows Sidebar Sidebar gadget - pehled Postrann panel Umstn vlevo/vpravo, na konkrtn monitor Matouc On top of other windows

Galerie gadget Inteligentn umstn gadget Instalace gadget Distribuce ve form souboru *.gadget Jde o *.zip nebo *.cab archiv s novou koncovkou Po double kliknut se automaticky nainstaluje Umstn soubor gadgetu C:\Program Files\Windows Sidebar\Gadgets\ nebo

C:\Users\{profile}\AppData\Local\Microsoft\Windows Sidebar\Gadgets\ Pidn gadgetu do postrannho panelu Galerie gadget Systmov i uivatelsk gadgety Preview image Detaily vrobce Double-click / drag & drop Stavy gadgetu Docked/undocked

V postrannm panelu, nebo voln Flyout Po kliknut me gadget expandovat Settings Panel nastaven gadgetu Vce instanc Kad m vlastn nastaven

Gadget z pohledu programtora DHTML soubor se styly a manifestem Obsah v HTML Skripty v JavaScriptu nebo VBscriptu Styly CSS Popis gadgetu v manifestu gadget.xml Jmno, verze, autor, popis HTML soubor s obsahem gadgetu Nstroje pro vvoj

Notepad, PSPad... Microsoft Visual Studio + IE Syntax highlighting IntelliSense (*) Validace (*) Debugging (*) Hello world! Manifest Jmno Verze

Jmno souboru s obsahem Platorma Obsah HTML soubor Lokalizace Jazyk podle jazykovho balku OS :-/ Podadrese v koenovm adresi Vechny soubory s relativn cestou se hledaj v poad:

1) \cs-CZ\path\file.ext 2) \cs\path\file.ext 3) \en-US\path\file.ext 4) \en\path\file.ext 5) \path\file.ext Manifest Povinn elementy Kdovn souboru a verze XML - Jmno gadgetu - Verze gadgetu

- Hostitelsk aplikace - Jmno a verze - Typ a umstn souboru s obsahem - Poadovan oprvnn Nepovinn elementy: daje o autorovi, www, logo

Copyright Popis gadgetu Ikony Nhled (48x48)

Obsah gadgetu Pouvme HTML, CSS a JavaScript Na renderovn se pouije Internet Explorer Rozdly proti web strnce: Gadget API Nefunkn alert() Debugging debugger;

Gadget je interaktivn Vznikaj udlosti - events Specifikujeme skripty kter se pust pi vzniku udlost, napklad:

Windows Sidebar API System.Debug Metoda outputString(string) System.Diagnostics Metoda EventLog.writeEntry(string [, type]) type 0 = Success 1 = Error 2 = Warning

3 = Information System.Environment Metoda getEnvironmentVariable(varName) System.Machine Properties: availableMemory, processorArchitecture, totalMemory Kolekce CPUs informace o procesorech

jde o kolekci, nikoliv o pole pouvme .item(i) namsto indexeru vlastnosti name a usagePercentage PowerStatus.* properties batteryCapacityRemaining batteryCapacityTotal batteryPercentRemaining batteryStatus enumBatteryStatus isBatteryCharging isPowerLineConnected

Udlost PowerStatus.powerLineStatusChanged System.Network.Wireless Properties: address ipv6Address primaryDNSAddress secureConnection signalStrength ssid

Events: connectionChanged signalStrengthChanged System.Shell Metody: chooseFile(), chooseFolder() - vrac System.Shell.Item drive(driveLetter) - vrac System.ShellDrive execute(...) - jako ShellExecute z Win API itemFromPath(path) vrac System.Shell.Item knownFolder(path) vrac System.Shell.Folder

knownFolderPath(name) vrac System.Shell.Folder refreshDesktop() znovu nate ikony na desktop saveFileDialog(...) vrac string, vybranou cestu System.Shell metoda itemFromFileDrop() podpora Drag & Drop: function fileDragDropped(event) {

var sFile; var i=0; try { while(System.Shell.itemFromFileDrop(event.dataTransfer, i).path) { sFile = System.Shell.itemFromFileDrop(event.dataTransfer, i).path; i++; } } catch(err) {}

} System.Shell.Folder metody: copyHere() moveHere() newFolder() parse(path) properties: Self vrac System.Shell.Folder

Parent vrac string s cestou System.Shell.Item metody: invokeVerb(verb) open, edit... metadata() nap. pro obrzky rozmry, dpi... properties: isFile

isFileSystem isFolder isLink link modifyDate name path SHFolder size type

Ostatn objekty Windows Sidebar API: System.ContactManager System.MessageStore System.Shell.RecycleBin event i metody System.Sound beep() a playSound() System.Time getLocalTime(), timeZones System.Gadget... Gadget API System.Gadget udlosti: onDock, onUndock

onShowSettings, onSettingsClosing, onSettingsClosed visibilityChanged metody: beginTransition() endTransition(transitionType, seconds) transitionType = System.Gadget.TransitionType.morph System.Gadget.TransitionType.none close()

properties: background cesta k obrzku s pozadm docked - dock state (true nebo false) name jmno gadgetu z manifestu opacity prhlednost v procentech path cesta k HTML s obsahem gadgetu platformVersion - verze OS settingsUI cesta k HTML nastaven gadgetu version verze gadgetu z manifestu visible viditelnost gadgetu (true nebo false)

System.Gadget.Sidebar udlost onDockSideChanged property dockSide System.Gadget.Flyout udlosti onHide a onShow properties: file cesta k HTML s obsahem flyoutu document vrac objekt HTML document show indikuje jestli je flyout zobrazen

System.Gadget.Settings metody pro ten a zpis persistentnch nastaven nastaven jsou specifick pro kadou instanci gadgetu write(name), writeString(name) read(name), readString(name) System.Gadget.Settings.closingEvent pi oeten udlosti onSettingsClosing:

System.Gadget.onSettingsClosing = HandleSettingsClosing; function HandleSettingsClosing(e) { ... } System.Gadget.Settings.closingEvent properties: e.closeAction System.Gadget.Settings.closeAction.commit

System.Gadget.Settings.closeAction.cancel e.action - .commit nebo .cancel e.cancel nastavme na true nebo false e.cancellable meme nastavit cancel na true? Grafick objekty podobn jako v ASP.NET, existuj nov objekty kterch vlastnosti meme nastavovat jak v skriptu, tak deklarativn nov elementy html: = objekt gbackground

= objekt gimage objekt gText (?) Grafick objekty - pozad document.body.g.background nefunguje musme piadit ID a pak najt podle nj properties: attributes: src, rotation, opacity blur, brightness, softEdge left, top, height, width

metody: addGlow, addShadow addImageObject, addTextObject, removeObjects move Grafick objekty obrzky var image = document.getElementById(id); properties: jako gbackground metody:

addGlow(color, radius, alpha) addShadow(color, radius, alpha, deltaX, deltaY) addImageObject(path, offsetX, offsetY) addTextObject(text, font, size, color, offsetX, offsetY) removeObjects() vechny objekty a efekty move(offsetX, offsetY) Tipy Nastavit padding a margin u na 0px Automatick refresh var timer = window.setInterval(method, interval);

Knihovna Math zaokrouhlovn a podobn COM interop meme pout zaregistrovan objekty ActiveX var axObject = new ActiveXObject(Namespace.Class"); axObject.DoSomething()

Zdroje Galerie gadget: http://microsoftgadgets.com/ http://gallery.live.com/ Windows Sidebar Reference http://msdn2.microsoft.com/en-us/library/aa965850.aspx lnky pro zatenky i pokroil http://www.codeproject.com/gadgets

Recently Viewed Presentations

  • Progress in Radiance-Based Lunar Calibration Fangfang Yu2, Xi

    Progress in Radiance-Based Lunar Calibration Fangfang Yu2, Xi

    Empirical method - SIFT. Combined method. Characterization of BRDF (Yu) Site selection/characterization. Early Results. Summary. 11/15/2017, Xi'an, China. 2nd Lunar Calibration Workshop. introduction. Wu. 11/15/2017, Xi'an, China. 2nd Lunar Calibration Workshop.
  • CytRx (CYTR) Corporate Presentation

    CytRx (CYTR) Corporate Presentation

    cytrx safe harbor statement. this presentation contains forward-looking statements that involve certain risks and uncertainties. actual results could differ materially from those projected in the forward-looking statements as a result of the risk factors discussed in cytrx reports on file...
  • Chapter 1: Introduction - 221: Psychology of Adolescence

    Chapter 1: Introduction - 221: Psychology of Adolescence

    Adolescence is a sociohistorical creation. Early 20th century. Legislation enacted to ensure the dependency of youth. Made their move into the economic sphere more manageable. Included. a decline in apprenticeship. Increased mechanization. Raised the level of skill required. Necessitated a...
  • SIM314: Network Layers (in) Security

    SIM314: Network Layers (in) Security

    Security is a prime concern for networking. While access to the network is enough to break its integrity. Still tiny malicious actions can do a lot of damage. Usability stands in front of the security. Interoperability is based on protocols...
  • PIAC Conference - November 17, 2012

    PIAC Conference - November 17, 2012

    The TDSB offers 3 types of French programs. Core French. French Immersion . Extended French . All 3 types of programs are second language programs and it is understood that the majority of students who are participating in any of...
  • The Cold War - Warren Hills Regional School District

    The Cold War - Warren Hills Regional School District

    Describes the Cold War as an epic struggle between "the idea of freedom" and the "idea of slavery under the grim oligarchy of the Kremlin." The NSA originated as an agency that was responsible for deciphering communications during WWII, and...
  • The Red Umbrella: Chapters 1-3 - Tredyffrin/Easttown School ...

    The Red Umbrella: Chapters 1-3 - Tredyffrin/Easttown School ...

    The Red Umbrella: Chapters 1-3. Lesson prepared by Jim, Sally, and Bob. Focus: ... Reread the opening paragraph of the novel. What might the white heron and its actions symbolize (represent)? Cuba is approximately 110 miles off the coast of...
  • Chapter 7

    Chapter 7

    This approach is unacceptably slow for storage systems, where data must be read, written, and compressed within one pass over a file. 7A.2 Statistical Coding. ... It improves upon LZ78 through its efficient management of the size of the trie....