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

  • SWINE FLU/H5N1! FEMA Ver2  Simpson Wigle LAW LLP

    SWINE FLU/H5N1! FEMA Ver2 Simpson Wigle LAW LLP

    Title: Slide 1 Author: JayR Last modified by: bjohnso4 Created Date: 9/3/2008 10:37:27 AM Document presentation format: On-screen Show Company: Simpson Wigle
  • Chapter 13: Social Influence and Persuasion

    Chapter 13: Social Influence and Persuasion

    Techniques of Social Influence:based on principles of reciprocity. Social Norm of Reciprocity. Humans have a inborn tendency to reciprocate. Research/Examples. Restaurant servers: Give two candies to customers = 14.1% increase in tips. Reuse towels (Hotels): Money already given to charity...
  • Fülemüle informatika versenyre

    Fülemüle informatika versenyre

    Anita Last modified by: tanár Created Date: 2/12/2013 5:25:01 PM Document presentation format: Diavetítés a képernyőre Other titles: Arial Arial Black Times New Roman Wingdings Verdana Tahoma Üvegtáblák Címkés Kapszulák Szikla Nyílás Rusztikus Verseny Fülemüle informatika verseny ...
  • Geoffrey Chaucer - Pearland Independent School District

    Geoffrey Chaucer - Pearland Independent School District

    (Hopper vii) 1357 Chaucer became page in the household of Elizabeth de Burgh, Countess of Ulster. (She is the wife of Lionel, Earl of Ulster, second son of Edward III.) The earliest known document in which Geoffrey Chaucer is named...
  • Anthropology 101 - jennifermcniven.com

    Anthropology 101 - jennifermcniven.com

    Linguistic Anthropology. The study of human language and communication. Includes the physiological relationship of the brain to speech. Explores cultural significance of language and the movement of cultural groups
  • Gmail Basics By Laurel Johnson Young Adult Librarian

    Gmail Basics By Laurel Johnson Young Adult Librarian

    Get comfortable with the Gmail interface. Compose, reply to, and/or forward messages. Understand the difference between the archive and delete functions. Organize your inbox with tabs, labels, and stars. Create a filter to categorize messages with labels as they arrive...
  • Sociocultural Implications of Diagnosis in Mild Traumatic ...

    Sociocultural Implications of Diagnosis in Mild Traumatic ...

    PTSD Through the Decades- Labeling and Perception Railway Spine Syndrome Irritable Heart Shell Shock Post-concussion syndrome Concentration Camp Syndrome Etiological Models of PTSD Biological Cognitive Sociocultural Co-morbid Conditions and PTSD Mood Disorders Other Anxiety Disorders Substance Abuse Disorders Traumatic Brain...
  • Futures, Education and Geography - my journey so far

    Futures, Education and Geography - my journey so far

    Futures, Education and Geography - my journey so far The problem of 'relevance' Purpose - what is education for? What was education & schooling designed for? What's happening now? What's going to happen in the future?