Statistics
| Branch: | Revision:

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

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