コード例 #1
0
ファイル: ContactsOnMain.cs プロジェクト: 0000duck/bird
        private void OnContactUpdate(object sender, ControlCommandOccuredEventArgs e)
        {
            Contact cnt = ContactBuilder.getContactFromReceivedData(e.data);

            Console.WriteLine("contact update event");
            Console.WriteLine("id" + e.id + "\nmac: " + cnt.mac + "\nname: " + cnt.name + "\ncurrent ip: " + cnt.currentIp);

            if (contacts.ContainsKey(e.id))
            {
                contacts[e.id].updateContact(cnt);

//                MiddleController.getInstance().fileShareController.setupTempOutputFolder(settings.Default.contactPictures);
            }
            else
            {
                Console.WriteLine("Contact id not found for updating..  id: " + e.id);
                Console.Write("contacts now have are: ");

                foreach (var cn in contacts)
                {
                    Console.Write(cn.Key + ",");
                }
                Console.WriteLine();
            }

//            Console.WriteLine("current ip of update comming contact: "+contact.currentIp);
//            contacts[contact.currentIp].updateContact(contact);
        }
コード例 #2
0
        public void getSendingControlDataTest()
        {
            string data = ContactBuilder.getSendingControlData(new Contact()
            {
                mac = "", name = "sunil", currentIp = "123.23"
            });

            Contact cnt = ContactBuilder.getContactFromReceivedData(data);

            Console.WriteLine("mac: " + cnt.mac + "\nname: " + cnt.name + "\ncurrent ip: " + cnt.currentIp);
        }