Exemplo n.º 1
0
        /// <summary>
        /// Get the new Data from the Server
        /// </summary>
        /// <param name="data"></param>
        private static void SocketUpdate(object data)
        {
            Console.WriteLine(data);
            var jsonTempString = data.ToString();

            if (!string.IsNullOrEmpty(jsonTempString))
            {
                _serverInfoJson = JsonConvert.DeserializeObject <ServerInfoJson>(jsonTempString);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Send the updated Values to the Server
 /// </summary>
 /// <param name="size"></param>
 /// <param name="rotation"></param>
 /// <param name="sound"></param>
 private static void SendToServer(string size     = null,
                                  string rotation = null, string sound = null)
 {
     if (_isConnected)
     {
         var dataToServer = new ServerInfoJson
         {
             rotation = rotation,
             size     = size,
             sound    = sound
         };
         var jsonString = CreateJson(dataToServer);
         _socket.Send(jsonString);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create the json for the socket
 /// </summary>
 /// <returns></returns>
 private static string CreateJson(ServerInfoJson jsonType)
 {
     return(JsonConvert.SerializeObject(jsonType));
 }