public Task <bool> LoginWithSerialPort() { return(Task.Run(() => { try { var arduino = new ArduinoReader(_comPort, _baudRate); var lines = arduino.ReadLines(2).ToList(); if (_AuthericationService.IsValid(lines[0], lines[1])) { return true; } arduino.Write("Denied"); return false; } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } })); }
static void Main(string[] args) { ArduinoReader ar = new ArduinoReader(); for (;;) { System.Threading.Thread.Sleep(5000); } }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance != this) { Destroy(this); return; } }