Exemplo n.º 1
0
 public void SendPairingKey(string pairingKey)
 {
     var request = new ServerRequest("register_pairing_key", pairingKey);
     Send(CreateJSONRequest(request) + "\r\n");
 }
Exemplo n.º 2
0
 private void SendHandshake()
 {
     var request = new ServerRequest("register_device", TriggrViewModel.DeviceID);
     Send(CreateJSONRequest(request) + "\r\n");
 }
Exemplo n.º 3
0
 private void SendHeartbeat()
 {
     var request = new ServerRequest("heartbeat", "");
     Send(CreateJSONRequest(request) + "\r\n");
 }
Exemplo n.º 4
0
        private string CreateJSONRequest(ServerRequest request)
        {
            var memStream = new MemoryStream();
            var serializer = new DataContractJsonSerializer(typeof(ServerRequest));

            serializer.WriteObject(memStream, request);
            memStream.Position = 0;

            return new StreamReader(memStream).ReadToEnd();
        }