1 <Window x:Class="Pithos.Client.WPF.Preferences.AddAccountView"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:cal="http://www.caliburnproject.org"
5 xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
6 Title="AddAccountView" Height="300" Width="467" xmlns:my="clr-namespace:Microsoft.Windows.Controls.Core.Converters;assembly=WPFToolkit.Extended"
7 xmlns:Preferences="clr-namespace:Pithos.Client.WPF.Preferences">
9 <my:InverseBoolConverter x:Key="InverseBool" />
10 <BooleanToVisibilityConverter x:Key="BoolToVisible" />
12 <extToolkit:Wizard FinishButtonClosesWindow="True" Name="AccountWizard" PageChanged="AccountWizard_PageChanged" HelpButtonVisibility="Collapsed">
13 <extToolkit:WizardPage x:Name="IntroPage"
14 Title="Add new Pithos Account"
15 Description="This Wizard will walk you through adding a new Pithos account and retrieving an authentication token"
16 BackButtonVisibility="Collapsed"
17 FinishButtonVisibility="Collapsed"
19 <extToolkit:WizardPage x:Name="ChooseServer" PageType="Interior"
20 Title="Where do you want to connect?"
21 Description="You can connect to the production or development server, or enter your own server URL"
22 FinishButtonVisibility="Collapsed"
23 CanSelectNextPage="{Binding IsValidServer}"
27 <Label Content="Pithos+ Server" Target="{Binding ElementName=Servers}" />
28 <ComboBox x:Name="Servers" IsEditable="True" ItemsSource="{Binding Servers}"
29 Text="{Binding CurrentServer,ValidatesOnExceptions=True, Mode=TwoWay}" >
30 <Validation.ErrorTemplate>
33 <AdornedElementPlaceholder />
34 <TextBlock Foreground="Red" >Invalid Path</TextBlock>
37 </Validation.ErrorTemplate>
40 </extToolkit:WizardPage>
41 <extToolkit:WizardPage x:Name="ChooseMethodPage" PageType="Interior"
42 Title="How do you want to add the account?"
43 Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually"
44 FinishButtonVisibility="Collapsed"
45 CanSelectNextPage="False"
48 <RadioButton x:Name="Automatic" Content="By logging to Pithos" Checked="Automatic_Checked" Margin="5"/>
49 <RadioButton x:Name="Manually" Content="Manually" Checked="Manually_Checked" Margin="5"/>
51 </extToolkit:WizardPage>
52 <extToolkit:WizardPage x:Name="ManualAccountPage" PageType="Interior"
53 Title="Add an account manually"
54 Description="Please enter the account credentials and press "Validate Credentials""
55 NextPage="{Binding ElementName=AccountPathPage}"
56 FinishButtonVisibility="Collapsed"
57 CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=True}"
58 TargetUpdated="OnTargetUpdated"
61 <extToolkit:BusyIndicator x:Name="ManualBusyIndicator" IsBusy="{Binding IsWorking,NotifyOnSourceUpdated=true}" DisplayAfter="0" >
62 <extToolkit:BusyIndicator.BusyContent>
63 <TextBlock x:Name="ManualBusyMessage" Text="{Binding BusyTitle}" HorizontalAlignment="Center" />
64 </extToolkit:BusyIndicator.BusyContent>
65 <extToolkit:BusyIndicator.Content>
67 <Grid.ColumnDefinitions>
68 <ColumnDefinition Width="Auto"/>
69 <ColumnDefinition Width="91*"/>
70 </Grid.ColumnDefinitions>
72 <RowDefinition Height="Auto"/>
73 <RowDefinition Height="Auto"/>
74 <RowDefinition Height="Auto"/>
76 </Grid.RowDefinitions>
77 <Label Content="Account" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
78 <TextBox Name="AccountName" Grid.Column="1" Grid.Row="0" Margin="5"/>
79 <Label Content="API Key" Grid.Column="0" Grid.Row="1" Margin="0,5" HorizontalAlignment="Left"/>
80 <TextBox Name="Token" Grid.Column="1" Grid.Row="1" Margin="5"/>
81 <Button x:Name="TestManualAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
82 <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding ValidationMessage}" Margin="10" HorizontalAlignment="Center"/>
84 </extToolkit:BusyIndicator.Content>
85 </extToolkit:BusyIndicator>
86 </extToolkit:WizardPage>
87 <extToolkit:WizardPage x:Name="AutoAccountPage" PageType="Interior"
88 Title="Add an account automatically"
89 Description="By clicking on the button below you will be taken to the Pithos web site where you can login with your username and password."
90 FinishButtonVisibility="Collapsed"
91 CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=true}"
92 TargetUpdated="OnTargetUpdated"
95 <extToolkit:BusyIndicator x:Name="AutoBusyIndicator" IsBusy="{Binding IsWorking}" DisplayAfter="0">
96 <extToolkit:BusyIndicator.BusyContent>
97 <TextBlock TextWrapping="Wrap">
98 <TextBlock HorizontalAlignment="Center" Text="{Binding BusyTitle}"/>
99 <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding BusyDetail}"/>
101 </extToolkit:BusyIndicator.BusyContent>
102 <extToolkit:BusyIndicator.Content>
103 <StackPanel x:Name="AutoPanel" VerticalAlignment="Center" >
104 <Button Margin="5" Name="RetrieveCredentials" Content="Retrieve Credentials" Width="150"/>
105 <TextBlock Text="Credentials Retrieved Succesfully" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasCredentials}" Margin="10" HorizontalAlignment="Center"/>
106 <Button x:Name="TestAutoAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
108 <TextBlock x:Name="ValidationMessage" Text="Credentials Validated" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasValidCredentials}" Margin="10" HorizontalAlignment="Center"/>
110 </extToolkit:BusyIndicator.Content>
111 </extToolkit:BusyIndicator>
112 </extToolkit:WizardPage>
113 <extToolkit:WizardPage x:Name="AccountPathPage" PageType="Interior"
114 Title="Select Account Path"
115 Description="Please select the roor path for your account"
116 NextPage="{Binding ElementName=LastPage}"
117 FinishButtonVisibility="Collapsed"
118 CanSelectNextPage="{Binding HasAccountPath}"
121 <Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
122 <Grid HorizontalAlignment="Stretch">
123 <Grid.RowDefinitions>
124 <RowDefinition Height="Auto"/>
126 </Grid.RowDefinitions>
127 <Grid.ColumnDefinitions>
129 <ColumnDefinition Width="Auto" />
130 </Grid.ColumnDefinitions>
131 <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="0">
133 <Binding Path="AccountPath" Mode="TwoWay">
134 <Binding.ValidationRules>
135 <Preferences:DirectoryExistsRule/>
136 </Binding.ValidationRules>
139 <Validation.ErrorTemplate>
142 <AdornedElementPlaceholder />
143 <TextBlock Foreground="Red" >Invalid Path</TextBlock>
146 </Validation.ErrorTemplate>
148 <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0"/>
149 <CheckBox x:Name="ShouldCreateOkeanosFolder" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" >
151 <TextBlock TextWrapping="Wrap">
152 Create an Okeanos folder below the selected folder
154 Clear this setting to use the currently selected folder and synchronize its contents
160 </extToolkit:WizardPage>
161 <extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
163 Description="Press finish to create the account"
167 <Grid.RowDefinitions>
168 <RowDefinition Height="Auto"/>
169 <RowDefinition Height="Auto"/>
170 <RowDefinition Height="Auto"/>
171 <RowDefinition Height="Auto"/>
172 <RowDefinition Height="Auto"/>
174 </Grid.RowDefinitions>
175 <Grid.ColumnDefinitions>
176 <ColumnDefinition Width="Auto"/>
178 </Grid.ColumnDefinitions>
179 <TextBlock Text="Server:" Grid.Column="0" Grid.Row="0" Margin="5,2"/>
180 <TextBlock Text="{Binding CurrentServer}" Grid.Column="1" Grid.Row="0" Margin="5,2"/>
181 <TextBlock Text="Account Name:" Grid.Column="0" Grid.Row="1" Margin="5,2"/>
182 <TextBlock Text="{Binding AccountName}" Grid.Column="1" Grid.Row="1" Margin="5,2"/>
183 <TextBlock Text="Token:" Grid.Column="0" Grid.Row="2" Margin="5,2"/>
184 <TextBlock Text="{Binding Token}" Grid.Column="1" Grid.Row="2" Margin="5,2"/>
185 <TextBlock Text="Account Path:" Grid.Column="0" Grid.Row="3" Margin="5,2"/>
186 <TextBlock Text="{Binding AccountPath}" Grid.Column="1" Grid.Row="3" Margin="5,2"/>
188 <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="5" Margin="5"/>
190 </extToolkit:WizardPage>