Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Preferences / AddAccountView.xaml @ 52e8e7d9

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

    
160
                <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="5" Margin="5"/>
161
            </Grid>
162
        </extToolkit:WizardPage>
163
    </extToolkit:Wizard>
164
    
165
</Window>