Пример #1
0
        public Item ChangeDefconLevel(DefconLevelChange defconLevelChange)
        {
            var data   = System.Text.Encoding.UTF8.GetBytes(JsonHelper.Serialize(defconLevelChange));
            var result = (ExternalWebRequests.ExternalWebRequest(data, HttpVerbs.POST, DefconUrl + "/" + defconLevelChange.request_type));

            return(JsonHelper.Deserialize <Item>(result));
        }
Пример #2
0
        public void Refresh()
        {
            IHubContext context = GlobalHost.ConnectionManager.GetHubContext <DefconHub>();
            var         model   = new DefconModel();
            var         results = model.GetRoomInfo();

            context.Clients.All.loadResults(results);

            var body    = new System.IO.StreamReader(HttpContext.Request.InputStream).ReadToEnd();
            var message = JsonConvert.DeserializeObject <SnsMessage>(body);

            if (null != message && !string.IsNullOrWhiteSpace(message.SubscribeURL))
            {
                context.Clients.All.addNewMessageToPage("API", "Confirming SNS Subscription");
                ExternalWebRequests.ExternalHttpRequest(message.SubscribeURL, Common.HttpVerbs.GET);
            }
        }
Пример #3
0
        public RoomResponse GetRoomInfo()
        {
            var result = ExternalWebRequests.ExternalHttpRequest(DefconUrl, Common.HttpVerbs.GET);

            return(JsonHelper.Deserialize <RoomResponse>(result));
        }