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);
        }
Exemplo n.º 2
0
        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 ConsoleGroupSend()
        {
            Console.WriteLine ("Available groups:");
            foreach (string row in list_groups())
                Console.WriteLine ("\t" + row);
            Console.Write ("Destination group: ");
            string destGroup = Console.ReadLine ();
            Console.Write ("Content: ");
            string content = Console.ReadLine ();

            Message m = new Message ();
            m ["content"] = content;
            m ["type"] = "1";

            foreach (string item in list_machines(destGroup)) {
                Console.WriteLine ("Sending message to {0}...", item);
                network.talker (machines [item] ["address"],
                    int.Parse (machines [item] ["port"]),
                    m.ToString ());
            }
        }
Exemplo n.º 4
0
 private void KeepAliveTrigger(object state)
 {
     Message m = new Message ();
     m ["content"] = "keep-alive";
     m ["type"] = "-1"; // Internal commands channel
     m ["myPort"] = listenPort.ToString(); //config ["client"] ["recipientPort"];
     m ["myAddress"] = address; // config ["client"] ["recipientAddress"];
     m ["subscription"] =  grp; //config ["client"] ["subscription"];
     network.talker (serverAddress, serverPort, m.ToString ());
 }
Exemplo n.º 5
0
 public void unregisterOnServer()
 {
     if (this.serverAddress != "" && this.serverAddress != null) {
         Message m = new Message ();
         m ["content"] = "unregister";
         m ["type"] = "-1"; // Internal commands channel
         m ["myPort"] = this.listenPort.ToString(); //config ["client"] ["recipientPort"];
         m ["myAddress"] = this.address; // config ["client"] ["recipientAddress"];
         m ["subscription"] = this.grp; //config ["client"] ["subscription"];
         m["hostname"] = this.hostname;
         network.talker (this.serverAddress, this.serverPort, m.ToString ());
         this.serverAddress = null;
     }
 }
Exemplo n.º 6
0
 public void registerOnServer()
 {
     Message m = new Message ();
     m ["content"] = "register";
     m ["type"] = "-1"; // Internal commands channel
     m ["myPort"] = listenPort.ToString();
     m ["myAddress"] = address;
             m["hostname"] = hostname = Dns.GetHostName();
     m ["subscription"] = grp; ///
     network.talker (this.serverAddress, this.serverPort, m.ToString ());
     TriggerKeepAlive ();
 }
Exemplo n.º 7
0
        private void sendMessage(string destination, int destinationPort, string message, string title, string icon)
        {
            monotifications.Message m = new monotifications.Message();
            m["content"] = message;
            m["type"] = icon;
            m["title"] = title;

            server.network.talker(destination, destinationPort, m.ToString());
        }
        public void ConsoleSingleSend()
        {
            string destIP;
            string port;
            string text;
            Console.Write ("Destination IP: ");
            destIP = Console.ReadLine ();
            Console.Write ("Destination port: ");
            port = Console.ReadLine ();
            Console.Write ("Content: ");
            text = Console.ReadLine ();

            Message m = new Message ();
            m ["content"] = text;
            m ["type"] = "1";

            network.talker (destIP, int.Parse (port), m.ToString ());
        }
        /*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));
        }