Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Preferences / AddAccountView.xaml @ 3ddbb7b8

History | View | Annotate | Download (8.3 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
        <extToolkit:WizardPage x:Name="ChooseMethodPage" PageType="Interior"
17
                                   Title="How do you want to add the account?"
18
                                   Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually"                               
19
                                    CanSelectNextPage="False">
20
            <StackPanel >
21
                <RadioButton x:Name="Automatic" Content="By logging to Pithos" Checked="Automatic_Checked" Margin="5"/>
22
                <RadioButton x:Name="Manually" Content="Manually" Checked="Manually_Checked" Margin="5"/>
23
            </StackPanel>
24
        </extToolkit:WizardPage>
25
        <extToolkit:WizardPage x:Name="ManualAccountPage" PageType="Interior"
26
                                   Title="Add an account manually"
27
                                   Description="This is the second page in the process"
28
                               NextPage="{Binding ElementName=AccountPathPage}"                               
29
                               CanSelectNextPage="{Binding HasCredentials}"
30
                               >
31
            <Grid>
32
                <Grid.ColumnDefinitions>
33
                    <ColumnDefinition Width="Auto"/>
34
                    <ColumnDefinition Width="91*"/>
35
                </Grid.ColumnDefinitions>
36
                <Grid.RowDefinitions>
37
                    <RowDefinition Height="Auto"/>
38
                    <RowDefinition Height="Auto"/>
39
                    <RowDefinition />
40
                </Grid.RowDefinitions>
41
                <Label Content="Account" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
42
                <TextBox Name="AccountName" Grid.Column="1" Grid.Row="0" Margin="5"/>
43
                <Label Content="API Key" Grid.Column="0" Grid.Row="1" Margin="0,5" HorizontalAlignment="Left"/>
44
                <TextBox  Name="Token" Grid.Column="1" Grid.Row="1" Margin="5"/>
45
            </Grid>
46
        </extToolkit:WizardPage>
47
        <extToolkit:WizardPage x:Name="AutoAccountPage" PageType="Interior"
48
                                   Title="Add an account automatically"
49
                                   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."
50
                               NextPage="{Binding ElementName=AutoConfirmedPage}"                               
51
                               CanSelectNextPage="{Binding IsConfirmed}"
52
                               cal:Message.Attach="[Event GotFocus] = [Action RetrieveCredentials()]"
53
                               >
54
            <extToolkit:BusyIndicator IsBusy="{Binding IsRetrieving}">
55
                <extToolkit:BusyIndicator.BusyContent>
56
                    <TextBlock  TextWrapping="Wrap">
57
                        <TextBlock HorizontalAlignment="Center">Waiting for credentials. </TextBlock>
58
                        <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap">Please enter your credentials in the Pithos logon page</TextBlock>
59
                    </TextBlock>                    
60
                </extToolkit:BusyIndicator.BusyContent>
61
                <extToolkit:BusyIndicator.Content>
62
                    <StackPanel VerticalAlignment="Center" >
63
                        <Button Margin="5" Name="RetrieveCredentials" Content="Retrieve Credentials" Width="150"/>
64

    
65
                        <TextBlock Text="Credentials Retrieved Succesfully" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasCredentials}" Margin="10" HorizontalAlignment="Center"/>
66
                    </StackPanel>
67
                </extToolkit:BusyIndicator.Content>
68
                </extToolkit:BusyIndicator>
69
        </extToolkit:WizardPage>
70
        <extToolkit:WizardPage x:Name="AccountPathPage" PageType="Interior"
71
                                   Title="Select Account Path"
72
                                   Description="Please select the roor path for your account"
73
                               NextPage="{Binding ElementName=LastPage}"
74
                               CanSelectNextPage="{Binding HasAccountPath}"
75
                                   >
76
            <StackPanel>
77
                <Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
78
                <Grid HorizontalAlignment="Stretch">
79
                    <Grid.ColumnDefinitions>
80
                        <ColumnDefinition />
81
                        <ColumnDefinition Width="Auto" />
82
                    </Grid.ColumnDefinitions>
83
                    <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" >
84
                        <TextBox.Text>
85
                            <Binding Path="AccountPath" Mode="TwoWay">
86
                                <Binding.ValidationRules>
87
                                    <Preferences:DirectoryExistsRule/>
88
                                </Binding.ValidationRules>
89
                            </Binding>
90
                        </TextBox.Text>
91
                       <Validation.ErrorTemplate>
92
                            <ControlTemplate>
93
                                <StackPanel>                                    
94
                                    <AdornedElementPlaceholder />
95
                                    <TextBlock Foreground="Red" >Invalid Path</TextBlock>
96
                                </StackPanel>
97
                            </ControlTemplate>
98
                        </Validation.ErrorTemplate>
99
                    </TextBox>
100
                    <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1"/>
101
                </Grid>
102
            </StackPanel>
103
        </extToolkit:WizardPage>
104
        <extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
105
                                   Title="Finish"
106
                                   Description="Press finish to create the account"
107
                                   CanFinish="True">
108
            <Grid>
109
                <Grid.RowDefinitions>
110
                    <RowDefinition Height="Auto"/>
111
                    <RowDefinition Height="Auto"/>
112
                    <RowDefinition Height="Auto"/>
113
                    <RowDefinition />
114
                </Grid.RowDefinitions>
115
                <Grid.ColumnDefinitions>
116
                    <ColumnDefinition Width="Auto"/>
117
                    <ColumnDefinition />
118
                </Grid.ColumnDefinitions>
119
                <TextBlock Text="Account Name:" Grid.Column="0" Grid.Row="0" Margin="5,2"/>
120
                <TextBlock Text="{Binding AccountName}" Grid.Column="1" Grid.Row="0" Margin="5,2"/>
121
                <TextBlock Text="Token:" Grid.Column="0" Grid.Row="1" Margin="5,2"/>
122
                <TextBlock Text="{Binding Token}" Grid.Column="1" Grid.Row="1" Margin="5,2"/>
123
                <TextBlock Text="Account Path:" Grid.Column="0" Grid.Row="2" Margin="5,2"/>
124
                <TextBlock Text="{Binding AccountPath}" Grid.Column="1" Grid.Row="2" Margin="5,2"/>
125
                
126
            <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="3" Margin="5"/>
127
            </Grid>
128
        </extToolkit:WizardPage>
129
    </extToolkit:Wizard>
130
    
131
</Window>