public bool notify(string appName, string className, string title, string text, string timeout, string icon) { string request = "type=SNP#?version=1.0#?action=notification#?app=" + appName + "#?class=" + className + "#?title=" + title + "#?text=" + text + "#?timeout=" + timeout + "#?icon=" + icon; SNP.SnarlNetwork(hostName, hostPort, request); return(true); }
public bool unregister(string appName) { string request = "type=SNP#?version=1.0#?action=unregister#?app=" + appName; SNP.SnarlNetwork(hostName, hostPort, request); return(true); }
public bool addClass(string appName, string className, string classTitle) { string request = "type=SNP#?version=1.0#?action=add_class#?app=" + appName + "#?class=" + className + "#?title=" + classTitle; SNP.SnarlNetwork(hostName, hostPort, request); return(true); }
public static void Main(String[] args) { string hostname = "127.0.0.1"; int hostport = 9887; string appName = "HelloSnarlApp"; string icon = "http://a0.twimg.com/profile_images/1100695109/snarl_logo_2008a_normal.png"; string title = "Notification from"; string message = "HelloSnarl"; string timeout = "5"; SNP snarl_object = new SNP(hostname, hostport); if (snarl_object.isSnarlRunning()) { Console.WriteLine("Yes snarl is running"); snarl_object.register(appName); snarl_object.notify(appName, null, title, message, timeout, icon); /*According to Snarl Developer Guide "When your application exits, it should unregister with Snarl." If you want you can remove snarl_object.unregister because when you quit snarl it will automatically unregister your application.*/ snarl_object.unregister(appName); } else Console.WriteLine("Snarl not running"); }