Did Chris' suggestion work for you?
http://beta.esri.com/community/[/URL]
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <Grid x:Name="LayoutRoot" Background="White"> <esri:Map Name="MyMap" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000"> <esri:ArcGISTiledMapServiceLayer ID="Street Map" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> </esri:Map> <esri:MapProgressBar x:Name="MyProgressBar" Map="{Binding ElementName=MyMap}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="200" Height="36" Margin="25" /> <Grid Name="LoginGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0"> <Rectangle Stroke="Gray" RadiusX="10" RadiusY="10" Fill="LightGray" Margin="-10" > <Rectangle.Effect> <DropShadowEffect/> </Rectangle.Effect> </Rectangle> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock Text="Username" Grid.Column="0" Grid.Row="0" Margin="2" VerticalAlignment="Center" /> <TextBox Name="UserTextBox" Text=" " HorizontalAlignment="Right" Margin="2" Grid.Column="1" Grid.Row="0" Width="140" /> <TextBlock Text="Password" Grid.Column="0" Grid.Row="1" Margin="2" VerticalAlignment="Center" /> <!-- Yes, the password is visible in this example. Use a PasswordBox to mask the password text. --> <!--<PasswordBox Name="PasswordTextBox" HorizontalAlignment="Right" Margin="2" Grid.Column="1" Grid.Row="1" Width="140" />--> <TextBox Name="PasswordTextBox" Text=" " HorizontalAlignment="Right" Margin="2" Grid.Column="1" Grid.Row="1" Width="140" /> <Button Name="LoginLoadLayerButton" Content="Login and Load Layer" Width="140" Margin="0,5,0,10" HorizontalAlignment="Center" Grid.Row="2" Grid.ColumnSpan="2" Click="LoginLoadLayerButton_Click" /> </Grid> </Grid> <StackPanel x:Name="EditorToolStrip" Margin="0,5,5,0" > <Border Background="#00919191" CornerRadius="5" HorizontalAlignment="Right" VerticalAlignment="Top" Padding="5" BorderBrush="Transparent"> <Border.Effect> <DropShadowEffect Color="Black" Direction="-45" BlurRadius="20" Opacity=".75" /> </Border.Effect> <StackPanel Orientation="Vertical" HorizontalAlignment="Right" Margin="0,5,5,0" VerticalAlignment="Top" > <esri:EditorWidget x:Name="MyEditorWidget" Map="{Binding ElementName=MyMap}" Width="300" AutoSelect="False" AlwaysDisplayDefaultTemplates="True" GeometryServiceUrl="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" ShowAttributesOnAdd="True" Loaded="EditorWidget_Loaded"/> </StackPanel> </Border> </StackPanel> </Grid> </UserControl>
using System.Windows.Controls; using ESRI.ArcGIS.Client; using System.Windows; using System; using System.Windows.Threading; namespace Secure3 { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } private void LoginLoadLayerButton_Click(object sender, System.Windows.RoutedEventArgs e) { ESRI.ArcGIS.Client.TokenManager tokenManager = new ESRI.ArcGIS.Client.TokenManager() { UserName = UserTextBox.Text, Password = PasswordTextBox.Text, TokenSource = "https://xyz/arcgis/tokens", AutoRefreshing = true, Expiration = 5 }; tokenManager.RequestTokenCompleted += (s, a) => { if (a.Error == null) { LoginGrid.Visibility = System.Windows.Visibility.Collapsed; MyMap.Layers.Add(new FeatureLayer() { Url = "http://xyz/ArcGIS/rest/services/secure/Water_Utilites_Job_Log/FeatureServer/0", Token = a.Token, ID = "Job_Points" }); } else { MessageBox.Show("Error: " + a.Error); } }; tokenManager.RequestTokenAsync(); } private void EditorWidget_Loaded(object sender, RoutedEventArgs e) { string[] myLayerIDs = { "Job_Points" }; MyEditorWidget.LayerIDs = myLayerIDs; } } }
QueryTask queryTask = new QueryTask("http://myGISserver/ArcGIS/rest/services/secure/Water_Utilites_Job_Log/MapServer/0"); queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted; queryTask.Failed += QueryTask_Failed; queryTask.Token = theToken;
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.