This repository has been archived by the owner on Dec 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
SignInWindow.xaml
299 lines (285 loc) · 9.55 KB
/
SignInWindow.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<Window
x:Class="SpecklePopup.SignInWindow"
xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="https://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SpecklePopup"
xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vc="clr-namespace:SpecklePopup.ValueConverters"
Title="Speckle Accounts"
Width="400"
MinWidth="300"
MinHeight="400"
HorizontalAlignment="Center"
d:DataContext="{d:DesignData d:Source=/DesignData/SampleAccouts.xaml}"
AutomationProperties.Name="Speckle SignIn"
Icon="Resources/speckle.ico"
SizeToContent="Height"
mc:Ignorable="d">
<Window.CommandBindings>
<CommandBinding Command="{x:Static local:Commands.RemoveAccount}" Executed="RemoveAccount_Executed" />
</Window.CommandBindings>
<Window.Resources>
<vc:BoolToCollapsed
x:Key="BoolToCollapsed"
FalseValue="Collapsed"
TrueValue="Visible" />
<DataTemplate x:Key="SpeckleAccountTemplateSimple">
<StackPanel Margin="10" HorizontalAlignment="Stretch">
<TextBlock
Grid.Column="0"
FontSize="14"
Text="{Binding RestApi}" />
<StackPanel Orientation="Horizontal">
<TextBlock
FontSize="10"
Foreground="DimGray"
Text="{Binding Email}" />
<TextBlock
FontSize="10"
Foreground="DimGray"
Text=" | " />
<TextBlock
FontSize="10"
Foreground="DimGray"
Text="{Binding ServerName}" />
</StackPanel>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="SpeckleAccountTemplate">
<StackPanel Margin="10" HorizontalAlignment="Stretch">
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
FontSize="14"
Text="{Binding RestApi}" />
<Button
Grid.Column="1"
Width="15"
Height="15"
Margin="0"
Padding="0"
VerticalAlignment="Top"
VerticalContentAlignment="Top"
Command="{x:Static local:Commands.RemoveAccount}"
CommandParameter="{Binding}"
Content="×"
Cursor="Hand"
FontFamily="Impact"
ToolTip="Remove account">
<Button.Style>
<Style BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
<StackPanel Orientation="Horizontal">
<TextBlock
FontSize="10"
Foreground="DimGray"
Text="{Binding Email}" />
<TextBlock
FontSize="10"
Foreground="DimGray"
Text=" | " />
<TextBlock
FontSize="10"
Foreground="DimGray"
Text="{Binding ServerName}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image
Grid.Row="0"
Grid.Column="0"
Margin="35,15,5,6"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Source="Resources/speckle60x50.png"
Stretch="None" />
<Label
Grid.Column="1"
VerticalAlignment="Bottom"
Content="Speckle"
FontFamily="Segoe UI Light"
FontSize="36" />
<Label
Grid.Row="1"
Grid.Column="1"
Content="the open source data platform for AEC."
FontSize="10"
Foreground="Gray" />
<Grid
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="20,0,20,20"
Visibility="{Binding Path=showMainLogin, Converter={StaticResource BoolToCollapsed}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- DEFAULT ACCOUNT -->
<StackPanel Grid.Row="0">
<Label
Margin="0,10"
HorizontalAlignment="Center"
HorizontalContentAlignment="Stretch"
Content="Default Account"
FontSize="22" />
<TextBlock
Margin="5"
FontSize="10"
Foreground="Gray"
TextWrapping="Wrap">
Default account used when creating a new sender or receiver.
If not set you'll be prompted each time. <Hyperlink
Click="ClearDefaultAccount"
Cursor="Hand"
Foreground="#FF0074FF">
Clear default account
</Hyperlink>
.</TextBlock>
<ComboBox
Name="defaultAccountBox"
Grid.Row="2"
Margin="0"
ItemTemplate="{StaticResource SpeckleAccountTemplateSimple}"
ItemsSource="{Binding accounts}"
SelectionChanged="DefaultAccountBox_SelectionChanged" />
</StackPanel>
<Grid Grid.Row="1" Visibility="{Binding Path=hasAccounts, Converter={StaticResource BoolToCollapsed}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- EXISTING ACCOUTS -->
<Label
Grid.Row="0"
Margin="0,10"
HorizontalAlignment="Center"
HorizontalContentAlignment="Stretch"
Content="Existing Accounts"
FontSize="22" />
<ListView
x:Name="AccountListBox"
Grid.Row="1"
VerticalAlignment="Top"
HorizontalContentAlignment="Stretch"
x:FieldModifier="public"
BorderThickness="0"
ItemTemplate="{StaticResource SpeckleAccountTemplate}"
ItemsSource="{Binding accounts}"
MouseDoubleClick="AccountListBox_MouseDoubleClick"
ScrollViewer.CanContentScroll="False"
SelectionChanged="AccountListBox_SelectionChanged" />
</Grid>
<!-- NEW ACCOUNT -->
<StackPanel Grid.Row="2">
<Label
Grid.Row="5"
Margin="0,10"
HorizontalAlignment="Center"
Content="New Account"
FontSize="22" />
<TextBlock
Grid.Row="6"
Height="39"
Margin="0,5"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="10"
Foreground="Gray"
Text="Input below the server url you want to log in or register at. Remember, it needs to be a valid url, ie: https://hestia.speckle.works."
TextWrapping="Wrap" />
<TextBox
Name="serverUrlButton"
Grid.Row="7"
Height="26"
Margin="0,5,0,0"
FontSize="16"
Text="{Binding defaultServer, Mode=TwoWay}"
TextAlignment="Center"
TextChanged="serverUrlTextChanged"
TextWrapping="Wrap" />
<Label
Name="ValidationLabel"
Grid.Row="8"
Height="26"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Background="White"
Content="{Binding errorMessage, Mode=TwoWay}"
FontSize="10"
Foreground="Gray" />
<Button
Grid.Row="9"
Height="45"
Margin="0,0,0,0"
HorizontalAlignment="Stretch"
Background="#FF0074FF"
Click="SignInClick"
Content="Add new account"
FontSize="16"
Foreground="White"
IsEnabled="{Binding isCorrectUrl}" />
<TextBlock
Margin="5,10,5,5"
FontSize="10"
Foreground="Gray"
TextWrapping="Wrap">
Issues with the redirect? <Hyperlink
Click="ManuallyAddAccountClick"
Cursor="Hand"
Foreground="#FF0074FF">
Manually add the account
</Hyperlink>
using the connection string.</TextBlock>
</StackPanel>
</Grid>
<!-- SUCCESS -->
<StackPanel
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="20"
Visibility="{Binding Path=showSigninsuccess, Converter={StaticResource BoolToCollapsed}, FallbackValue=Collapsed}">
<Label
Content="You've signed in succesfuly."
FontFamily="Segoe UI Light"
FontSize="24" />
<Label
Margin="20,49,20,0"
Content="Your new account is ready to use. Double click it (in the account list) to select it."
FontFamily="Segoe UI Light"
FontSize="16" />
<Button
Margin="20,50,20,20"
Background="#FF0074FF"
BorderBrush="#00707070"
Click="ReturnToMain"
Content="Back"
FontSize="16"
Foreground="White" />
</StackPanel>
</Grid>
</Window>