Exemplo n.º 1
0
 private async Task ExportFile(string download_path, string filename)
 {
     await QueuedTask.Run(async() => {
         try
         {
             Geodatabase gdb     = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@download_path)));
             string default_path = Path.GetDirectoryName(Project.Current.URI);
             await DownloadFile(default_path, filename);
             string fullPath       = Path.Combine(default_path, filename);
             string rasterFileName = Path.GetFileNameWithoutExtension(fullPath);
             string rasterName     = Regex.Replace(rasterFileName, @"[^0-9a-zA-Z_]", "_"); //string.Empty
             string outputRaster   = Path.Combine(download_path, rasterName);
             await Ag_Analytics_Module.CopyRaster(fullPath, outputRaster);
             await Ag_Analytics_Module.SetToClassifyColorizerFromLayerName(rasterName, 10, "Bathymetric Scale");
             // delete files in default path
             File.Delete(fullPath);
         }
         catch
         {
             await DownloadFile(download_path, filename);
             await Ag_Analytics_Module.AddLayerToMapAsync(Path.Combine(download_path, filename));
             await Ag_Analytics_Module.SetToClassifyColorizerFromLayerName(filename, 10, "Bathymetric Scale");
         }
     });
 }
Exemplo n.º 2
0
        public async Task SubmitExecute()
        {
            ValidationSubmitError = null;

            List <string> validationSubmitErrors = new List <string>();

            string aoi = null;

            if (_selectedAOILayer != null)
            {
                if (_selectedAOILayer is FeatureLayer)
                {
                    FeatureLayer lyr = _selectedAOILayer as FeatureLayer;

                    int featureCount = await QueuedTask.Run(() => { return(lyr.GetFeatureClass().GetCount()); });

                    if (featureCount == 0)
                    {
                        validationSubmitErrors.Add("AOI is empty.");
                    }
                    else
                    {
                        aoi = await Ag_Analytics_Module.GetGeoJSONFromFeatureLayer(lyr);
                    }
                }
                else if (_selectedAOILayer is RasterLayer)
                {
                    RasterLayer lyr            = _selectedAOILayer as RasterLayer;
                    string      default_path   = Path.GetDirectoryName(Project.Current.URI);
                    string      timestamp      = DateTime.Now.ToString("yyyyMMddHHmmss");
                    string      rasterFileName = "AOI_Raster_" + timestamp + ".tif";
                    string      outputRaster   = Path.Combine(default_path, rasterFileName);
                    var         parameters     = Geoprocessing.MakeValueArray(lyr.Name, outputRaster, "", "", "", false, false, "", false, false, "TIFF");
                    IGPResult   result         = await Geoprocessing.ExecuteToolAsync("management.CopyRaster", parameters, null, null, null, GPExecuteToolFlags.None);

                    aoi = outputRaster;
                }
            }
            else
            {
                validationSubmitErrors.Add("AOI parameter must be selected.");
            }

            string        selectedBands  = null;
            List <string> _selectedBands = new List <string>();

            foreach (var band in _bands)
            {
                if (band.Check_Status == true)
                {
                    _selectedBands.Add(band.Band_Name);
                }
            }
            if (_selectedBands.Count > 0)
            {
                selectedBands = JsonConvert.SerializeObject(_selectedBands);
            }
            else
            {
                validationSubmitErrors.Add("Bands must be selected");
            }

            //satellite: _selectedSatellite
            int    _showLatestValue = _showLatest ? 1 : 0;
            string startDate        = String.Format("{0:M/d/yyyy}", _startDate);
            string endDate          = String.Format("{0:M/d/yyyy}", _endDate);

            if (!_showLatest)
            {
                if (DateTime.Compare(_startDate, _endDate) >= 0)
                {
                    validationSubmitErrors.Add("Start Date must be earlier than End Date.");
                }
            }

            if (_downloadPath == null || string.IsNullOrEmpty(_downloadPath))
            {
                validationSubmitErrors.Add("Download path must be selected.");
            }
            else
            {
                if (!Directory.Exists(_downloadPath))
                {
                    validationSubmitErrors.Add("Download path doesn't exsist.");
                }
            }

            SpatialReference outputSpatialReference = null;

            if (selectedSpatialReference == null)
            {
                outputSpatialReference = await QueuedTask.Run(() => { return(_selectedAOILayer.GetSpatialReference()); });
            }
            else
            {
                outputSpatialReference = selectedSpatialReference;
            }

            if (outputSpatialReference.IsGeographic && _cellSize > 1)
            {
                validationSubmitErrors.Add("Resolution must be < 1 in geographic coordinate system(ex:0.0001)");
            }
            else if (outputSpatialReference.IsProjected && _cellSize < 1)
            {
                validationSubmitErrors.Add("Resolution must be > 1 in projected coordinate system(ex:10)");
            }

            if (validationSubmitErrors.Count > 0)
            {
                ValidationSubmitError = string.Join("\n", validationSubmitErrors);
                return;
            }
            if (validationInputError != null)
            {
                return;
            }

            //ProgressDialog progressDialog = new ProgressDialog("Please wait for result response...");
            //progressDialog.Show();
            int byweekValue      = _checkbyweek ? 1 : 0;
            int filterValue      = _checkfilter ? 1 : 0;
            int qafilterValue    = _checkqafilter ? 1 : 0;
            int flattendataValue = _checkflattendata ? 1 : 0;

            SubmitButtonEnabled = false;
            ResultBoxVisible    = "Hidden";
            ProgressVisible     = "Visible";
            ProgressMessage     = "Request Calling...";
            DateTime started_datetime = DateTime.Now;

            SubmitStartedTime  = started_datetime.ToString();
            ResultErrorMessage = "";

            IRestResponse apiResponse = await BackgroundTask.Run <IRestResponse>(() =>
            {
                var client     = new RestClient("https://ag-analytics.azure-api.net/hls-service/");
                client.Timeout = -1;
                var request    = new RestRequest(Method.POST);

                //request.AlwaysMultipartFormData = true;
                //request.AddHeader("Content-Type", "application/x-www-form-urlencoded");

                if (_selectedAOILayer is FeatureLayer)
                {
                    request.AddParameter("aoi", aoi);
                }
                else if (_selectedAOILayer is RasterLayer)
                {
                    request.AddFile("aoi", aoi);
                }

                request.AddParameter("Band", selectedBands);
                request.AddParameter("satellite", _selectedSatellite);

                request.AddParameter("showlatest", _showLatestValue);
                request.AddParameter("Startdate", startDate);
                request.AddParameter("Enddate", endDate);

                request.AddParameter("resolution", _cellSize);
                request.AddParameter("displaynormalvalues", _displaynormalvalues);
                request.AddParameter("qacloudperc", _qacloudperc);

                request.AddParameter("byweek", byweekValue);
                request.AddParameter("filter", filterValue);
                request.AddParameter("qafilter", qafilterValue);
                request.AddParameter("flatten_data", flattendataValue);

                request.AddParameter("projection", outputSpatialReference.Wkt);

                // these parameter options no need on ArcGIS pro
                request.AddParameter("legendtype", "Relative");
                request.AddParameter("statistics", 0);  // set always 0
                request.AddParameter("return_tif", 1);  // set always 1

                SubmitAOI                 = aoi;
                SubmitBand                = selectedBands;
                SubmitSatellite           = _selectedSatellite;
                SubmitShowLatest          = _showLatestValue.ToString();
                SubmitStartDate           = startDate;
                SubmitEndDate             = endDate;
                SubmitResolution          = _cellSize.ToString();
                SubmitDisplayNormalValues = _displaynormalvalues.ToString();
                SubmitQacloudperc         = _qacloudperc.ToString();
                SubmitByWeek              = byweekValue.ToString();
                SubmitFilter              = filterValue.ToString();
                SubmitQaFilter            = qafilterValue.ToString();
                SubmitFlattenData         = flattendataValue.ToString();
                SubmitProjection          = outputSpatialReference.Wkt;
                SubmitDownloadFolder      = _downloadPath;

                IRestResponse response = client.Execute(request);

                return(response);
            }, BackgroundProgressor.None);

            if (File.Exists(aoi))
            {
                string   default_path  = Path.GetDirectoryName(Project.Current.URI);
                string   filesToDelete = Path.GetFileNameWithoutExtension(aoi) + ".*";
                string[] fileList      = Directory.GetFiles(default_path, filesToDelete);
                foreach (string file in fileList)
                {
                    File.Delete(file);
                }
            }

            if (!apiResponse.IsSuccessful)
            {
                //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(response.ErrorMessage);
                //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed Result. Please try again.");
                ResultErrorMessage += "Response Error\n";
                ResultErrorMessage += apiResponse.ErrorMessage;

                DisplayFailed(started_datetime);

                return;
            }

            dynamic jsonData = JsonConvert.DeserializeObject <dynamic>(apiResponse.Content);

            ProgressMessage = "Downloading tif files...";
            try
            {
                foreach (dynamic item in jsonData)
                {
                    string filename = item.download_url;
                    await ExportFile(_downloadPath, filename);
                }
            }
            catch (Exception e)
            {
                //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("HLS API Error. Please try again.");
                ResultErrorMessage += "Download Error\n";
                ResultErrorMessage += e.Message;

                DisplayFailed(started_datetime);

                return;
            }

            //progressDialog.Hide();
            ProgressVisible = "Hidden";
            ProgressMessage = "";
            DateTime ended_datetime = DateTime.Now;

            CompletedTime = ended_datetime.ToString();
            int seconds = (int)(ended_datetime.Subtract(started_datetime).TotalSeconds);

            ElapsedTime = seconds.ToString() + "  Seconds";

            ResultBoxBGColor   = "#3a593a";
            ResultBoxImage     = "pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/DataReviewerLifecycleVerified32.png";
            ResultBoxMessage   = "Completed";
            ResultErrorMessage = "There are no errors or warnings.";

            ResultBoxVisible    = "Visible";
            SubmitButtonEnabled = true;
        }
Exemplo n.º 3
0
        private async Task ExportFile(string download_path, string filename, string shapefileUrl)
        {
            string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
            string dir_name  = filename + "_" + timestamp;

            await QueuedTask.Run(async() => {
                try
                {
                    Geodatabase gdb     = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@download_path)));
                    string default_path = Path.GetDirectoryName(Project.Current.URI);
                    string dir_path     = Path.Combine(default_path, dir_name);
                    Directory.CreateDirectory(dir_path);
                    await DownloadZipFile(dir_path, filename, shapefileUrl);
                    string featureClassName = Regex.Replace(filename, @"[^0-9a-zA-Z_]", "_") + "_" + timestamp;  //string.Empty
                    string outputUrl        = Path.Combine(download_path, featureClassName);
                    await Ag_Analytics_Module.CopyFeatures(Path.Combine(dir_path, filename + ".shp"), outputUrl);

                    if (_checkRasterizeShapefile)
                    {
                        ProgressMessage = "Rasterize...";
                        dynamic json    = await RasterizeShapefile(dir_path, filename);

                        if (json == null)
                        {
                            //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed Rasterize Shapefile. Please try again.");
                            ResultErrorMessage += "\nFailed Rasterize Shapefile";
                            return;
                        }
                        try
                        {
                            foreach (dynamic item in json)
                            {
                                foreach (string fileUrl in item.raster)
                                {
                                    string ext = Path.GetExtension(fileUrl);
                                    string downloadFileName = filename + "_" + item.field + ext;
                                    await DownloadRasterizeFile(dir_path, downloadFileName, fileUrl);

                                    if (ext == ".tif")
                                    {
                                        string rasterFileName = filename + "_" + item.field + "_" + timestamp;
                                        string rasterName     = Regex.Replace(rasterFileName, @"[^0-9a-zA-Z_]", "_"); //string.Empty
                                        string outputRaster   = Path.Combine(download_path, rasterName);
                                        await Ag_Analytics_Module.CopyRaster(Path.Combine(dir_path, downloadFileName), outputRaster);
                                        await Ag_Analytics_Module.SetToClassifyColorizerFromLayerName(rasterName, 10, "Bathymetric Scale");
                                    }
                                    else if (ext == ".dbf")
                                    {
                                        string tableFileName = filename + "_" + item.field + "_Table_" + timestamp;
                                        string tableName     = Regex.Replace(tableFileName, @"[^0-9a-zA-Z_]", "_"); //string.Empty
                                        await Ag_Analytics_Module.CopyTable(Path.Combine(dir_path, downloadFileName), download_path, tableName);
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed Rasterize Shapefile. Please try again.");
                            ResultErrorMessage += "\nFailed Rasterize Shapefile:";
                            ResultErrorMessage += e.Message;
                            return;
                        }
                    }
                }
                catch
                {
                    string dir_path = Path.Combine(_downloadPath, dir_name);
                    Directory.CreateDirectory(dir_path);

                    await DownloadZipFile(dir_path, filename, shapefileUrl);

                    await Ag_Analytics_Module.AddLayerToMapAsync(Path.Combine(dir_path, filename + ".shp"));

                    if (_checkRasterizeShapefile)
                    {
                        ProgressMessage = "Rasterize...";

                        dynamic json = await RasterizeShapefile(dir_path, filename);

                        if (json == null)
                        {
                            //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed Rasterize Shapefile. Please try again.");
                            ResultErrorMessage += "\nFailed Rasterize Shapefile";
                            return;
                        }
                        try
                        {
                            foreach (dynamic item in json)
                            {
                                foreach (string fileUrl in item.raster)
                                {
                                    string ext = Path.GetExtension(fileUrl);
                                    string downloadFileName = filename + "_" + item.field + ext;
                                    await DownloadRasterizeFile(dir_path, downloadFileName, fileUrl);
                                    if (ext == ".tif")
                                    {
                                        await Ag_Analytics_Module.AddLayerToMapAsync(Path.Combine(dir_path, downloadFileName));
                                        await Ag_Analytics_Module.SetToClassifyColorizerFromLayerName(downloadFileName, 10, "Bathymetric Scale");
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed Rasterize Shapefile. Please try again.");
                            ResultErrorMessage += "\nFailed Rasterize Shapefile:";
                            ResultErrorMessage += e.Message;
                            return;
                        }
                    }
                }
            });
        }
        public async void SubmitExecute()
        {
            ValidationSubmitError = null;

            List <string> validationSubmitErrors = new List <string>();

            string aoi = null;

            if (_selectedAOILayer != null)
            {
                int featureCount = await QueuedTask.Run(() => { return(_selectedAOILayer.GetFeatureClass().GetCount()); });

                if (featureCount == 0)
                {
                    validationSubmitErrors.Add("AOI is empty.");
                }
                else
                {
                    aoi = await Ag_Analytics_Module.GetGeoJSONFromFeatureLayer(_selectedAOILayer);
                }
            }
            else
            {
                validationSubmitErrors.Add("AOI parameter must be selected.");
            }

            if (DateTime.Compare(_plantingDay1, _harvestDay) >= 0)
            {
                validationSubmitErrors.Add("PlantingDay1 must be earlier than HarvestDay.");
            }

            if (_downloadPath == null || string.IsNullOrEmpty(_downloadPath))
            {
                validationSubmitErrors.Add("Download path must be selected.");
            }
            else
            {
                if (!Directory.Exists(_downloadPath))
                {
                    validationSubmitErrors.Add("Download path doesn't exsist.");
                }
            }

            if (validationSubmitErrors.Count > 0)
            {
                ValidationSubmitError = string.Join("\n", validationSubmitErrors);
                return;
            }
            if (validationInputError != null)
            {
                return;
            }

            SubmitButtonEnabled = false;
            ResultBoxVisible    = "Hidden";
            ProgressVisible     = "Visible";
            ProgressMessage     = "Request Calling...";
            DateTime started_datetime = DateTime.Now;

            SubmitStartedTime  = started_datetime.ToString();
            ResultErrorMessage = "";

            IRestResponse apiResponse = await BackgroundTask.Run <IRestResponse>(() => {
                var client     = new RestClient("https://ag-analytics.azure-api.net/yieldforecast/");
                client.Timeout = -1;
                var request    = new RestRequest(Method.POST);

                request.AlwaysMultipartFormData = true;
                request.AddHeader("Content-Type", "application/json");
                //request.AddHeader("Ocp-Apim-Subscription-Key", "35520095b0a7408784e712e278d036a7");
                request.AddParameter("MODELNAME", _selectedModelName);
                request.AddParameter("SHAPE", aoi);

                var scalarVariables = new
                {
                    CropSeason     = _selectedCropSeason,
                    PlantingDay1   = String.Format("{0:M/d/yyyy}", _plantingDay1),
                    HarvestDay     = String.Format("{0:M/d/yyyy}", _harvestDay),
                    SeedingDensity = _seedingDensity
                };

                string scalarVariables_string = JsonConvert.SerializeObject(scalarVariables);

                request.AddParameter("ScalarVariables", scalarVariables_string);

                SubmitMODELNAME       = _selectedModelName;
                SubmitAOI             = aoi;
                SubmitScalarVariables = scalarVariables_string;
                SubmitDownloadFolder  = _downloadPath;

                IRestResponse response = client.Execute(request);

                return(response);
            }, BackgroundProgressor.None);

            if (!apiResponse.IsSuccessful)
            {
                //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(response.ErrorMessage);
                ResultErrorMessage += "Response Error\n";
                ResultErrorMessage += apiResponse.ErrorMessage;
                DisplayFailed(started_datetime);
                return;
            }

            dynamic jsonData = JsonConvert.DeserializeObject <dynamic>(apiResponse.Content);

            ProgressMessage = "Downloading file...";

            try
            {
                string filename = jsonData.raster_filename;
                await ExportFile(_downloadPath, filename);
            }
            catch (Exception e)
            {
                //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("No Result");
                ResultErrorMessage += "Download Error\n";
                ResultErrorMessage += e.Message;
                DisplayFailed(started_datetime);

                return;
            }

            ProgressVisible = "Hidden";
            DateTime ended_datetime = DateTime.Now;

            CompletedTime = ended_datetime.ToString();
            int seconds = (int)(ended_datetime.Subtract(started_datetime).TotalSeconds);

            ElapsedTime = seconds.ToString() + "  Seconds";

            ResultBoxBGColor    = "#3a593a";
            ResultBoxImage      = "pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/DataReviewerLifecycleVerified32.png";
            ResultBoxMessage    = "Completed";
            ResultErrorMessage  = "There are no errors or warnings.";
            ResultBoxVisible    = "Visible";
            SubmitButtonEnabled = true;
        }
        public async void SubmitExecute()
        {
            ValidationSubmitError = null;

            List <string> validationSubmitErrors = new List <string>();

            string aoi = null;

            if (_selectedAOILayer != null)
            {
                if (_selectedAOILayer is FeatureLayer)
                {
                    FeatureLayer lyr = _selectedAOILayer as FeatureLayer;

                    int featureCount = await QueuedTask.Run(() => { return(lyr.GetFeatureClass().GetCount()); });

                    if (featureCount == 0)
                    {
                        validationSubmitErrors.Add("AOI is empty.");
                    }
                    else
                    {
                        aoi = await Ag_Analytics_Module.GetGeoJSONFromFeatureLayer(lyr);
                    }
                }
                else if (_selectedAOILayer is RasterLayer)
                {
                    RasterLayer lyr            = _selectedAOILayer as RasterLayer;
                    string      default_path   = Path.GetDirectoryName(Project.Current.URI);
                    string      timestamp      = DateTime.Now.ToString("yyyyMMddHHmmss");
                    string      rasterFileName = "AOI_Raster_" + timestamp + ".tif";
                    string      outputRaster   = Path.Combine(default_path, rasterFileName);
                    var         parameters     = Geoprocessing.MakeValueArray(lyr.Name, outputRaster, "", "", "", false, false, "", false, false, "TIFF");
                    IGPResult   result         = await Geoprocessing.ExecuteToolAsync("management.CopyRaster", parameters, null, null, null, GPExecuteToolFlags.None);

                    aoi = outputRaster;
                }
            }
            else
            {
                validationSubmitErrors.Add("AOI parameter must be selected.");
            }

            if (_downloadPath == null || string.IsNullOrEmpty(_downloadPath))
            {
                validationSubmitErrors.Add("Download path must be selected.");
            }
            else
            {
                if (!Directory.Exists(_downloadPath))
                {
                    validationSubmitErrors.Add("Download path doesn't exsist.");
                }
            }

            SpatialReference outputSpatialReference = null;

            if (selectedSpatialReference == null)
            {
                outputSpatialReference = await QueuedTask.Run(() => { return(_selectedAOILayer.GetSpatialReference()); });
            }
            else
            {
                outputSpatialReference = selectedSpatialReference;
            }

            if (outputSpatialReference.IsGeographic && _cellSize > 1)
            {
                validationSubmitErrors.Add("Resolution must be < 1 in geographic coordinate system(ex:0.0001)");
            }
            else if (outputSpatialReference.IsProjected && _cellSize < 1)
            {
                validationSubmitErrors.Add("Resolution must be > 1 in projected coordinate system(ex:10)");
            }

            if (validationSubmitErrors.Count > 0)
            {
                ValidationSubmitError = string.Join("\n", validationSubmitErrors);
                return;
            }
            if (validationInputError != null)
            {
                return;
            }

            SubmitButtonEnabled = false;
            ResultBoxVisible    = "Hidden";
            ProgressMessage     = "Request Calling...";
            ProgressVisible     = "Visible";
            DateTime started_datetime = DateTime.Now;

            SubmitStartedTime  = started_datetime.ToString();
            ResultErrorMessage = "";

            IRestResponse apiResponse = await BackgroundTask.Run <IRestResponse>(() => {
                var client     = new RestClient("https://ag-analytics.azure-api.net/dem-service/");
                client.Timeout = -1;
                var request    = new RestRequest(Method.POST);

                request.AlwaysMultipartFormData = true;
                //request.AddHeader("Content-Type", "application/x-www-form-urlencoded");

                if (_selectedAOILayer is FeatureLayer)
                {
                    request.AddParameter("aoi", aoi);
                }
                else if (_selectedAOILayer is RasterLayer)
                {
                    request.AddFile("aoi", aoi);
                }

                request.AddParameter("Resolution", _cellSize);
                request.AddParameter("Elevation_Index", _checkElevationIndex ? "True" : "False");


                request.AddParameter("Projection", string.Format("EPSG:{0}", outputSpatialReference.GcsWkid));

                // these parameter options no need on ArcGIS pro
                request.AddParameter("Legend_Ranges", 3);

                SubmitAOI            = aoi;
                SubmitResolution     = _cellSize.ToString();
                SubmitElevationIndex = _checkElevationIndex ? "True" : "False";
                SubmitProjection     = string.Format("EPSG:{0}", outputSpatialReference.GcsWkid);
                SubmitDownloadFolder = _downloadPath;

                IRestResponse response = client.Execute(request);

                return(response);
            }, BackgroundProgressor.None);

            if (File.Exists(aoi))
            {
                string   default_path  = Path.GetDirectoryName(Project.Current.URI);
                string   filesToDelete = Path.GetFileNameWithoutExtension(aoi) + ".*";
                string[] fileList      = Directory.GetFiles(default_path, filesToDelete);
                foreach (string file in fileList)
                {
                    File.Delete(file);
                }
            }

            if (!apiResponse.IsSuccessful)
            {
                //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed Result. Please try again.");
                ResultErrorMessage += "Response Error\n";
                ResultErrorMessage += apiResponse.ErrorMessage;
                DisplayFailed(started_datetime);

                return;
            }

            dynamic jsonData = JsonConvert.DeserializeObject <dynamic>(apiResponse.Content);

            // download elevation files
            ProgressMessage = "Downloading tif files...";
            try
            {
                string filename = jsonData.FileName;
                await ExportFile(_downloadPath, filename);
            }
            catch (Exception e)
            {
                //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("API Error. Please try again.");
                ResultErrorMessage += "Download Error\n";
                ResultErrorMessage += e.Message;
                DisplayFailed(started_datetime);

                return;
            }

            // if return elevation index
            if (_checkElevationIndex)
            {
                try
                {
                    var Index_Files_list = jsonData.Index_Files;
                    for (int i = 0; i < Index_Files_list.Count; i++)
                    {
                        string index_filename = Index_Files_list[i];

                        await ExportFile(_downloadPath, index_filename);
                    }
                }
                catch (Exception e)
                {
                    //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("No Elevation Index returned. Please try again.");
                    ResultErrorMessage += "Download Error\n";
                    ResultErrorMessage += e.Message;
                    DisplayFailed(started_datetime);

                    return;
                }
            }

            ProgressVisible = "Hidden";
            ProgressMessage = "";
            DateTime ended_datetime = DateTime.Now;

            CompletedTime = ended_datetime.ToString();
            int seconds = (int)(ended_datetime.Subtract(started_datetime).TotalSeconds);

            ElapsedTime = seconds.ToString() + "  Seconds";

            ResultBoxBGColor    = "#3a593a";
            ResultBoxImage      = "pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/DataReviewerLifecycleVerified32.png";
            ResultBoxMessage    = "Completed";
            ResultErrorMessage  = "There are no errors or warnings.";
            ResultBoxVisible    = "Visible";
            SubmitButtonEnabled = true;
        }