Make your own ThrottleLauncher live background (Advanced)
( 2 Votes )
Hits smaller text tool iconmedium text tool iconlarger text tool icon

Dependencies

Required assemblies you will have to add as dependencies for the project:

  • TrottleLauncher.exe
  • ThrottleLibrary.dll

Steps

  • Create a dinamic library NET.CF project (y use C# but any .NET lang will be ok)
  • Create a class (or reuse the one created automatically by the wizzard)
  • The class has to extend from BackgroundExtension
  • Create a Constructor that receives System.Xml.XmlNode and ThrottleLibrary.util.PageContainerWrapper. Do not perform any initializations here other than the Dock.

 

1
2
3
4
5
6
public Bubbles(System.Xml.XmlNode node, PageContainerWrapper pcw)
: base(node, pcw)
{
//We will take all the space available
this.Dock = Dock.Full;
}

 

  • Override the Init function to perform initalizations:
1
2
3
4
5
6
7
8
9
public override void Init(ThrottleLibrary.Util.ListenerPool lp)
{
this.MouseDown += new TLMouseEventHandler(Extension_MouseDown);
this.MouseUp += new TLMouseEventHandler(Extension_MouseUp);
this.Paint += new TLPaintEventHandler(Bubbles_Paint);
 
//We register a temporal action like this. It's not recomended to use Timer.
Timer.AddTimer(new EventHandler(tick));
}

 

  • Implement the events.

Loading graphic resources (images).

  • To load graphics resources it's strongly recomended to use the ThrottleLibrary.Util.Images.ImageFactory class by the GetInstance method passing the full path.
  • ImageFactory will return a ThrottleImage class. You can use that class to render graphics independently of it's type or the rendering engine.
  • Remember to call Dispose on the ThrottleImage instance if you don't plan to use it anymore.

 

Using ThrottleLauncher native elements

  • You can also use the Classes at ThrottleLibrary.model.inst to add persistent graphic entries to your background. For example, if during the initialization you perform the following:
1
2
3
4
ThrottleLibrary.model.inst.Text text = new ThrottleLibrary.model.inst.Text();
text.Value="Hello World";
this.add(text);
 
  • You will get the phrase "Hello World" inside your live background.
  • You can move it arround by using the text.Move(X,Y) method or by setting X,Y properties.
  • Check the Lights background sample for more info on this.

The manifest file

The last step is creating a manifest.xml file following this syntax:

1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="utf-8"?>
<plugins>
<plugin>
<name>Light glow</name>
<dll>BackgroundCollection.dll</dll>
<class>ThrottleLauncher.Backgrounds.Lights</class>
<type>BACKGROUND</type>
</plugin>
</plugins>


You can add as much plugin items as you wish.

Deployment

  • Create a folder inside the plugins directory of the ThrottleLauncher instalation path. (i.e. \ProgramFiles\ThrottleLaunche\Plugins\MyPlugin\)
  • Copy the dll, the manifest.xml and the resources inside that folder.
  • Now open the config of a theme that supports Live backgorunds and you should see your plugin on the list :).

Important info

  • The painting events (TLPaintEventArgs) contains an offset you will have to take into account in order to draw correcly aligned coordinates.
  • The ITLGraphics interface provides means of accesing the drawing engine independently of the device. Check the methods it provides. You can obtain that object in the TLPaintEventArgs.G property in the paint event.
  • ThrottleLauncher is not a development API but a full product so you may find a lot of methods and classes that actually is better not to mess with ;).

Full samples

Check the attached VS2008 project that contains also the Snakes sample.



Attachments:
FileDescriptionFile size
Download this file (BackgroundCollection.zip)BackgroundCollection.zipLights and Snakes live backgrounds samples. VS2008 C# proyects201 Kb
Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
Security
Please input the anti-spam code that you can read in the image.
 
  • Screenshots
  • Screenshots
  • Screenshots
  • Screenshots
  • Screenshots

Login



Follow us on Twitter