-
Notifications
You must be signed in to change notification settings - Fork 521
/
TokenSecuredChallenge.xaml
111 lines (108 loc) · 5.17 KB
/
TokenSecuredChallenge.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<UserControl x:Class="ArcGIS.WinUI.Samples.TokenSecuredChallenge.TokenSecuredChallenge"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
xmlns:local="using:ArcGIS.WinUI.Samples.TokenSecuredChallenge">
<UserControl.Resources>
<local:LoadStatusToColorConverter x:Key="StatusToColor" />
</UserControl.Resources>
<Grid x:Name="layoutGrid">
<esriUI:MapView x:Name="MyMapView" />
<!-- Layer listing with status -->
<Border Style="{StaticResource BorderStyle}">
<StackPanel>
<TextBlock Margin="4"
FontSize="14"
FontWeight="Bold"
Text="Map Layers (with status)"
TextAlignment="Center" />
<StackPanel x:Name="PublicLayerPanel"
Margin="10,5"
Orientation="Horizontal">
<TextBlock Text="{Binding Name}" />
<TextBlock Margin="10,0"
Foreground="{Binding LoadStatus, Converter={StaticResource StatusToColor}}"
Text="{Binding LoadStatus}" />
</StackPanel>
<StackPanel x:Name="SecureLayerPanel"
Margin="10,5"
Orientation="Horizontal">
<TextBlock Text="{Binding Name}" />
<TextBlock Margin="10,0"
Foreground="{Binding LoadStatus, Converter={StaticResource StatusToColor}}"
Text="{Binding LoadStatus}" />
</StackPanel>
</StackPanel>
</Border>
<!-- Login UI -->
<Border x:Name="loginPanel"
HorizontalAlignment="Left"
Style="{StaticResource BorderStyle}"
Visibility="Collapsed">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,8"
Text="{Binding ServiceUrl}"
TextWrapping="Wrap" />
<TextBlock Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,8"
FontWeight="SemiBold"
Text="Username and Password are user1/user1"
TextWrapping="Wrap" />
<TextBlock Grid.Row="2"
Grid.Column="0"
Margin="2"
VerticalAlignment="Center"
Text="Username" />
<TextBox Grid.Row="2"
Grid.Column="1"
Margin="2"
Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="3"
Grid.Column="0"
Margin="2"
VerticalAlignment="Center"
Text="Password" />
<!--
For simplicity, the password is visible in this example. You can use a PasswordBox to mask the password text,
but it complicates data binding. See this discussion for details: http://stackoverflow.com/questions/1483892/how-to-bind-to-a-passwordbox-in-mvvm
-->
<TextBox Grid.Row="3"
Grid.Column="1"
Margin="2"
Text="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Button Grid.Row="4"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,12,0,0"
HorizontalAlignment="Stretch"
Click="LoginButtonClick"
Content="Login and load layer" />
<TextBlock x:Name="ErrorMessageTextBlock"
Grid.Row="5"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="8,12,8,0"
Foreground="Red"
Text="{Binding ErrorMessage}"
TextWrapping="Wrap" />
</Grid>
</Border>
</Grid>
</UserControl>