void geoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs ev1) { if (ev1.Parameter is GPDataFile) { GPDataFile ClipResultFile = ev1.Parameter as GPDataFile; if (String.IsNullOrEmpty(ClipResultFile.Url)) return; MessageBoxResult res = MessageBox.Show("Data file created. Would you like to download the file?", "Geoprocessing Task Success", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { WebClient webClient = new WebClient(); webClient.OpenReadCompleted += (s, ev) => { streamedDataFile = ev.Result; }; webClient.OpenReadAsync(new Uri((ev1.Parameter as GPDataFile).Url), UriKind.Absolute); mywindow = mywindow ?? new ExtractAsbuilts(); MapApplication.Current.ShowWindow("Selected Asbuilts", mywindow); } } } private void SaveButton_Click(object sender, RoutedEventArgs e) { SaveFileDialog dialog = new SaveFileDialog(); dialog.DefaultFileName = "output.zip"; dialog.Filter = "Zip file (*.zip)|*.zip"; bool? dialogResult = dialog.ShowDialog(); if (dialogResult != true) return; try { using (Stream fs = (Stream)dialog.OpenFile()) { streamedDataFile.CopyTo(fs); fs.Flush(); fs.Close(); streamedDataFile = null; } } catch (Exception ex) { MessageBox.Show("Error saving file :" + ex.Message); } }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.