protected void UpdateExistingRaster(object sender, ExportedImageEventArgs e)
        {
            if (this.PendingImage != null)
            {
                return;
            }
            this.PendingImage = e;
            new Extent(e.Points);
            Point3d  point3d  = new Point3d(this.PendingImage.Points[0].X, this.PendingImage.Points[0].Y, 0.0);
            Point3d  point3d2 = new Point3d(this.PendingImage.Points[1].X, this.PendingImage.Points[1].Y, 0.0);
            Point3d  point3d3 = new Point3d(this.PendingImage.Points[2].X, this.PendingImage.Points[2].Y, 0.0);
            Vector3d v        = point3d2 - point3d;
            Vector3d v2       = point3d3 - point3d;

            DocUtil.UpdateRasterImage(this.ParentDataset.ParentDocument, this.RasterObjectId, this.PendingImage.ExportOptions.OutputFile, point3d, v, v2);
            this.CurrentFileName = this.PendingImage.ExportOptions.OutputFile;
            this.PendingImage    = null;
        }
 private void AddImageService(object sender, ExportedImageEventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(e.ErrorMessage))
         {
             ErrorReport.ShowErrorMessage(e.ErrorMessage);
         }
         else if (e.Points != null && !string.IsNullOrEmpty(e.ExportOptions.OutputFile))
         {
             Point3d  point3d  = new Point3d(e.Points[0].X, e.Points[0].Y, 0.0);
             Point3d  point3d2 = new Point3d(e.Points[1].X, e.Points[1].Y, 0.0);
             Point3d  point3d3 = new Point3d(e.Points[2].X, e.Points[2].Y, 0.0);
             Point3d  p        = new Point3d(e.Points[1].X, e.Points[2].Y, 0.0);
             Vector3d v        = point3d2 - point3d;
             Vector3d v2       = point3d3 - point3d;
             ObjectId objectId = DocUtil.DefineRasterImage(AfaDocData.ActiveDocData.Document, e.ExportOptions.OutputFile, point3d, v, v2, "ESRI_" + e.MapName, e.ExportOptions.Transparency);
             if (!objectId.IsNull)
             {
                 DocUtil.SetEntityDisableUndo(AfaDocData.ActiveDocData.Document, objectId, true);
                 e.ExportOptions.BoundingBox = new Extent(point3d, p);
                 e.ExportOptions.BoundingBox.SpatialReference = e.ExportOptions.OutputWKT;
                 MSCImageService mSCImageService = MSCDataset.AddImageService((AGSImageService)e.MapService, objectId, e.ExportOptions);
                 if (mSCImageService != null)
                 {
                     DocUtil.AttachHyperlink(AfaDocData.ActiveDocData.Document, objectId, mSCImageService.Name, mSCImageService.RestEndpoint);
                     mSCImageService.UpdateToCurrentView();
                     mSCImageService.CheckForUpdates();
                 }
             }
         }
     }
     catch
     {
         if (string.IsNullOrEmpty(base.ErrorMessage))
         {
             base.ErrorMessage = AfaStrings.ErrorGeneratingImage;
         }
         throw;
     }
 }