Example #1
0
        public static List <Events> GetLatestEvents(string id, string SimID, ref string error)
        {
            string        evXML = GetEventXML(id, SimID, ref error);
            List <Events> lst   = HelpingFunctions.ParseXML(HelpingFunctions.GetEventsXmlDocumentFromString(evXML));

            return(lst);
        }
Example #2
0
        public static List <Events> GetAllEvents(string id, ref string SimID, ref string error)
        {
            List <Events> lst          = new List <Events>();
            string        simulationID = IntializeDCRXML(id, ref error);

            if (string.IsNullOrWhiteSpace(error))
            {
                string evXML = GetEventXML(id, simulationID, ref error);
                if (string.IsNullOrWhiteSpace(error))
                {
                    SimID = simulationID;
                    lst   = HelpingFunctions.ParseXML(HelpingFunctions.GetEventsXmlDocumentFromString(evXML));
                }
            }

            return(lst);
        }
Example #3
0
        public static List <Events> GetExecutedEvents(string graphID, string simID, string eventName, ref string error)
        {
            List <Events> lst         = new List <Events>();
            string        PostInitURL = string.Format("{0}/api/graphs/{1}/sims/{2}/events/{3}", SiteURL, graphID, simID, eventName);

            // Create the web request
            HttpWebRequest request = WebRequest.Create(PostInitURL) as HttpWebRequest;

            request.Headers["Authorization"] = getPasswordForAuthentication();
            request.ContentType   = "application/json";
            request.Method        = "POST";
            request.ContentLength = 0;
            try
            {
                HttpWebResponse response = request.GetResponse() as HttpWebResponse;

                if (response.StatusCode == HttpStatusCode.NoContent)
                {
                    // Get response
                    using (response)
                    {
                        var a = 0;
                    }

                    string evXML = GetEventXML(graphID, simID, ref error);
                    lst = HelpingFunctions.ParseXML(HelpingFunctions.GetEventsXmlDocumentFromString(evXML));
                }
            }

            catch (WebException webex)
            {
                WebResponse errResp = webex.Response;
                using (Stream respStream = errResp.GetResponseStream())
                {
                    StreamReader reader = new StreamReader(respStream);
                    error = reader.ReadToEnd();
                }
            }
            return(lst);
        }