public static void Get() { var request = new RestRequest(Settings.API_VERSION + Settings.SHAPE_OBJECT_PATH + "/" + ServerService.instance.currentImageId, Method.GET); ServerService.instance.server.ExecuteAsync <Image>(request, response => { Application.Current.Dispatcher.Invoke(() => { Editeur currentEditingImage = ((VueModele)((MainWindow)Application.Current.MainWindow).FenetreDessin.DataContext).editeur; if (response.StatusCode == HttpStatusCode.OK) { currentEditingImage.Load(JArray.Parse(response.Content)); } else { MessageBox.Show("Could not load the image", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }); }); }