by Naveen
8. December 2009 06:14
This is .Net implementation of recently published python Google Wave robot supasmiley. This is a very simple robot that parses the text in a blip. If there is some text that matches standard
character combination for emoticon display, it replaces that text with a google wave gadget to display
graphical display. In this example, the robot is only looking for character combination <3. If
it is found, the range of characters are removed and gadget is inserted. The gadget is a simple flash movie
that display beating heart.
void ProcessEmotions(IEvent e)
{
var txtView = e.Blip.Document;
var txt = txtView.Text;
var idx = txt.IndexOf("<3");
if (idx == -1)
{
return;
}
txtView.Delete(new Range(idx, idx+2));
txtView.InsertElement(idx, new Gadget("http://wave.byteblocks.com/emotions-gadget.xml"));
}
Try It
- Add byteblocks-emotions@appspot.com into your contact list.
- Start a new wave or you can choose an existing wave
- Add byteblocks-emotions@appspot.com as participant in the wave.
- Enter text and where you want to show beating heart, type <3
- ... like the heart now....
Download Sample Project
|
|
|