public static EndpointMetadata GetByAcronym(string acroynm) { EndpointMetadata result = null; try { RestClient rc = new RestClient(App.AuthorizationHeader); var rcResult = rc.ExecuteXml(Endpoints.Endpoint_EndpointMetadataQuery); if (rcResult.Status == HttpStatusCode.OK) { var xml = rcResult.Element; var element = (from x in xml.Descendants("Endpoint") where x.Element("Acronym").Value == acroynm select x).FirstOrDefault(); if (element != null) { result = new EndpointMetadata(); result.Name = element.GetChildElementValue("Name", ""); result.Acronym = element.GetChildElementValue("Acronym", ""); result.Tier = element.GetChildElementValue <int>("Tier", 1); result.Description = element.GetChildElementValue("Description", ""); result.Comments = element.GetChildElementValue("Comments", ""); result.Status = element.GetChildElementValue("Status", ""); result.Category = element.GetChildElementValue("Category", ""); result.CategoryDescription = element.GetChildElementValue("CategoryDescription", ""); result.UrlFragment = element.GetChildElementValue("UrlFragment", ""); result.Uri = element.GetChildElementValue("Uri", ""); var isXml = element.Element("InputSchema"); if (isXml != null) { result.InputSchema = new SchemaInfo(); result.InputSchema.Name = isXml.GetChildElementValue("Name", ""); result.InputSchema.Location = isXml.GetChildElementValue("Location", ""); result.InputSchema.Namespace = isXml.GetChildElementValue("Namespace", ""); result.InputSchema.PublishDate = isXml.GetChildElementValue <DateTime>("PublishDate", DateTime.Now); result.InputSchema.FileName = isXml.GetChildElementValue("FileName", ""); } var oxXml = element.Element("OutputSchema"); if (oxXml != null) { result.OutputSchema = new SchemaInfo(); result.OutputSchema.Name = oxXml.GetChildElementValue("Name", ""); result.OutputSchema.Location = oxXml.GetChildElementValue("Location", ""); result.OutputSchema.Namespace = oxXml.GetChildElementValue("Namespace", ""); result.OutputSchema.PublishDate = oxXml.GetChildElementValue <DateTime>("PublishDate", DateTime.Now); result.OutputSchema.FileName = oxXml.GetChildElementValue("FileName", ""); } } } } catch { } return(result); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Acronym)) { EndpointMetadata em = EndpointMetadata.GetByAcronym(Acronym); if (em != null) { Title = em.Name + " (" + em.Acronym + ")"; Description = em.Description; var moreInfoUrl = Endpoints.ServerBase + "/Home/EndpointDetail/" + em.Acronym; hlMoreInfo.NavigateUri = new Uri(moreInfoUrl); } } }