Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Preferences / AddAccountView.xaml @ 84b880b5

History | View | Annotate | Download (12.9 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
        Title="AddAccountView" Height="300" Width="467" 
6
        xmlns:Preferences="clr-namespace:Pithos.Client.WPF.Preferences"
7
        xmlns:my="http://schemas.xceed.com/wpf/xaml/toolkit">
8
    <Window.Resources>
9
        <my:InverseBoolConverter x:Key="InverseBool" />
10
        <BooleanToVisibilityConverter x:Key="BoolToVisible" />
11
    </Window.Resources>
12
    <my:Wizard FinishButtonClosesWindow="True" Name="AccountWizard" PageChanged="AccountWizard_PageChanged" HelpButtonVisibility="Collapsed">
13
        <my:WizardPage x:Name="IntroPage" 
14
                                   Title="Setup your Pithos+ Account"
15
                                   Description="This wizard will walk you through the setup of your Pithos+ account." 
16
                               
17
                               
18
                               BackButtonVisibility="Collapsed"
19
                               FinishButtonVisibility="Collapsed">
20
            <my:WizardPage.ExteriorPanelBackground>
21
                <ImageBrush ImageSource="/PithosPlus;component/Images/pithos_logo-icon.ico" Stretch="Uniform" TileMode="None" />
22
            </my:WizardPage.ExteriorPanelBackground>
23
        </my:WizardPage>
24
        <my:WizardPage x:Name="ChooseServer" PageType="Interior"
25
                                   Title="Select your Pithos+ Server"
26
                                   Description="Please specify the Pithos+ Server you would like to setup, please note that you can also add a custom server in the field."                               
27
                               FinishButtonVisibility="Collapsed"
28
                                    CanSelectNextPage="{Binding IsValidServer}"
29
                               
30
                                    >
31
            <StackPanel >
32
                <Label Content="Pithos+ Server" Target="{Binding ElementName=Servers}"  />
33
                <ComboBox x:Name="Servers" IsEditable="True" ItemsSource="{Binding Servers}"
34
                          Text="{Binding CurrentServer,ValidatesOnExceptions=True, Mode=TwoWay}" >                        
35
                    <Validation.ErrorTemplate>
36
                        <ControlTemplate>
37
                            <StackPanel>
38
                                <AdornedElementPlaceholder />
39
                                <TextBlock Foreground="Red" >Invalid Path</TextBlock>
40
                            </StackPanel>
41
                        </ControlTemplate>
42
                    </Validation.ErrorTemplate>
43
                </ComboBox>                
44
            </StackPanel>
45
        </my:WizardPage>
46
        <my:WizardPage x:Name="ChooseMethodPage" PageType="Interior"
47
                                   Title="Pithos+ Account Setup"
48
                                   Description="We recomend that you use the Automated process to retrieve your account token, if it fails for any reason you can still use the Manual process"
49
                               FinishButtonVisibility="Collapsed"
50
                                    CanSelectNextPage="False"
51
                               >
52
            <StackPanel >
53
                <RadioButton x:Name="Automatic" Content="Automated Token Retrieval" Checked="Automatic_Checked" Margin="5"/>
54
                <RadioButton x:Name="Manually" Content="Manual Token Retrieval" Checked="Manually_Checked" Margin="5"/>
55
            </StackPanel>
56
        </my:WizardPage>
57
        <my:WizardPage x:Name="ManualAccountPage" PageType="Interior"
58
                                   Title="Add your account manually"
59
                                   Description="Enter the account credentials and press &quot;Validate Credentials&quot;"
60
                               NextPage="{Binding ElementName=AccountPathPage}"                               
61
                               FinishButtonVisibility="Collapsed"
62
                               CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=True}" 
63
                               TargetUpdated="OnTargetUpdated"
64
                               
65
                               >
66
            <my:BusyIndicator x:Name="ManualBusyIndicator" IsBusy="{Binding IsWorking,NotifyOnSourceUpdated=true}" DisplayAfter="0" >
67
                <my:BusyIndicator.BusyContent>
68
                    <TextBlock x:Name="ManualBusyMessage" Text="{Binding BusyTitle}" HorizontalAlignment="Center" />
69
                </my:BusyIndicator.BusyContent>
70
                <my:BusyIndicator.Content>
71
                    <Grid>
72
                        <Grid.ColumnDefinitions>
73
                            <ColumnDefinition Width="Auto"/>
74
                            <ColumnDefinition Width="91*"/>
75
                        </Grid.ColumnDefinitions>
76
                        <Grid.RowDefinitions>
77
                            <RowDefinition Height="Auto"/>
78
                            <RowDefinition Height="Auto"/>
79
                            <RowDefinition Height="Auto"/>
80
                            <RowDefinition />
81
                        </Grid.RowDefinitions>
82
<!--                        <Label Content="User ID" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
83
                       <TextBox Name="AccountName" Grid.Column="1" Grid.Row="0" Margin="5"/> -->
84
                        <Label Content="Token" Grid.Column="0" Grid.Row="1" Margin="0,5" HorizontalAlignment="Left"/>
85
                        <TextBox  Name="Token" Grid.Column="1" Grid.Row="1" Margin="5"/>
86
                        <Button x:Name="TestManualAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" cal:Message.Attach="TestAccount" Margin="5"/>
87
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding ValidationMessage}" Margin="10" HorizontalAlignment="Center"/>
88
                    </Grid>
89
                </my:BusyIndicator.Content>
90
            </my:BusyIndicator>
91
        </my:WizardPage>
92
        <my:WizardPage x:Name="AutoAccountPage" PageType="Interior"
93
                                   Title="Add your account"
94
                                   Description="When you click Retrieve Credentials, I will open a browser with the authentication page of your selected server. The required information will be automatically retrieved after you finish your login."                               
95
                               FinishButtonVisibility="Collapsed"
96
                               CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=true}"                               
97
                               TargetUpdated="OnTargetUpdated"
98
                               
99
                               >
100
            <my:BusyIndicator x:Name="AutoBusyIndicator" IsBusy="{Binding IsWorking}" DisplayAfter="0">
101
                <my:BusyIndicator.BusyContent>
102
                    <TextBlock  TextWrapping="Wrap">
103
                        <TextBlock HorizontalAlignment="Center" Text="{Binding BusyTitle}"/>
104
                        <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding BusyDetail}"/>
105
                    </TextBlock>                    
106
                </my:BusyIndicator.BusyContent>
107
                <my:BusyIndicator.Content>
108
                    <StackPanel x:Name="AutoPanel" VerticalAlignment="Center" >
109
                        <Button Margin="5" Name="RetrieveCredentials" Content="Retrieve Credentials" Width="150"/>
110
                        <TextBlock Text="Credentials Retrieved Succesfully" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasCredentials}" Margin="10" HorizontalAlignment="Center"/>
111
                        <Button x:Name="TestAutoAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
112
                        
113
                        <TextBlock x:Name="ValidationMessage" Text="Credentials Validated" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasValidCredentials}" Margin="10" HorizontalAlignment="Center"/>
114
                    </StackPanel>
115
                </my:BusyIndicator.Content>
116
                </my:BusyIndicator>
117
        </my:WizardPage>
118
        <my:WizardPage x:Name="AccountPathPage" PageType="Interior"
119
                                   Title="Select your local container"
120
                                   Description="Select the local folder that you will use for your local container."
121
                               NextPage="{Binding ElementName=LastPage}"
122
                               FinishButtonVisibility="Collapsed"
123
                               CanSelectNextPage="{Binding HasAccountPath}"
124
                                   >
125
            <StackPanel>
126
                <Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
127
                <Grid HorizontalAlignment="Stretch">
128
                    <Grid.RowDefinitions>
129
                        <RowDefinition Height="Auto"/>
130
                        <RowDefinition/>
131
                    </Grid.RowDefinitions>
132
                    <Grid.ColumnDefinitions>
133
                        <ColumnDefinition />
134
                        <ColumnDefinition Width="Auto" />
135
                    </Grid.ColumnDefinitions>
136
                    <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="0">
137
                        <TextBox.Text>
138
                            <Binding Path="AccountPath" Mode="TwoWay">
139
                                <Binding.ValidationRules>
140
                                    <Preferences:DirectoryExistsRule/>
141
                                </Binding.ValidationRules>
142
                            </Binding>
143
                        </TextBox.Text>
144
                       <Validation.ErrorTemplate>
145
                            <ControlTemplate>
146
                                <StackPanel>                                    
147
                                    <AdornedElementPlaceholder />
148
                                    <TextBlock Foreground="Red" >Invalid Path</TextBlock>
149
                                </StackPanel>
150
                            </ControlTemplate>
151
                        </Validation.ErrorTemplate>
152
                    </TextBox>
153
                    <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0"/>
154
                    <CheckBox x:Name="ShouldCreateOkeanosFolder"  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" >
155
                        <CheckBox.Content>
156
                            <TextBlock TextWrapping="Wrap">
157
                               Create the Okeanos container(folder) below the selected folder
158
                            </TextBlock>
159
                        </CheckBox.Content>
160
                    </CheckBox>
161
                </Grid>
162
            </StackPanel>
163
        </my:WizardPage>
164
        <my:WizardPage x:Name="LastPage" PageType="Interior"
165
                                   Title="Thank You!"
166
                                   Description="The moment you press finish I will create everything you need to start using the Pithos+ client."
167
                                   CanFinish="True"
168
                               >
169
            <Grid>
170
                <Grid.RowDefinitions>
171
                    <RowDefinition Height="Auto"/>
172
                    <RowDefinition Height="Auto"/>
173
                    <RowDefinition Height="Auto"/>
174
                    <RowDefinition Height="Auto"/>
175
                    <RowDefinition Height="Auto"/>
176
                    <RowDefinition />
177
                </Grid.RowDefinitions>
178
                <Grid.ColumnDefinitions>
179
                    <ColumnDefinition Width="Auto"/>
180
                    <ColumnDefinition />
181
                </Grid.ColumnDefinitions>
182
                <TextBlock Text="Server:" Grid.Column="0" Grid.Row="0" Margin="5,2"/>
183
                <TextBlock Text="{Binding CurrentServer}" Grid.Column="1" Grid.Row="0" Margin="5,2"/>
184
                <TextBlock Text="Account Name:" Grid.Column="0" Grid.Row="1" Margin="5,2"/>
185
                <TextBlock Text="{Binding AccountName}" Grid.Column="1" Grid.Row="1" Margin="5,2"/>
186
                <TextBlock Text="Token:" Grid.Column="0" Grid.Row="2" Margin="5,2"/>
187
                <TextBlock Text="{Binding Token}" Grid.Column="1" Grid.Row="2" Margin="5,2"/>
188
                <TextBlock Text="Account Path:" Grid.Column="0" Grid.Row="3" Margin="5,2"/>
189
                <TextBlock Text="{Binding AccountPath}" Grid.Column="1" Grid.Row="3" Margin="5,2"/>
190

    
191
                <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="5" Margin="5"/>
192
            </Grid>
193
        </my:WizardPage>
194
    </my:Wizard>
195
    
196
</Window>