using System; using System.Media; using System.Threading; using System.Collections.Generic; namespace Ozeki { public class Program { List keys; public void Start() { Subscribe("MyPN532Nfc@localhost"); Subscribe("My_SQL_messaging_1@localhost"); keys = new List(); } public void Receive(Message msg) { if(msg.FromConnection == "MyPN532Nfc@localhost") if(keys.Contains(msg.Text)){ openDoor(); } if(msg.FromConnection == "My_SQL_messaging_1@localhost") { if(keys.Contains(msg.Text)) { keys.Clear(); } keys.Add(msg.Text); } } void openDoor() { Send("MyRelay@localhost","on"); System.Threading.Thread.Sleep(20000); Send("MyRelay@localhost","off"); } } };