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">
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 <extToolkit:WizardPage x:Name="ChooseServer" PageType="Interior"
17 Title="Where do you want to connect?"
18 Description="You can connect to the production or development server, or enter your own server URL"
19 CanSelectNextPage="{Binding IsValidServer}"
22 <Label Content="Pithos Server" Target="{Binding ElementName=Servers}" />
23 <ComboBox x:Name="Servers" IsEditable="True" ItemsSource="{Binding Servers}"
24 Text="{Binding CurrentServer,ValidatesOnExceptions=True, Mode=TwoWay}" >
25 <Validation.ErrorTemplate>
28 <AdornedElementPlaceholder />
29 <TextBlock Foreground="Red" >Invalid Path</TextBlock>
32 </Validation.ErrorTemplate>
35 </extToolkit:WizardPage>
36 <extToolkit:WizardPage x:Name="ChooseMethodPage" PageType="Interior"
37 Title="How do you want to add the account?"
38 Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually"
39 CanSelectNextPage="False">
41 <RadioButton x:Name="Automatic" Content="By logging to Pithos" Checked="Automatic_Checked" Margin="5"/>
42 <RadioButton x:Name="Manually" Content="Manually" Checked="Manually_Checked" Margin="5"/>
44 </extToolkit:WizardPage>
45 <extToolkit:WizardPage x:Name="ManualAccountPage" PageType="Interior"
46 Title="Add an account manually"
47 Description="Please enter the account credentials and press "Validate Credentials""
48 NextPage="{Binding ElementName=AccountPathPage}"
49 CanSelectNextPage="{Binding HasValidCredentials}"
51 <extToolkit:BusyIndicator x:Name="ManualBusyIndicator" IsBusy="{Binding IsWorking,NotifyOnSourceUpdated=true}" DisplayAfter="0" >
52 <extToolkit:BusyIndicator.BusyContent>
53 <TextBlock x:Name="ManualBusyMessage" Text="{Binding BusyTitle}" HorizontalAlignment="Center" />
54 </extToolkit:BusyIndicator.BusyContent>
55 <extToolkit:BusyIndicator.Content>
57 <Grid.ColumnDefinitions>
58 <ColumnDefinition Width="Auto"/>
59 <ColumnDefinition Width="91*"/>
60 </Grid.ColumnDefinitions>
62 <RowDefinition Height="Auto"/>
63 <RowDefinition Height="Auto"/>
64 <RowDefinition Height="Auto"/>
66 </Grid.RowDefinitions>
67 <Label Content="Account" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
68 <TextBox Name="AccountName" Grid.Column="1" Grid.Row="0" Margin="5"/>
69 <Label Content="API Key" Grid.Column="0" Grid.Row="1" Margin="0,5" HorizontalAlignment="Left"/>
70 <TextBox Name="Token" Grid.Column="1" Grid.Row="1" Margin="5"/>
71 <Button x:Name="TestManualAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
73 </extToolkit:BusyIndicator.Content>
74 </extToolkit:BusyIndicator>
75 </extToolkit:WizardPage>
76 <extToolkit:WizardPage x:Name="AutoAccountPage" PageType="Interior"
77 Title="Add an account automatically"
78 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."
79 NextPage="{Binding ElementName=AutoConfirmedPage}"
80 CanSelectNextPage="{Binding HasValidCredentials}"
82 <extToolkit:BusyIndicator x:Name="AutoBusyIndicator" IsBusy="{Binding IsWorking,NotifyOnSourceUpdated=true}" DisplayAfter="0">
83 <extToolkit:BusyIndicator.BusyContent>
84 <TextBlock TextWrapping="Wrap">
85 <TextBlock HorizontalAlignment="Center" Text="{Binding BusyTitle}"/>
86 <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding BusyDetail}"/>
88 </extToolkit:BusyIndicator.BusyContent>
89 <extToolkit:BusyIndicator.Content>
90 <StackPanel x:Name="AutoPanel" VerticalAlignment="Center" >
91 <Button Margin="5" Name="RetrieveCredentials" Content="Retrieve Credentials" Width="150"/>
93 <TextBlock Text="Credentials Retrieved Succesfully" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasCredentials}" Margin="10" HorizontalAlignment="Center"/>
94 <Button x:Name="TestAutoAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
96 </extToolkit:BusyIndicator.Content>
97 </extToolkit:BusyIndicator>
98 </extToolkit:WizardPage>
99 <extToolkit:WizardPage x:Name="AccountPathPage" PageType="Interior"
100 Title="Select Account Path"
101 Description="Please select the roor path for your account"
102 NextPage="{Binding ElementName=LastPage}"
103 CanSelectNextPage="{Binding HasAccountPath}"
106 <Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
107 <Grid HorizontalAlignment="Stretch">
108 <Grid.ColumnDefinitions>
110 <ColumnDefinition Width="Auto" />
111 </Grid.ColumnDefinitions>
112 <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" >
114 <Binding Path="AccountPath" Mode="TwoWay">
115 <Binding.ValidationRules>
116 <Preferences:DirectoryExistsRule/>
117 </Binding.ValidationRules>
120 <Validation.ErrorTemplate>
123 <AdornedElementPlaceholder />
124 <TextBlock Foreground="Red" >Invalid Path</TextBlock>
127 </Validation.ErrorTemplate>
129 <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1"/>
132 </extToolkit:WizardPage>
133 <extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
135 Description="Press finish to create the account"
138 <Grid.RowDefinitions>
139 <RowDefinition Height="Auto"/>
140 <RowDefinition Height="Auto"/>
141 <RowDefinition Height="Auto"/>
142 <RowDefinition Height="Auto"/>
143 <RowDefinition Height="Auto"/>
145 </Grid.RowDefinitions>
146 <Grid.ColumnDefinitions>
147 <ColumnDefinition Width="Auto"/>
149 </Grid.ColumnDefinitions>
150 <TextBlock Text="Server:" Grid.Column="0" Grid.Row="0" Margin="5,2"/>
151 <TextBlock Text="{Binding CurrentServer}" Grid.Column="1" Grid.Row="0" Margin="5,2"/>
152 <TextBlock Text="Account Name:" Grid.Column="0" Grid.Row="1" Margin="5,2"/>
153 <TextBlock Text="{Binding AccountName}" Grid.Column="1" Grid.Row="1" Margin="5,2"/>
154 <TextBlock Text="Token:" Grid.Column="0" Grid.Row="2" Margin="5,2"/>
155 <TextBlock Text="{Binding Token}" Grid.Column="1" Grid.Row="2" Margin="5,2"/>
156 <TextBlock Text="Account Path:" Grid.Column="0" Grid.Row="3" Margin="5,2"/>
157 <TextBlock Text="{Binding AccountPath}" Grid.Column="1" Grid.Row="3" Margin="5,2"/>
159 <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="5" Margin="5"/>
161 </extToolkit:WizardPage>