コード例 #1
0
 protected virtual void OnGetCatalogCompleted(GetCatalogCompletedEventArgs args)
 {
     if (GetCatalogCompleted != null)
     {
         GetCatalogCompleted(this, args);
     }
 }
コード例 #2
0
 protected virtual void OnGetCatalogCompleted(GetCatalogCompletedEventArgs args)
 {
     if (GetCatalogCompleted != null)
         GetCatalogCompleted(this, args);
 }
コード例 #3
0
 protected void OnGetCatalogRequestCompleted(GetCatalogCompletedEventArgs args)
 {
     if (GetCatalogCompleted != null)
         GetCatalogCompleted(this, args);
 }       
コード例 #4
0
        void dataSource_GetCatalogCompleted(object sender, GetCatalogCompletedEventArgs e)
        {
            enableDisableUrlEntryUI(false);

            object[] userState = e.UserState as object[];
            if (userState == null || userState.Length < 2)
                return;

            Connection connection = userState[0] as Connection;
            if (connection == null)
                return;

            if (e.ChildResources == null)
                return;

            if (treeResources == null)
                return;

            ESRI.ArcGIS.Mapping.Core.DataSources.DataSource ds = DataSourceProvider.CreateNewDataSourceForConnectionType(connection.ConnectionType);
            if (ds == null)
                return;

            IDataSourceWithResources dsWithResource = ds as IDataSourceWithResources;

            treeResources.Items.Clear();

            foreach (Resource childResource in e.ChildResources)
            {
                TreeViewItem treeViewItem = new TreeViewItem
                {
                    HeaderTemplate = LayoutRoot != null ? LayoutRoot.Resources["ResourceNodeDataTemplate"] as DataTemplate : null,
                    Header = childResource,
                    DataContext = childResource,
                    IsExpanded = false,
                    Style = LayoutRoot != null ? LayoutRoot.Resources["TreeViewItemStyle"] as Style : null,
                };
                if(!string.IsNullOrWhiteSpace(childResource.DisplayName))
                    treeViewItem.SetValue(System.Windows.Automation.AutomationProperties.AutomationIdProperty, childResource.DisplayName);
                
                treeViewItem.SetValue(TreeViewItemExtensions.ConnectionProperty, connection);
                if (dsWithResource != null && dsWithResource.SupportsChildResources(childResource, filter))
                {
                    treeViewItem.Items.Add(createRetrievingNode());
                    treeViewItem.Expanded += new RoutedEventHandler(resourceNode_Expanded);
                }
                treeResources.Items.Add(treeViewItem);
            }

            showHideProgressIndicator(true);
            bool addConnection = true;
            if (treeResources.Items.Count == 0)
            {
                if(!string.IsNullOrEmpty(e.Error))
                    MessageBoxDialog.Show(e.Error, ESRI.ArcGIS.Mapping.Controls.Resources.Strings.BrowseDialogGeographicDataNotFound, MessageBoxButton.OK);
                else if ((Filter & Filter.GeoprocessingServices) == Filter.GeoprocessingServices)
                    MessageBoxDialog.Show(string.Format(LocalizableStrings.NoGPServicesFound, connection.Name));
                else
                    MessageBoxDialog.Show(string.Format(LocalizableStrings.NoMapServicesFound, connection.Name));
                addConnection = false;
            }

            OnGetCatalogCompleted(e);
            bool isNewConnection = (bool)userState[1];
            if (isNewConnection)
            {
                if (addConnection)
                {
                    Connections.Add(connection);
                    if (ConnectionsProvider != null)
                        ConnectionsProvider.AddConnection(connection); // inform the provider about the new connection
                    OnConnectionAdded(new ConnectionAddedEventArgs() { Connection = connection });
                }
            }
        }