private void MsgNotify(string content) { if (content.StartsWith ("<")) { monotifications.Message msg = new monotifications.Message(); msg.parse (content); MessageBoxIcon icon = MessageBoxIcon.None; switch (msg["type"].ToLower()) { case "asterisk": icon = MessageBoxIcon.Asterisk; break; case "error": icon = MessageBoxIcon.Error; break; case "exclamation": icon = MessageBoxIcon.Exclamation; break; case "hand": icon = MessageBoxIcon.Hand; break; case "information": icon = MessageBoxIcon.Information; break; case "question": icon = MessageBoxIcon.Question; break; case "stop": icon = MessageBoxIcon.Stop; break; case "warning": icon = MessageBoxIcon.Warning; break; case "none": default: icon = MessageBoxIcon.None; break; } string title = "Notification!"; if (msg["title"] != "") title = msg["title"]; System.Windows.Forms.MessageBox.Show(new Form() { TopMost = true }, msg["content"], title, MessageBoxButtons.OK, icon); } else System.Windows.Forms.MessageBox.Show(content, "Generic notification", MessageBoxButtons.OK); }
public static void __Main(String[] args) { Message m = new Message (); m.parse ("<html><body><p-1>p1</p-1><p-2>p2</p-2></body></html>"); Console.WriteLine ("p-1="+ m ["p-1"] +";"); m ["hello"] = "world"; m ["p-1"] = "Hello World!"; Console.WriteLine ("Hello=" + m ["hello"] +";"); Console.WriteLine(m); }
public void Receiver(string content) { if (content.StartsWith ("<")) { Message msg = new Message (); msg.parse (content); if (msg ["type"] == "-1") switch (msg ["content"]) { case "regiser": case "keep-alive": if (msg["hostname"] != "") RegisterClient (msg["hostname"]+":"+msg["myPort"], msg ["myAddress"], msg ["myPort"], msg ["subscription"]); else RegisterClient (msg ["myAddress"], msg ["myPort"], msg ["subscription"]); break; case "unregister": UnregisterClient (msg ["myAddress"] +":"+ msg ["myPort"]); break; } //else // Console.WriteLine ("XML dump: {0}", content); //Console.WriteLine (string.Format ("New message receivd: {0}", msg ["content"])); } else Console.WriteLine (string.Format ("New text message: {0}", content)); }
/*public void RegisterOnServer () { if (config ["server"] ["serverAddress"] != "" && config ["server"] ["serverPort"] != "") { /* Console.WriteLine ("Registering on {0}", config ["server"] ["serverAddress"]); registerOnServer (config ["server"] ["serverAddress"], config ["client"] ["recipientAddress"], config ["client"] ["recipientPort"], config ["client"] ["subscription"]);* / base.registerOnServer(); } else Console.WriteLine ("No server defined"); }*/ private void MsgNotify(string content) { if (content.StartsWith ("<")) { Message msg = new Message (); msg.parse (content); Console.WriteLine ("XML dump: {0}", content); Console.WriteLine (string.Format ("New message receivd: {0}", msg ["content"])); } else Console.WriteLine (string.Format ("New text message: {0}", content)); }