Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Preferences / AddAccountView.xaml.cs @ 422c9598

History | View | Annotate | Download (2.1 kB)

1 77f3c897 Panagiotis Kanavos
using System;
2 77f3c897 Panagiotis Kanavos
using System.Collections.Generic;
3 77f3c897 Panagiotis Kanavos
using System.Linq;
4 77f3c897 Panagiotis Kanavos
using System.Text;
5 77f3c897 Panagiotis Kanavos
using System.Windows;
6 77f3c897 Panagiotis Kanavos
using System.Windows.Controls;
7 77f3c897 Panagiotis Kanavos
using System.Windows.Data;
8 77f3c897 Panagiotis Kanavos
using System.Windows.Documents;
9 77f3c897 Panagiotis Kanavos
using System.Windows.Input;
10 77f3c897 Panagiotis Kanavos
using System.Windows.Media;
11 77f3c897 Panagiotis Kanavos
using System.Windows.Media.Imaging;
12 77f3c897 Panagiotis Kanavos
using System.Windows.Shapes;
13 3ddbb7b8 Panagiotis Kanavos
using Microsoft.Windows.Controls;
14 77f3c897 Panagiotis Kanavos
15 77f3c897 Panagiotis Kanavos
namespace Pithos.Client.WPF.Preferences
16 77f3c897 Panagiotis Kanavos
{
17 77f3c897 Panagiotis Kanavos
    /// <summary>
18 77f3c897 Panagiotis Kanavos
    /// Interaction logic for AddAccountView.xaml
19 77f3c897 Panagiotis Kanavos
    /// </summary>
20 77f3c897 Panagiotis Kanavos
    public partial class AddAccountView : Window
21 77f3c897 Panagiotis Kanavos
    {
22 77f3c897 Panagiotis Kanavos
        public AddAccountView()
23 77f3c897 Panagiotis Kanavos
        {
24 f734ab5b Panagiotis Kanavos
            InitializeComponent();
25 3ddbb7b8 Panagiotis Kanavos
        }
26 3ddbb7b8 Panagiotis Kanavos
27 f734ab5b Panagiotis Kanavos
28 3ddbb7b8 Panagiotis Kanavos
        private void Automatic_Checked(object sender, RoutedEventArgs e)
29 3ddbb7b8 Panagiotis Kanavos
        {
30 3ddbb7b8 Panagiotis Kanavos
            ChooseMethodPage.NextPage = AutoAccountPage;
31 3ddbb7b8 Panagiotis Kanavos
            ChooseMethodPage.CanSelectNextPage = true;
32 3ddbb7b8 Panagiotis Kanavos
        }
33 3ddbb7b8 Panagiotis Kanavos
34 3ddbb7b8 Panagiotis Kanavos
        private void Manually_Checked(object sender, RoutedEventArgs e)
35 3ddbb7b8 Panagiotis Kanavos
        {
36 3ddbb7b8 Panagiotis Kanavos
            ChooseMethodPage.NextPage = ManualAccountPage;
37 3ddbb7b8 Panagiotis Kanavos
            ChooseMethodPage.CanSelectNextPage = true;
38 3ddbb7b8 Panagiotis Kanavos
        }
39 3ddbb7b8 Panagiotis Kanavos
40 3ddbb7b8 Panagiotis Kanavos
41 3ddbb7b8 Panagiotis Kanavos
        Stack<WizardPage>  _history=new Stack<WizardPage>();
42 3ddbb7b8 Panagiotis Kanavos
43 3ddbb7b8 Panagiotis Kanavos
        private void AccountWizard_PageChanged(object sender, RoutedEventArgs e)
44 3ddbb7b8 Panagiotis Kanavos
        {
45 3ddbb7b8 Panagiotis Kanavos
            WizardPage lastPage=null;
46 3ddbb7b8 Panagiotis Kanavos
            if (_history.Count>1 && _history.ElementAt(1) == AccountWizard.CurrentPage)
47 3ddbb7b8 Panagiotis Kanavos
            {
48 3ddbb7b8 Panagiotis Kanavos
                _history.Pop();
49 3ddbb7b8 Panagiotis Kanavos
                _history.Pop();
50 3ddbb7b8 Panagiotis Kanavos
            }
51 3ddbb7b8 Panagiotis Kanavos
            if (_history.Count > 0)
52 3ddbb7b8 Panagiotis Kanavos
                lastPage = _history.Peek();
53 3ddbb7b8 Panagiotis Kanavos
54 3ddbb7b8 Panagiotis Kanavos
            if (lastPage != null)
55 3ddbb7b8 Panagiotis Kanavos
                AccountWizard.CurrentPage.PreviousPage = lastPage;
56 3ddbb7b8 Panagiotis Kanavos
57 3ddbb7b8 Panagiotis Kanavos
            _history.Push(AccountWizard.CurrentPage);
58 3ddbb7b8 Panagiotis Kanavos
59 77f3c897 Panagiotis Kanavos
        }
60 53032fb7 Panagiotis Kanavos
61 53032fb7 Panagiotis Kanavos
        private void OnTargetUpdated(object sender, DataTransferEventArgs e)
62 53032fb7 Panagiotis Kanavos
        {
63 53032fb7 Panagiotis Kanavos
            //It is not enough to change the value of the CanSelectNextPage property of the page to enable
64 53032fb7 Panagiotis Kanavos
            //the next page button.
65 53032fb7 Panagiotis Kanavos
            //Must force the re-evaluation of the NextPage command's CanExecute method             
66 53032fb7 Panagiotis Kanavos
            if (e.Property == WizardPage.CanSelectNextPageProperty)
67 53032fb7 Panagiotis Kanavos
                CommandManager.InvalidateRequerySuggested();
68 53032fb7 Panagiotis Kanavos
        }
69 77f3c897 Panagiotis Kanavos
    }
70 77f3c897 Panagiotis Kanavos
}