예제 #1
0
 void ExportToPdf(ConnectionProvider serverConnection, string fileName, int reportId)
 {
     splashScreenManager1.ShowWaitForm();
     Task.Factory.ExportReportAsync(serverConnection.CreateClient(), new ReportIdentity(reportId), new PdfExportOptions(), null, null)
     .ContinueWith(task => {
         splashScreenManager1.CloseWaitForm();
         try {
             if (task.IsFaulted)
             {
                 throw new Exception(task.Exception.Flatten().InnerException.Message);
             }
             File.WriteAllBytes(fileName, task.Result);
         } catch (Exception e) {
             MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
예제 #2
0
 void ExportToPdf(ConnectionProvider serverConnection, string fileName, int reportId)
 {
     Task.Factory.ExportReportAsync(serverConnection.CreateClient(), new ReportIdentity(reportId), new PdfExportOptions(), null, null)
     .ContinueWith(task => {
         IsBusy = false;
         try {
             if (task.IsFaulted)
             {
                 throw new Exception(task.Exception.Flatten().InnerException.Message);
             }
             else if (task.IsCanceled)
             {
                 MessageBoxService.Show("Operation has been cancelled", "Export", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation);
                 return;
             }
             else
             {
                 File.WriteAllBytes(fileName, task.Result);
             }
         } catch (Exception e) {
             MessageBoxService.Show(e.Message, "Export", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
         }
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
예제 #3
0
 void remoteDocumentSource1_ReportServiceClientDemanded(object sender, ReportServiceClientDemandedEventArgs e)
 {
     e.Client = serverConnection.CreateClient();
 }