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

  • Specialist Program - Human Resource Management & Industrial

    Specialist Program - Human Resource Management & Industrial

    Soo Min Toh. Assoc. Prof & Assoc. Chair, Dept of Management. Natasha Walli. Careers Officer, Dept of Management. 14.0 FCE start Sept 2015. GAIN. A breadth of understanding across the core management disciplines.
  • Statistics Informed Decisions Using Data, 5e

    Statistics Informed Decisions Using Data, 5e

    5.3 Independence and the Multiplication Rule5.3.2Use the Multiplication Rule for Independent Events (2 of 6) EXAMPLE Computing Probabilities of Independent Events. The probability that a randomly selected female aged 60 years old will survive the year is 99.186% according to...
  • Japanese Street Food

    Japanese Street Food

    Sushi is a Japanese food consisting of cooked vinegared rice combined with other ingredients, seafood, vegetables and sometimes tropical fruits. Ingredients and forms of sushi presentation vary widely, but the ingredient which all sushi have in common is rice.
  • InteLockTM Remote Access and Proximity Key Advisor: Team:

    InteLockTM Remote Access and Proximity Key Advisor: Team:

    Each key has a unique ID tag Can set system so that the loss ID tag will not be accepted Integrate keyless system with internet Home entry control from remote location Requirements Phase (1) will involve the interaction of the...
  • Contestant #1 I am a womanizer, have self-interested

    Contestant #1 I am a womanizer, have self-interested

    Complete Political Spectrum Quiz (on moodle) Table Talk: What is more important, individual rights or rights of the nation as a whole? What are the benefits of giving the one person or the government more control? Why would countries start...
  • How to Count Atoms - Polk County School District

    How to Count Atoms - Polk County School District

    How to Count Atoms Coefficient If an element or molecule has a LARGE number in front of it, this is how many atoms of each element there is. Example: 4Na -FOUR Sodium atoms 2HCl -TWO Hydrogen atoms and TWO Chlorine...
  • Knowledge translation: What it is and what it isn't

    Knowledge translation: What it is and what it isn't

    PABC librarian, UBC Rehab Sciences librarian THE ROLE OF THE KT BROKER 3. Appraise Strategies to enhance ability to critically appraise quality of evidence Tools for appraisal of RCTs, systematic reviews, Meta-analyses 4.
  • Canadas Aboriginal Population  Aboriginal peoples  descendants of Canadas

    Canadas Aboriginal Population Aboriginal peoples descendants of Canadas

    Federal government divides Aboriginals into three groups Indian Status Indians - entitled to rights through treaties Non-status Indians -are not covered under treaties Inuit Aboriginal people living in the Arctic M├ętis Of Aboriginal and European descent The Treaty-Making Process French...