/// <summary> /// Executes our Command and returns defined. /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> internal T Execute <T>(string JsonString = null, object[] _param = null) { var _data = Data == null ? JsonString : Data; if (_param != null) { if (Name == "DeleteNotification" || Name == "ReadNotification") { RequestUri = RequestUri.Replace("{id}", _param[0].ToString()); } } var request = Network.MakeRequest(Config.GateWay, RequestUri, null, httpMethod, _data).Content.ReadAsStringAsync().Result; if (JsonType == typeof(JsonObjects.AuthToken)) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), JsonType)); } else if (JsonType == typeof(JsonObjects.BooleanResult)) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), typeof(JsonObjects.BooleanResult))); } else if (JsonType == typeof(JsonObjects.Notifications.NotificationEntry[])) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), typeof(JsonObjects.Notifications.NotificationEntry[]))); } else if (JsonType == typeof(DeviceStatus)) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), typeof(DeviceStatus))); } else if (JsonType == typeof(DeviceType)) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), typeof(DeviceType))); } else if (JsonType == typeof(Cards)) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), typeof(Cards))); } else if (JsonType == typeof(PineAP)) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), typeof(PineAP))); } else if (JsonType == typeof(ServiceSetIDs)) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), typeof(ServiceSetIDs))); } else if (JsonType == typeof(Handshakes)) { return((T)Convert.ChangeType(JsonConvert.DeserializeObject(request, JsonType), typeof(Handshakes))); } return((T)Convert.ChangeType(true, typeof(bool))); }