private async Task GetServiceInfo()
        {
            var    t       = new Geoprocessor(new Uri(ServiceUri));
            string message = null;

            try
            {
                var result = await t.GetTaskInfoAsync();

                #region Display Service Info
                var sb = new StringBuilder();
                if (result != null)
                {
                    sb.Append("{");
                    sb.AppendLine(string.Format("\t\"name\" : \"{0}\",", result.Name));
                    sb.AppendLine(string.Format("\t\"displayName\" : \"{0}\",", result.DisplayName));
                    sb.AppendLine(string.Format("\t\"category\" : \"{0}\",", result.Category));
                    sb.AppendLine(string.Format("\t\"helpUrl\" : \"{0}\",", result.HelpUrl));
                    sb.AppendLine(string.Format("\t\"executionType\" : \"esriExecutionType{0}\",", result.ExecutionType));
                    sb.AppendLine("\t\"parameters\" : [");
                    foreach (var p in result.Parameters)
                    {
                        sb.AppendLine("\t{");
                        sb.AppendLine(string.Format("\t\t\"name\" : \"{0}\",", p.Name));
                        sb.AppendLine(string.Format("\t\t\"dataType\" : \"{0}\",", p.DataType));
                        sb.AppendLine(string.Format("\t\t\"displayName\" : \"{0}\",", p.DisplayName));
                        sb.AppendLine(string.Format("\t\t\"direction\" : \"esriGPParameterDirection{0}\",", p.Direction));
                        sb.AppendLine(string.Format("\t\t\"defaultValue\" : \"{0}\",", p.DefaultValue));
                        sb.AppendLine(string.Format("\t\t\"parameterType\" : \"esriGPParameterType{0}\",", p.ParameterType));
                        sb.AppendLine(string.Format("\t\t\"category\" : \"{0}\"", p.Category));
                        if (p.ChoiceList != null)
                        {
                            sb.AppendLine("\t\t\"choiceList\" : [");
                            foreach (var c in p.ChoiceList)
                            {
                                sb.AppendLine(string.Format("\t\t\t\"{0}\"", c));
                            }

                            sb.AppendLine("\t\t\"]");
                        }
                        sb.AppendLine("\t},");
                    }
                    sb.AppendLine("\t]");
                    sb.Append("}");
                    message = sb.ToString();
                }
                #endregion
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            if (message != null)
            {
                await new MessageDialog(message, "Service Info").ShowAsync();
            }
        }
        // Display service info
        private async void GetServiceInfo()
        {
            string message = null;

            try
            {
                var result = await _gpTask.GetTaskInfoAsync();

                var sb = new StringBuilder();
                if (result != null)
                {
                    sb.Append("{");
                    sb.AppendLine(string.Format("\t\"name\" : \"{0}\",", result.Name));
                    sb.AppendLine(string.Format("\t\"displayName\" : \"{0}\",", result.DisplayName));
                    sb.AppendLine(string.Format("\t\"category\" : \"{0}\",", result.Category));
                    sb.AppendLine(string.Format("\t\"helpUrl\" : \"{0}\",", result.HelpUrl));
                    sb.AppendLine(string.Format("\t\"executionType\" : \"esriExecutionType{0}\",", result.ExecutionType));
                    sb.AppendLine("\t\"parameters\" : [");
                    foreach (var p in result.Parameters)
                    {
                        sb.AppendLine("\t{");
                        sb.AppendLine(string.Format("\t\t\"name\" : \"{0}\",", p.Name));
                        sb.AppendLine(string.Format("\t\t\"dataType\" : \"{0}\",", p.DataType));
                        sb.AppendLine(string.Format("\t\t\"displayName\" : \"{0}\",", p.DisplayName));
                        sb.AppendLine(string.Format("\t\t\"direction\" : \"esriGPParameterDirection{0}\",", p.Direction));
                        sb.AppendLine(string.Format("\t\t\"defaultValue\" : \"{0}\",", p.DefaultValue));
                        sb.AppendLine(string.Format("\t\t\"parameterType\" : \"esriGPParameterType{0}\",", p.ParameterType));
                        sb.AppendLine(string.Format("\t\t\"category\" : \"{0}\"", p.Category));
                        if (p.ChoiceList != null)
                        {
                            sb.AppendLine("\t\t\"choiceList\" : [");
                            foreach (var c in p.ChoiceList)
                            {
                                sb.AppendLine(string.Format("\t\t\t\"{0}\"", c));
                            }

                            sb.AppendLine("\t\t\"]");
                        }
                        sb.AppendLine("\t},");
                    }
                    sb.AppendLine("\t]");
                    sb.Append("}");

                    message = sb.ToString();
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            MessageBox.Show(message, "Service Info");
        }
Пример #3
0
        // Sets up UI choices from the extract data service information
        private async void SetupUI()
        {
            try
            {
                var info = await _gpTask.GetTaskInfoAsync();

                listLayers.ItemsSource = info.Parameters.First(p => p.Name == "Layers_to_Clip").ChoiceList;

                comboFormat.ItemsSource = info.Parameters.First(p => p.Name == "Feature_Format").ChoiceList;
                if (comboFormat.ItemsSource != null && comboFormat.Items.Count > 0)
                {
                    comboFormat.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
            }
        }
        private async Task GetServiceInfo()
        {
            var t = new Geoprocessor(new Uri(ServiceUri));
            string message = null;
            try
            {
                var result = await t.GetTaskInfoAsync();
                #region Display Service Info
                var sb = new StringBuilder();
                if (result != null)
                {
                    sb.Append("{");
                    sb.AppendLine(string.Format("\t\"name\" : \"{0}\",", result.Name));
                    sb.AppendLine(string.Format("\t\"displayName\" : \"{0}\",", result.DisplayName));
                    sb.AppendLine(string.Format("\t\"category\" : \"{0}\",", result.Category));
                    sb.AppendLine(string.Format("\t\"helpUrl\" : \"{0}\",", result.HelpUrl));
                    sb.AppendLine(string.Format("\t\"executionType\" : \"esriExecutionType{0}\",", result.ExecutionType));
                    sb.AppendLine("\t\"parameters\" : [");
                    foreach (var p in result.Parameters)
                    {
                        sb.AppendLine("\t{");
                        sb.AppendLine(string.Format("\t\t\"name\" : \"{0}\",", p.Name));
                        sb.AppendLine(string.Format("\t\t\"dataType\" : \"{0}\",", p.DataType));
                        sb.AppendLine(string.Format("\t\t\"displayName\" : \"{0}\",", p.DisplayName));
                        sb.AppendLine(string.Format("\t\t\"direction\" : \"esriGPParameterDirection{0}\",", p.Direction));
                        sb.AppendLine(string.Format("\t\t\"defaultValue\" : \"{0}\",", p.DefaultValue));
                        sb.AppendLine(string.Format("\t\t\"parameterType\" : \"esriGPParameterType{0}\",", p.ParameterType));
                        sb.AppendLine(string.Format("\t\t\"category\" : \"{0}\"", p.Category));
                        if (p.ChoiceList != null)
                        {
                            sb.AppendLine("\t\t\"choiceList\" : [");
                            foreach (var c in p.ChoiceList)
                                sb.AppendLine(string.Format("\t\t\t\"{0}\"", c));

                            sb.AppendLine("\t\t\"]");
                        }
                        sb.AppendLine("\t},");
                    }
                    sb.AppendLine("\t]");
                    sb.Append("}");
                    message = sb.ToString();
                }
                #endregion
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            if (message != null)
                await new MessageDialog(message, "Service Info").ShowAsync();
        }