Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (11.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
        <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,NotifyOnTargetUpdated=True}" 
55
                               TargetUpdated="OnTargetUpdated"
56
                               >
57
            <extToolkit:BusyIndicator x:Name="ManualBusyIndicator" IsBusy="{Binding IsWorking,NotifyOnSourceUpdated=true}" DisplayAfter="0" >
58
                <extToolkit:BusyIndicator.BusyContent>
59
                    <TextBlock x:Name="ManualBusyMessage" Text="{Binding BusyTitle}" HorizontalAlignment="Center" />
60
                </extToolkit:BusyIndicator.BusyContent>
61
                <extToolkit:BusyIndicator.Content>
62
                    <Grid>
63
                        <Grid.ColumnDefinitions>
64
                            <ColumnDefinition Width="Auto"/>
65
                            <ColumnDefinition Width="91*"/>
66
                        </Grid.ColumnDefinitions>
67
                        <Grid.RowDefinitions>
68
                            <RowDefinition Height="Auto"/>
69
                            <RowDefinition Height="Auto"/>
70
                            <RowDefinition Height="Auto"/>
71
                            <RowDefinition />
72
                        </Grid.RowDefinitions>
73
                        <Label Content="Account" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
74
                        <TextBox Name="AccountName" Grid.Column="1" Grid.Row="0" Margin="5"/>
75
                        <Label Content="API Key" Grid.Column="0" Grid.Row="1" Margin="0,5" HorizontalAlignment="Left"/>
76
                        <TextBox  Name="Token" Grid.Column="1" Grid.Row="1" Margin="5"/>
77
                        <Button x:Name="TestManualAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
78
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding ValidationMessage}" Margin="10" HorizontalAlignment="Center"/>
79
                    </Grid>
80
                </extToolkit:BusyIndicator.Content>
81
            </extToolkit:BusyIndicator>
82
        </extToolkit:WizardPage>
83
        <extToolkit:WizardPage x:Name="AutoAccountPage" PageType="Interior"
84
                                   Title="Add an account automatically"
85
                                   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."                               
86
                               FinishButtonVisibility="Collapsed"
87
                               CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=true}"                               
88
                               TargetUpdated="OnTargetUpdated"
89
                               >
90
            <extToolkit:BusyIndicator x:Name="AutoBusyIndicator" IsBusy="{Binding IsWorking}" DisplayAfter="0">
91
                <extToolkit:BusyIndicator.BusyContent>
92
                    <TextBlock  TextWrapping="Wrap">
93
                        <TextBlock HorizontalAlignment="Center" Text="{Binding BusyTitle}"/>
94
                        <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding BusyDetail}"/>
95
                    </TextBlock>                    
96
                </extToolkit:BusyIndicator.BusyContent>
97
                <extToolkit:BusyIndicator.Content>
98
                    <StackPanel x:Name="AutoPanel" VerticalAlignment="Center" >
99
                        <Button Margin="5" Name="RetrieveCredentials" Content="Retrieve Credentials" Width="150"/>
100
                        <TextBlock Text="Credentials Retrieved Succesfully" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasCredentials}" Margin="10" HorizontalAlignment="Center"/>
101
                        <Button x:Name="TestAutoAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
102
                        
103
                        <TextBlock x:Name="ValidationMessage" Text="Credentials Validated" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasValidCredentials}" Margin="10" HorizontalAlignment="Center"/>
104
                    </StackPanel>
105
                </extToolkit:BusyIndicator.Content>
106
                </extToolkit:BusyIndicator>
107
        </extToolkit:WizardPage>
108
        <extToolkit:WizardPage x:Name="AccountPathPage" PageType="Interior"
109
                                   Title="Select Account Path"
110
                                   Description="Please select the roor path for your account"
111
                               NextPage="{Binding ElementName=LastPage}"
112
                               FinishButtonVisibility="Collapsed"
113
                               CanSelectNextPage="{Binding HasAccountPath}"
114
                                   >
115
            <StackPanel>
116
                <Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
117
                <Grid HorizontalAlignment="Stretch">
118
                    <Grid.ColumnDefinitions>
119
                        <ColumnDefinition />
120
                        <ColumnDefinition Width="Auto" />
121
                    </Grid.ColumnDefinitions>
122
                    <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" >
123
                        <TextBox.Text>
124
                            <Binding Path="AccountPath" Mode="TwoWay">
125
                                <Binding.ValidationRules>
126
                                    <Preferences:DirectoryExistsRule/>
127
                                </Binding.ValidationRules>
128
                            </Binding>
129
                        </TextBox.Text>
130
                       <Validation.ErrorTemplate>
131
                            <ControlTemplate>
132
                                <StackPanel>                                    
133
                                    <AdornedElementPlaceholder />
134
                                    <TextBlock Foreground="Red" >Invalid Path</TextBlock>
135
                                </StackPanel>
136
                            </ControlTemplate>
137
                        </Validation.ErrorTemplate>
138
                    </TextBox>
139
                    <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1"/>
140
                </Grid>
141
            </StackPanel>
142
        </extToolkit:WizardPage>
143
        <extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
144
                                   Title="Finish"
145
                                   Description="Press finish to create the account"
146
                                   CanFinish="True">
147
            <Grid>
148
                <Grid.RowDefinitions>
149
                    <RowDefinition Height="Auto"/>
150
                    <RowDefinition Height="Auto"/>
151
                    <RowDefinition Height="Auto"/>
152
                    <RowDefinition Height="Auto"/>
153
                    <RowDefinition Height="Auto"/>
154
                    <RowDefinition />
155
                </Grid.RowDefinitions>
156
                <Grid.ColumnDefinitions>
157
                    <ColumnDefinition Width="Auto"/>
158
                    <ColumnDefinition />
159
                </Grid.ColumnDefinitions>
160
                <TextBlock Text="Server:" Grid.Column="0" Grid.Row="0" Margin="5,2"/>
161
                <TextBlock Text="{Binding CurrentServer}" Grid.Column="1" Grid.Row="0" Margin="5,2"/>
162
                <TextBlock Text="Account Name:" Grid.Column="0" Grid.Row="1" Margin="5,2"/>
163
                <TextBlock Text="{Binding AccountName}" Grid.Column="1" Grid.Row="1" Margin="5,2"/>
164
                <TextBlock Text="Token:" Grid.Column="0" Grid.Row="2" Margin="5,2"/>
165
                <TextBlock Text="{Binding Token}" Grid.Column="1" Grid.Row="2" Margin="5,2"/>
166
                <TextBlock Text="Account Path:" Grid.Column="0" Grid.Row="3" Margin="5,2"/>
167
                <TextBlock Text="{Binding AccountPath}" Grid.Column="1" Grid.Row="3" Margin="5,2"/>
168

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