Пример #1
0
        private void execute(object commandParameter)
        {
            paramsScroller.IsEnabled = false;
            IsExecuting = true;
            HasResults  = false;
            setResults(null);
            RaiseCanExecuteChanged();
            gp         = new Client.Tasks.Geoprocessor(ServiceEndpoint.AbsoluteUri);
            gp.Failed += gp_Failed;
            List <ESRI.ArcGIS.Client.Tasks.GPParameter> inputValues = new List <ESRI.ArcGIS.Client.Tasks.GPParameter>();

            InputLayers = new Dictionary <string, string>();
            foreach (ParameterSupport.ParameterBase param in InputParameters)
            {
                if (param.Value != null)
                {
                    inputValues.Add(param.Value);
                }
                if (param is ParameterSupport.FeatureLayerParameterBase)
                {
                    ParameterSupport.FeatureLayerParameterBase flParam = param as ParameterSupport.FeatureLayerParameterBase;
                    if (!string.IsNullOrEmpty(flParam.InputLayerID))
                    {
                        InputLayers.Add(flParam.Config.Name, flParam.InputLayerID);
                    }
                }
            }
            gp.OutputSpatialReference = Map.SpatialReference;

            // Initialize proxy
            gp.ProxyURL = Configuration.UseProxy ? Configuration.ProxyUrl : null;

            if (ServiceInfo.ExecutionType == "esriExecutionTypeAsynchronous")
            {
                gp.StatusUpdated     += gp_StatusUpdated;
                gp.JobCompleted      += gp_JobCompleted;
                asyncResults          = new List <GPParameter>();
                resultRequestedParams = new List <string>();
                asyncErrors           = new List <Exception>();
                gp.SubmitJobAsync(inputValues);
            }
            else
            {
                gp.ExecuteCompleted += gp_ExecuteCompleted;
                gp.ExecuteAsync(inputValues);
            }
        }
Пример #2
0
        private void execute(object commandParameter)
        {
            paramsScroller.IsEnabled = false;
            IsExecuting = true;
            HasResults = false;
            setResults(null);
            RaiseCanExecuteChanged();
            gp = new Client.Tasks.Geoprocessor(ServiceEndpoint.AbsoluteUri);
            gp.Failed += gp_Failed;
            List<ESRI.ArcGIS.Client.Tasks.GPParameter> inputValues = new List<ESRI.ArcGIS.Client.Tasks.GPParameter>();
            InputLayers = new Dictionary<string,string>();
            foreach (ParameterSupport.ParameterBase param in InputParameters)
            {
                if (param.Value != null)
                    inputValues.Add(param.Value);
                if (param is ParameterSupport.FeatureLayerParameterBase)
                {
                    ParameterSupport.FeatureLayerParameterBase flParam = param as ParameterSupport.FeatureLayerParameterBase;
                    if (!string.IsNullOrEmpty(flParam.InputLayerID))
                        InputLayers.Add(flParam.Config.Name, flParam.InputLayerID);
                }
            }
            gp.OutputSpatialReference = Map.SpatialReference;

            // Initialize proxy
            gp.ProxyURL = Configuration.UseProxy ? Configuration.ProxyUrl : null;

            if (ServiceInfo.ExecutionType == "esriExecutionTypeAsynchronous")
            {
                gp.StatusUpdated += gp_StatusUpdated;
                gp.JobCompleted += gp_JobCompleted;
                asyncResults = new List<GPParameter>();
                resultRequestedParams = new List<string>();
                asyncErrors = new List<Exception>();
                gp.SubmitJobAsync(inputValues);
            }
            else
            {
                gp.ExecuteCompleted += gp_ExecuteCompleted;
                gp.ExecuteAsync(inputValues);
            }
        }