Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Preferences / AddAccountView.xaml @ fe62b7f4

History | View | Annotate | Download (12.8 kB)

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">
8
    <Window.Resources>
9
        <my:InverseBoolConverter x:Key="InverseBool" />
10
        <BooleanToVisibilityConverter x:Key="BoolToVisible" />
11
    </Window.Resources>
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"
18
                               />
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}"
24
                               
25
                                    >
26
            <StackPanel >
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>
31
                        <ControlTemplate>
32
                            <StackPanel>
33
                                <AdornedElementPlaceholder />
34
                                <TextBlock Foreground="Red" >Invalid Path</TextBlock>
35
                            </StackPanel>
36
                        </ControlTemplate>
37
                    </Validation.ErrorTemplate>
38
                </ComboBox>                
39
            </StackPanel>
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"
46
                               >
47
            <StackPanel >
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"/>
50
            </StackPanel>
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 &quot;Validate Credentials&quot;"
55
                               NextPage="{Binding ElementName=AccountPathPage}"                               
56
                               FinishButtonVisibility="Collapsed"
57
                               CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=True}" 
58
                               TargetUpdated="OnTargetUpdated"
59
                               
60
                               >
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>
66
                    <Grid>
67
                        <Grid.ColumnDefinitions>
68
                            <ColumnDefinition Width="Auto"/>
69
                            <ColumnDefinition Width="91*"/>
70
                        </Grid.ColumnDefinitions>
71
                        <Grid.RowDefinitions>
72
                            <RowDefinition Height="Auto"/>
73
                            <RowDefinition Height="Auto"/>
74
                            <RowDefinition Height="Auto"/>
75
                            <RowDefinition />
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"/>
83
                    </Grid>
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"
93
                               
94
                               >
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}"/>
100
                    </TextBlock>                    
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"/>
107
                        
108
                        <TextBlock x:Name="ValidationMessage" Text="Credentials Validated" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasValidCredentials}" Margin="10" HorizontalAlignment="Center"/>
109
                    </StackPanel>
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}"
119
                                   >
120
            <StackPanel>
121
                <Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
122
                <Grid HorizontalAlignment="Stretch">
123
                    <Grid.RowDefinitions>
124
                        <RowDefinition Height="Auto"/>
125
                        <RowDefinition/>
126
                    </Grid.RowDefinitions>
127
                    <Grid.ColumnDefinitions>
128
                        <ColumnDefinition />
129
                        <ColumnDefinition Width="Auto" />
130
                    </Grid.ColumnDefinitions>
131
                    <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="0">
132
                        <TextBox.Text>
133
                            <Binding Path="AccountPath" Mode="TwoWay">
134
                                <Binding.ValidationRules>
135
                                    <Preferences:DirectoryExistsRule/>
136
                                </Binding.ValidationRules>
137
                            </Binding>
138
                        </TextBox.Text>
139
                       <Validation.ErrorTemplate>
140
                            <ControlTemplate>
141
                                <StackPanel>                                    
142
                                    <AdornedElementPlaceholder />
143
                                    <TextBlock Foreground="Red" >Invalid Path</TextBlock>
144
                                </StackPanel>
145
                            </ControlTemplate>
146
                        </Validation.ErrorTemplate>
147
                    </TextBox>
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" >
150
                        <CheckBox.Content>
151
                            <TextBlock TextWrapping="Wrap">
152
                               Create an Okeanos folder below the selected folder
153
                                <LineBreak/>
154
                               Clear this setting to use the currently selected folder and synchronize its contents
155
                            </TextBlock>
156
                        </CheckBox.Content>
157
                    </CheckBox>
158
                </Grid>
159
            </StackPanel>
160
        </extToolkit:WizardPage>
161
        <extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
162
                                   Title="Finish"
163
                                   Description="Press finish to create the account"
164
                                   CanFinish="True"
165
                               >
166
            <Grid>
167
                <Grid.RowDefinitions>
168
                    <RowDefinition Height="Auto"/>
169
                    <RowDefinition Height="Auto"/>
170
                    <RowDefinition Height="Auto"/>
171
                    <RowDefinition Height="Auto"/>
172
                    <RowDefinition Height="Auto"/>
173
                    <RowDefinition />
174
                </Grid.RowDefinitions>
175
                <Grid.ColumnDefinitions>
176
                    <ColumnDefinition Width="Auto"/>
177
                    <ColumnDefinition />
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"/>
187

    
188
                <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="5" Margin="5"/>
189
            </Grid>
190
        </extToolkit:WizardPage>
191
    </extToolkit:Wizard>
192
    
193
</Window>