void Proc() { var reader = new StreamReader(client); var writer = new StreamWriter(client); while (IsStarted) { var read = reader.ReadLine(); var spl = read.Split('|'); switch (spl[0]) { case "released": Released?.Invoke(this, ApiSerializer.Released(spl[1])); break; case "tracked": GazeTracked?.Invoke(this, ApiSerializer.Tracked(spl[1])); break; case "clicked": Clicked?.Invoke(this, ApiSerializer.Clicked(spl[1])); break; default: throw new NotImplementedException("Unknown mode"); } Thread.Sleep(1); } reader.Dispose(); writer.Dispose(); }
void Cursor_Clicked(object sender, Point e) { AddMessage("clicked|" + ApiSerializer.Clicked(e)); }