// search all series of a study public void onStudyButtonClicked(QueryObject queryResults) { downloadPage.stackPanel.Children.Clear(); frame.NavigationService.Navigate(downloadPage); List <QueryObject> results = explorerLogic.searchSeriesOfStudy((StudyLevelQuery)queryResults); foreach (QueryObject series in results) { // query images List <QueryObject> images = explorerLogic.searchImage((SeriesLevelQuery)series); // scarica l'immagine a metà di images.length int imageToDownload = (int)(images.Count / 2.0f); List <QueryObject> downloadedFilesInfo = explorerLogic.download(images[imageToDownload], "single"); string filePath = Constants.listenerFolder + downloadedFilesInfo[0].GetField("SOPInstanceUID"); Button resultButton = new Button(); downloadPage.stackPanel.Children.Add(resultButton); resultButton.Click += (o, e) => { explorerLogic.download(series, "series"); }; try { Bitmap img = ImageTools.loadImage(filePath); // + ".dcm" //------------------------------- ImageBrush imgBrush = new ImageBrush(); imgBrush.ImageSource = ImageTools.BitmapToImageSource(img); resultButton.Height = 70; resultButton.Width = (int)(imgBrush.ImageSource.Width / imgBrush.ImageSource.Height * 70); resultButton.Background = imgBrush; } catch (Exception) { MessageBox.Show("could not load image"); } resultButton.Content = downloadedFilesInfo[0].GetField("SeriesDescription"); File.Delete(filePath); } }