In this post I will discuss development of a Google Wave robot using .Net API. This sample is a port of java sample Debuggy provided by google. I have leveraged that sample to build a simple robot that performs following things:
Some of the key concepts demonstrated in this sample are:
In my previous post, I talked about how to go about developing a wave robot using .Net. I will list those points quickly here.
I will pick OnBlipSubmitted implementation from the sample project and discuss it line by line. And following image shows how this robot is interacting in wave client.
protected override void OnBlipSubmitted(IEvent e)
{
base.OnBlipSubmitted(e);
IBlip blip = e.Wavelet.AppendBlip();
TextView textView = blip.Document;
textView.Append(string.Format("WaBo - Blip submitted [{0}][{1}]",
e.Blip.BlipId, e.Blip.Document.Text));
if (e.Blip.Document.Text.IndexOf("_dumpit_") != -1)
{
try
{
var cacheKey = string.Format("DumpTrack_{0}", e.Wavelet.WaveId);
if (HttpContext.Current.Cache[cacheKey] == null)
{
e.Wavelet.AppendBlip().Document.Append("Dumping Wave - " + e.Blip.Document.Text);
ViewUtil.DumpWave(e);
}
}
catch (Exception ex)
{
ViewUtil.DumpException(e, ex);
}
}
}
All the steps in this method are very intuitive and self explanatory.
All these methods are very self explanatory. Simplest of all these methods is Append. If you want to insert some simple text you can use this method. For more formatted and styled text you can utilize other methods. Following example shows implementation from method where I am displaying wave creator's name in red color and other participant names are displayed in blue.
foreach (var participant in e.Wavelet.Participants)
{
var color = (string.Compare(participant, creator, true) == 0) ? "red" : "blue";
var txt = string.Format("<span style=\"color:{0};font-weight:bold;\">{1}</span>",
color, participant);
textView.AppendMarkup(txt);
textView.Append(ViewUtil.CreateNewLine());
}
Following image shows how this debug helper robot helps in dumping exception details when somethings goes wrong in robot event handlers.
I hope this sample will provide you enough information and details to get started with Google Wave robot development using .Net. I will post some more samples to demonstrate more advanced features of this framework.
How to publish and subscibe events for google wave robots
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2024 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use