Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Preferences / AddAccountView.xaml @ 06f11e8b

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

    
168
                <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="5" Margin="5"/>
169
            </Grid>
170
        </extToolkit:WizardPage>
171
    </extToolkit:Wizard>
172
    
173
</Window>