private void initializeBrowsePage()
        {
            // Create browse control
            browseDialog = new BrowseContentDialog()
            {
                Filter              = Core.DataSources.Filter.GeoprocessingServices,
                DataSourceProvider  = ViewUtility.GetDataSourceProvider(),
                ConnectionsProvider = ViewUtility.GetConnectionsProvider(),
                Style = ResourceUtility.LoadEmbeddedStyle("Themes/GPBrowseStyle.xaml", "GPBrowseStyle"),
                SelectedResourceUrl = configuration != null && configuration.TaskEndPoint != null ?
                                      configuration.TaskEndPoint.AbsoluteUri : null,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment          = VerticalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Stretch
            };

            if (configuration != null)
            {
                browseDialog.ShowRestrictedServices = configuration.UseProxy;
            }

            // Encapsulate browse control in a wizard page
            browsePage = new WizardPage()
            {
                Content = browseDialog,
                Heading = ESRI.ArcGIS.Mapping.GP.Resources.Strings.BrowseToGP,
            };

            // Bind the selected resource URL of the browse control to whether the input
            // of the browse page is valid.  Validation state will be updated when the
            // selected resource is updated.
            Binding b = new Binding("SelectedResourceUrl")
            {
                Source    = browseDialog,
                Converter = new IsNotNullOrEmptyConverter()
            };

            BindingOperations.SetBinding(browsePage, WizardPage.InputValidProperty, b);

            // When a new GP task is selected, wire handler to retrieve info from service endoint
            browseDialog.SelectedResourceChanged += GPTaskEndpoint_Changed;
        }
Exemplo n.º 2
0
        private void BuildUI()
        {
            if (ParamContainer == null)
            {
                return;
            }
            if (ServiceInfo != null && Configuration == null)
            {
                Configuration = new GPConfiguration();
                Configuration.LoadConfiguration(ServiceInfo, ServiceEndpoint);
                return;
            }
            else if (Configuration != null && ServiceEndpoint == null)
            {
                ServiceEndpoint = Configuration.TaskEndPoint;
            }
            paramsScroller.IsEnabled = true;
            if (isLoading)
            {
                ParamContainer.Children.Clear();
                ParamContainer.Children.Add(new TextBlock()
                {
                    Text = ESRI.ArcGIS.Mapping.GP.Resources.Strings.Loading, FontWeight = System.Windows.FontWeights.Bold
                });
            }
            else if (Configuration != null)
            {
                double size = ViewUtility.GetViewHeight() - 325;
                paramsScroller.MaxHeight = size < 100 ? 100 : size;
                size = ViewUtility.GetViewWidth() - 200;
                paramsScroller.MaxWidth = size < 100 ? 100 : size;
                if (paramsScroller.MaxWidth > 500)
                {
                    paramsScroller.MaxWidth = 500;
                }
                ParamContainer.Children.Clear();
                ParamContainer.ColumnDefinitions.Clear();
                ParamContainer.RowDefinitions.Clear();
                ParamContainer.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = GridLength.Auto
                });
                ParamContainer.ColumnDefinitions.Add(new ColumnDefinition());// { Width = new GridLength(0, GridUnitType.Star) });
                InputParameters.Clear();

                foreach (ParameterSupport.ParameterConfig config in Configuration.InputParameters)
                {
                    ParameterSupport.ParameterBase parameter = ParameterSupport.ParameterFactory.Create(config, Map);
                    if (parameter != null)
                    {
                        parameter.CanExecuteChanged += parameter_CanExecuteChanged;
                        InputParameters.Add(parameter);
                        if (config.ShownAtRunTime)
                        {
                            ParamContainer.RowDefinitions.Add(new RowDefinition());
                            TextBlock label = new TextBlock()
                            {
                                Text = config.Label,
                                VerticalAlignment = System.Windows.VerticalAlignment.Center,
                                Padding           = new Thickness(2, 0, 2, 0)
                            };
                            label.SetValue(Grid.RowProperty, ParamContainer.RowDefinitions.Count - 1);
                            //if (config.Required)
                            //    label.Text += "*";
                            ParamContainer.Children.Add(label);
                            parameter.AddUI(ParamContainer);
                        }
                    }
                }
            }
        }