Ejemplo n.º 1
0
        private string DownloadAnnotationFromWebService(string annotationContainerUid)
        {
            string filename = Path.GetTempFileName();

            // Will cause GUI thread exception unless run on the original synchronization context
            // The RetrieveAnnotationsFromAimService should already be checking this, so leaving commented out
            //if (!AimDataServiceLoginTool.CredentialsValid)
            //    AimDataServiceLoginTool.RequestLogin();
            if (AimDataServiceLoginTool.CredentialsValid)
            {
                string xml = AimeWebService.Retrieve(AimDataServiceLoginTool.Credentials.ApiKey,
                                                     new AimeSearchCriteria
                {
                    AnnotationContainreUid = annotationContainerUid
                });

                using (var streamWriter = new StreamWriter(filename))
                {
                    streamWriter.Write(xml);
                }
            }

            return(filename);
        }