Richie 的个人资料The Sandpit - "We hack s...日志列表 工具 帮助
4月15日

ArcGIS Server Explorer for Silverlight

The ArcGIS Server Explorer is a new contribution on the ESRI Code Gallery for dynamically generating a catalog of map services.  The Silverlight control supports multiple servers.  The contribution includes a sample web application that will preview map services selected in the treeviewClick here to view the live sample.  The explorer control is based on the TreeView from the Silverlight 2 Toolkit.

ArcGIS Server Explorer for Silverlight

The snippet below demonstrates how to add a reference the ArcGIS Server Explorer control into a web application.  The web application is listening to the page load event and the event that is raised when a user clicks on a map service.

<UserControl
    x:Class="ServerExplorerSample.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:esri="clr-namespace:ESRI.ArcGIS;assembly=ESRI.ArcGIS"
    xmlns:se="clr-namespace:ESRI.ArcGIS.ServerExplorer;assembly=ESRI.ArcGIS.ServerExplorer"
    Loaded="UserControl_Loaded"
    >
    <Grid>
        <se:ServerTreeView x:Name="serverTreeView" LayerClicked="ServerTreeView_LayerClicked" />
    </Grid>
</UserControl>

In this example, the page load event is used to add a reference to a public ArcGIS Server, namely, ArcGIS Online.  You can only add a reference to local server if you are hosting the web application on your intranet.  This is a Silverlight security limitation.

private void UserControl_Loaded(object sender, RoutedEventArgs e) {
    Uri uri = new Uri("http://services.arcgisonline.com/arcgis/rest/services");
    Server server = new Server(uri, "ArcGIS Online");
    this.serverTreeView.Servers.Add(server);
}

And finally, the snippet below demonstrates how the web application is responding to the a clicked map service.  The event handler contains a reference to a layer object that can be added directly to an Silverlight map control.

private void ServerTreeView_LayerClicked(object sender, LayerEventArgs e) {
    // Add Selected Layer
    this.map.Layers.Clear();
    e.Layer.Initialized += (evtsender, args) => {
        this.map.ZoomTo(e.Layer.InitialExtent);
    };
    this.map.Layers.Add(e.Layer);
}

评论

请稍候...
很抱歉,您输入的评论太长。请缩短您的评论。
您没有输入任何内容,请重试。
很抱歉,我们当前无法添加您的评论。请稍后重试。
若要添加评论,需要您的家长授予您相应权限。请求权限
您的家长禁用了评论功能。
很抱歉,我们当前无法删除您的评论。请稍后重试。
您已超过了一天之内允许提供的评论数上限。请在 24 小时后重试。
因为我们的系统表明您可能在向其他用户提供垃圾评论,您的帐户已禁用了评论功能。如果您认为我们错误地禁用了您的帐户,请联系 Windows Live 支持部门
完成下面的安全检查,您提供评论的过程才能完成。
您在安全检查中键入的字符必须与图片或音频中的字符一致。
Carmichael​Richie 在此页禁用了评论功能。

引用通告

引用此项的网络日志