Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (12.8 kB)

1 77f3c897 Panagiotis Kanavos
<Window x:Class="Pithos.Client.WPF.Preferences.AddAccountView"
2 77f3c897 Panagiotis Kanavos
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 77f3c897 Panagiotis Kanavos
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 3ddbb7b8 Panagiotis Kanavos
        xmlns:cal="http://www.caliburnproject.org"
5 77f3c897 Panagiotis Kanavos
        xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
6 3ddbb7b8 Panagiotis Kanavos
        Title="AddAccountView" Height="300" Width="467" xmlns:my="clr-namespace:Microsoft.Windows.Controls.Core.Converters;assembly=WPFToolkit.Extended"
7 3ddbb7b8 Panagiotis Kanavos
        xmlns:Preferences="clr-namespace:Pithos.Client.WPF.Preferences">
8 3ddbb7b8 Panagiotis Kanavos
    <Window.Resources>
9 3ddbb7b8 Panagiotis Kanavos
        <my:InverseBoolConverter x:Key="InverseBool" />
10 3ddbb7b8 Panagiotis Kanavos
        <BooleanToVisibilityConverter x:Key="BoolToVisible" />
11 3ddbb7b8 Panagiotis Kanavos
    </Window.Resources>
12 53032fb7 Panagiotis Kanavos
    <extToolkit:Wizard FinishButtonClosesWindow="True" Name="AccountWizard" PageChanged="AccountWizard_PageChanged" HelpButtonVisibility="Collapsed">
13 77f3c897 Panagiotis Kanavos
        <extToolkit:WizardPage x:Name="IntroPage" 
14 77f3c897 Panagiotis Kanavos
                                   Title="Add new Pithos Account"
15 06f11e8b Panagiotis Kanavos
                                   Description="This Wizard will walk you through adding a new Pithos account and retrieving an authentication token" 
16 06f11e8b Panagiotis Kanavos
                               BackButtonVisibility="Collapsed"
17 fe62b7f4 Panagiotis Kanavos
                               FinishButtonVisibility="Collapsed"
18 fe62b7f4 Panagiotis Kanavos
                               />
19 f734ab5b Panagiotis Kanavos
        <extToolkit:WizardPage x:Name="ChooseServer" PageType="Interior"
20 f734ab5b Panagiotis Kanavos
                                   Title="Where do you want to connect?"
21 f734ab5b Panagiotis Kanavos
                                   Description="You can connect to the production or development server, or enter your own server URL"                               
22 06f11e8b Panagiotis Kanavos
                               FinishButtonVisibility="Collapsed"
23 f734ab5b Panagiotis Kanavos
                                    CanSelectNextPage="{Binding IsValidServer}"
24 fe62b7f4 Panagiotis Kanavos
                               
25 f734ab5b Panagiotis Kanavos
                                    >
26 f734ab5b Panagiotis Kanavos
            <StackPanel >
27 f734ab5b Panagiotis Kanavos
                <Label Content="Pithos Server" Target="{Binding ElementName=Servers}"  />
28 f734ab5b Panagiotis Kanavos
                <ComboBox x:Name="Servers" IsEditable="True" ItemsSource="{Binding Servers}"
29 f734ab5b Panagiotis Kanavos
                          Text="{Binding CurrentServer,ValidatesOnExceptions=True, Mode=TwoWay}" >                        
30 f734ab5b Panagiotis Kanavos
                    <Validation.ErrorTemplate>
31 f734ab5b Panagiotis Kanavos
                        <ControlTemplate>
32 f734ab5b Panagiotis Kanavos
                            <StackPanel>
33 f734ab5b Panagiotis Kanavos
                                <AdornedElementPlaceholder />
34 f734ab5b Panagiotis Kanavos
                                <TextBlock Foreground="Red" >Invalid Path</TextBlock>
35 f734ab5b Panagiotis Kanavos
                            </StackPanel>
36 f734ab5b Panagiotis Kanavos
                        </ControlTemplate>
37 f734ab5b Panagiotis Kanavos
                    </Validation.ErrorTemplate>
38 f734ab5b Panagiotis Kanavos
                </ComboBox>                
39 f734ab5b Panagiotis Kanavos
            </StackPanel>
40 f734ab5b Panagiotis Kanavos
        </extToolkit:WizardPage>
41 77f3c897 Panagiotis Kanavos
        <extToolkit:WizardPage x:Name="ChooseMethodPage" PageType="Interior"
42 77f3c897 Panagiotis Kanavos
                                   Title="How do you want to add the account?"
43 3ddbb7b8 Panagiotis Kanavos
                                   Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually"                               
44 06f11e8b Panagiotis Kanavos
                               FinishButtonVisibility="Collapsed"
45 fe62b7f4 Panagiotis Kanavos
                                    CanSelectNextPage="False"
46 fe62b7f4 Panagiotis Kanavos
                               >
47 77f3c897 Panagiotis Kanavos
            <StackPanel >
48 3ddbb7b8 Panagiotis Kanavos
                <RadioButton x:Name="Automatic" Content="By logging to Pithos" Checked="Automatic_Checked" Margin="5"/>
49 3ddbb7b8 Panagiotis Kanavos
                <RadioButton x:Name="Manually" Content="Manually" Checked="Manually_Checked" Margin="5"/>
50 77f3c897 Panagiotis Kanavos
            </StackPanel>
51 77f3c897 Panagiotis Kanavos
        </extToolkit:WizardPage>
52 77f3c897 Panagiotis Kanavos
        <extToolkit:WizardPage x:Name="ManualAccountPage" PageType="Interior"
53 77f3c897 Panagiotis Kanavos
                                   Title="Add an account manually"
54 f734ab5b Panagiotis Kanavos
                                   Description="Please enter the account credentials and press &quot;Validate Credentials&quot;"
55 3ddbb7b8 Panagiotis Kanavos
                               NextPage="{Binding ElementName=AccountPathPage}"                               
56 06f11e8b Panagiotis Kanavos
                               FinishButtonVisibility="Collapsed"
57 53032fb7 Panagiotis Kanavos
                               CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=True}" 
58 53032fb7 Panagiotis Kanavos
                               TargetUpdated="OnTargetUpdated"
59 fe62b7f4 Panagiotis Kanavos
                               
60 77f3c897 Panagiotis Kanavos
                               >
61 8dd2bdfb Panagiotis Kanavos
            <extToolkit:BusyIndicator x:Name="ManualBusyIndicator" IsBusy="{Binding IsWorking,NotifyOnSourceUpdated=true}" DisplayAfter="0" >
62 f734ab5b Panagiotis Kanavos
                <extToolkit:BusyIndicator.BusyContent>
63 8dd2bdfb Panagiotis Kanavos
                    <TextBlock x:Name="ManualBusyMessage" Text="{Binding BusyTitle}" HorizontalAlignment="Center" />
64 f734ab5b Panagiotis Kanavos
                </extToolkit:BusyIndicator.BusyContent>
65 f734ab5b Panagiotis Kanavos
                <extToolkit:BusyIndicator.Content>
66 f734ab5b Panagiotis Kanavos
                    <Grid>
67 f734ab5b Panagiotis Kanavos
                        <Grid.ColumnDefinitions>
68 f734ab5b Panagiotis Kanavos
                            <ColumnDefinition Width="Auto"/>
69 f734ab5b Panagiotis Kanavos
                            <ColumnDefinition Width="91*"/>
70 f734ab5b Panagiotis Kanavos
                        </Grid.ColumnDefinitions>
71 f734ab5b Panagiotis Kanavos
                        <Grid.RowDefinitions>
72 f734ab5b Panagiotis Kanavos
                            <RowDefinition Height="Auto"/>
73 f734ab5b Panagiotis Kanavos
                            <RowDefinition Height="Auto"/>
74 f734ab5b Panagiotis Kanavos
                            <RowDefinition Height="Auto"/>
75 f734ab5b Panagiotis Kanavos
                            <RowDefinition />
76 f734ab5b Panagiotis Kanavos
                        </Grid.RowDefinitions>
77 f734ab5b Panagiotis Kanavos
                        <Label Content="Account" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
78 f734ab5b Panagiotis Kanavos
                        <TextBox Name="AccountName" Grid.Column="1" Grid.Row="0" Margin="5"/>
79 f734ab5b Panagiotis Kanavos
                        <Label Content="API Key" Grid.Column="0" Grid.Row="1" Margin="0,5" HorizontalAlignment="Left"/>
80 f734ab5b Panagiotis Kanavos
                        <TextBox  Name="Token" Grid.Column="1" Grid.Row="1" Margin="5"/>
81 f734ab5b Panagiotis Kanavos
                        <Button x:Name="TestManualAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
82 06f11e8b Panagiotis Kanavos
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding ValidationMessage}" Margin="10" HorizontalAlignment="Center"/>
83 f734ab5b Panagiotis Kanavos
                    </Grid>
84 f734ab5b Panagiotis Kanavos
                </extToolkit:BusyIndicator.Content>
85 f734ab5b Panagiotis Kanavos
            </extToolkit:BusyIndicator>
86 77f3c897 Panagiotis Kanavos
        </extToolkit:WizardPage>
87 77f3c897 Panagiotis Kanavos
        <extToolkit:WizardPage x:Name="AutoAccountPage" PageType="Interior"
88 3ddbb7b8 Panagiotis Kanavos
                                   Title="Add an account automatically"
89 53032fb7 Panagiotis Kanavos
                                   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."                               
90 06f11e8b Panagiotis Kanavos
                               FinishButtonVisibility="Collapsed"
91 53032fb7 Panagiotis Kanavos
                               CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=true}"                               
92 53032fb7 Panagiotis Kanavos
                               TargetUpdated="OnTargetUpdated"
93 fe62b7f4 Panagiotis Kanavos
                               
94 77f3c897 Panagiotis Kanavos
                               >
95 52e8e7d9 Panagiotis Kanavos
            <extToolkit:BusyIndicator x:Name="AutoBusyIndicator" IsBusy="{Binding IsWorking}" DisplayAfter="0">
96 3ddbb7b8 Panagiotis Kanavos
                <extToolkit:BusyIndicator.BusyContent>
97 3ddbb7b8 Panagiotis Kanavos
                    <TextBlock  TextWrapping="Wrap">
98 8dd2bdfb Panagiotis Kanavos
                        <TextBlock HorizontalAlignment="Center" Text="{Binding BusyTitle}"/>
99 8dd2bdfb Panagiotis Kanavos
                        <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding BusyDetail}"/>
100 3ddbb7b8 Panagiotis Kanavos
                    </TextBlock>                    
101 3ddbb7b8 Panagiotis Kanavos
                </extToolkit:BusyIndicator.BusyContent>
102 3ddbb7b8 Panagiotis Kanavos
                <extToolkit:BusyIndicator.Content>
103 8dd2bdfb Panagiotis Kanavos
                    <StackPanel x:Name="AutoPanel" VerticalAlignment="Center" >
104 3ddbb7b8 Panagiotis Kanavos
                        <Button Margin="5" Name="RetrieveCredentials" Content="Retrieve Credentials" Width="150"/>
105 3ddbb7b8 Panagiotis Kanavos
                        <TextBlock Text="Credentials Retrieved Succesfully" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasCredentials}" Margin="10" HorizontalAlignment="Center"/>
106 f734ab5b Panagiotis Kanavos
                        <Button x:Name="TestAutoAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
107 52e8e7d9 Panagiotis Kanavos
                        
108 52e8e7d9 Panagiotis Kanavos
                        <TextBlock x:Name="ValidationMessage" Text="Credentials Validated" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasValidCredentials}" Margin="10" HorizontalAlignment="Center"/>
109 3ddbb7b8 Panagiotis Kanavos
                    </StackPanel>
110 3ddbb7b8 Panagiotis Kanavos
                </extToolkit:BusyIndicator.Content>
111 3ddbb7b8 Panagiotis Kanavos
                </extToolkit:BusyIndicator>
112 77f3c897 Panagiotis Kanavos
        </extToolkit:WizardPage>
113 77f3c897 Panagiotis Kanavos
        <extToolkit:WizardPage x:Name="AccountPathPage" PageType="Interior"
114 77f3c897 Panagiotis Kanavos
                                   Title="Select Account Path"
115 77f3c897 Panagiotis Kanavos
                                   Description="Please select the roor path for your account"
116 77f3c897 Panagiotis Kanavos
                               NextPage="{Binding ElementName=LastPage}"
117 06f11e8b Panagiotis Kanavos
                               FinishButtonVisibility="Collapsed"
118 3ddbb7b8 Panagiotis Kanavos
                               CanSelectNextPage="{Binding HasAccountPath}"
119 77f3c897 Panagiotis Kanavos
                                   >
120 77f3c897 Panagiotis Kanavos
            <StackPanel>
121 3ddbb7b8 Panagiotis Kanavos
                <Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
122 3ddbb7b8 Panagiotis Kanavos
                <Grid HorizontalAlignment="Stretch">
123 fe62b7f4 Panagiotis Kanavos
                    <Grid.RowDefinitions>
124 fe62b7f4 Panagiotis Kanavos
                        <RowDefinition Height="Auto"/>
125 fe62b7f4 Panagiotis Kanavos
                        <RowDefinition/>
126 fe62b7f4 Panagiotis Kanavos
                    </Grid.RowDefinitions>
127 3ddbb7b8 Panagiotis Kanavos
                    <Grid.ColumnDefinitions>
128 3ddbb7b8 Panagiotis Kanavos
                        <ColumnDefinition />
129 3ddbb7b8 Panagiotis Kanavos
                        <ColumnDefinition Width="Auto" />
130 3ddbb7b8 Panagiotis Kanavos
                    </Grid.ColumnDefinitions>
131 fe62b7f4 Panagiotis Kanavos
                    <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="0">
132 3ddbb7b8 Panagiotis Kanavos
                        <TextBox.Text>
133 3ddbb7b8 Panagiotis Kanavos
                            <Binding Path="AccountPath" Mode="TwoWay">
134 3ddbb7b8 Panagiotis Kanavos
                                <Binding.ValidationRules>
135 3ddbb7b8 Panagiotis Kanavos
                                    <Preferences:DirectoryExistsRule/>
136 3ddbb7b8 Panagiotis Kanavos
                                </Binding.ValidationRules>
137 3ddbb7b8 Panagiotis Kanavos
                            </Binding>
138 3ddbb7b8 Panagiotis Kanavos
                        </TextBox.Text>
139 3ddbb7b8 Panagiotis Kanavos
                       <Validation.ErrorTemplate>
140 3ddbb7b8 Panagiotis Kanavos
                            <ControlTemplate>
141 3ddbb7b8 Panagiotis Kanavos
                                <StackPanel>                                    
142 3ddbb7b8 Panagiotis Kanavos
                                    <AdornedElementPlaceholder />
143 3ddbb7b8 Panagiotis Kanavos
                                    <TextBlock Foreground="Red" >Invalid Path</TextBlock>
144 3ddbb7b8 Panagiotis Kanavos
                                </StackPanel>
145 3ddbb7b8 Panagiotis Kanavos
                            </ControlTemplate>
146 3ddbb7b8 Panagiotis Kanavos
                        </Validation.ErrorTemplate>
147 3ddbb7b8 Panagiotis Kanavos
                    </TextBox>
148 fe62b7f4 Panagiotis Kanavos
                    <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0"/>
149 fe62b7f4 Panagiotis Kanavos
                    <CheckBox x:Name="ShouldCreateOkeanosFolder"  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" >
150 fe62b7f4 Panagiotis Kanavos
                        <CheckBox.Content>
151 fe62b7f4 Panagiotis Kanavos
                            <TextBlock TextWrapping="Wrap">
152 fe62b7f4 Panagiotis Kanavos
                               Create an Okeanos folder below the selected folder
153 fe62b7f4 Panagiotis Kanavos
                                <LineBreak/>
154 fe62b7f4 Panagiotis Kanavos
                               Clear this setting to use the currently selected folder and synchronize its contents
155 fe62b7f4 Panagiotis Kanavos
                            </TextBlock>
156 fe62b7f4 Panagiotis Kanavos
                        </CheckBox.Content>
157 fe62b7f4 Panagiotis Kanavos
                    </CheckBox>
158 3ddbb7b8 Panagiotis Kanavos
                </Grid>
159 77f3c897 Panagiotis Kanavos
            </StackPanel>
160 77f3c897 Panagiotis Kanavos
        </extToolkit:WizardPage>
161 77f3c897 Panagiotis Kanavos
        <extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
162 77f3c897 Panagiotis Kanavos
                                   Title="Finish"
163 77f3c897 Panagiotis Kanavos
                                   Description="Press finish to create the account"
164 fe62b7f4 Panagiotis Kanavos
                                   CanFinish="True"
165 fe62b7f4 Panagiotis Kanavos
                               >
166 3ddbb7b8 Panagiotis Kanavos
            <Grid>
167 3ddbb7b8 Panagiotis Kanavos
                <Grid.RowDefinitions>
168 3ddbb7b8 Panagiotis Kanavos
                    <RowDefinition Height="Auto"/>
169 3ddbb7b8 Panagiotis Kanavos
                    <RowDefinition Height="Auto"/>
170 3ddbb7b8 Panagiotis Kanavos
                    <RowDefinition Height="Auto"/>
171 f734ab5b Panagiotis Kanavos
                    <RowDefinition Height="Auto"/>
172 74d78c90 Panagiotis Kanavos
                    <RowDefinition Height="Auto"/>
173 3ddbb7b8 Panagiotis Kanavos
                    <RowDefinition />
174 3ddbb7b8 Panagiotis Kanavos
                </Grid.RowDefinitions>
175 3ddbb7b8 Panagiotis Kanavos
                <Grid.ColumnDefinitions>
176 3ddbb7b8 Panagiotis Kanavos
                    <ColumnDefinition Width="Auto"/>
177 3ddbb7b8 Panagiotis Kanavos
                    <ColumnDefinition />
178 3ddbb7b8 Panagiotis Kanavos
                </Grid.ColumnDefinitions>
179 74d78c90 Panagiotis Kanavos
                <TextBlock Text="Server:" Grid.Column="0" Grid.Row="0" Margin="5,2"/>
180 74d78c90 Panagiotis Kanavos
                <TextBlock Text="{Binding CurrentServer}" Grid.Column="1" Grid.Row="0" Margin="5,2"/>
181 74d78c90 Panagiotis Kanavos
                <TextBlock Text="Account Name:" Grid.Column="0" Grid.Row="1" Margin="5,2"/>
182 74d78c90 Panagiotis Kanavos
                <TextBlock Text="{Binding AccountName}" Grid.Column="1" Grid.Row="1" Margin="5,2"/>
183 74d78c90 Panagiotis Kanavos
                <TextBlock Text="Token:" Grid.Column="0" Grid.Row="2" Margin="5,2"/>
184 74d78c90 Panagiotis Kanavos
                <TextBlock Text="{Binding Token}" Grid.Column="1" Grid.Row="2" Margin="5,2"/>
185 74d78c90 Panagiotis Kanavos
                <TextBlock Text="Account Path:" Grid.Column="0" Grid.Row="3" Margin="5,2"/>
186 74d78c90 Panagiotis Kanavos
                <TextBlock Text="{Binding AccountPath}" Grid.Column="1" Grid.Row="3" Margin="5,2"/>
187 f734ab5b Panagiotis Kanavos
188 74d78c90 Panagiotis Kanavos
                <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="5" Margin="5"/>
189 3ddbb7b8 Panagiotis Kanavos
            </Grid>
190 77f3c897 Panagiotis Kanavos
        </extToolkit:WizardPage>
191 77f3c897 Panagiotis Kanavos
    </extToolkit:Wizard>
192 77f3c897 Panagiotis Kanavos
    
193 52e8e7d9 Panagiotis Kanavos
</Window>