Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (2.1 kB)

1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Windows;
6
using System.Windows.Controls;
7
using System.Windows.Data;
8
using System.Windows.Documents;
9
using System.Windows.Input;
10
using System.Windows.Media;
11
using System.Windows.Media.Imaging;
12
using System.Windows.Shapes;
13
using Microsoft.Windows.Controls;
14

    
15
namespace Pithos.Client.WPF.Preferences
16
{
17
    /// <summary>
18
    /// Interaction logic for AddAccountView.xaml
19
    /// </summary>
20
    public partial class AddAccountView : Window
21
    {
22
        public AddAccountView()
23
        {
24
            InitializeComponent();
25
        }
26

    
27

    
28
        private void Automatic_Checked(object sender, RoutedEventArgs e)
29
        {
30
            ChooseMethodPage.NextPage = AutoAccountPage;
31
            ChooseMethodPage.CanSelectNextPage = true;
32
        }
33

    
34
        private void Manually_Checked(object sender, RoutedEventArgs e)
35
        {
36
            ChooseMethodPage.NextPage = ManualAccountPage;
37
            ChooseMethodPage.CanSelectNextPage = true;
38
        }
39

    
40

    
41
        Stack<WizardPage>  _history=new Stack<WizardPage>();
42

    
43
        private void AccountWizard_PageChanged(object sender, RoutedEventArgs e)
44
        {
45
            WizardPage lastPage=null;
46
            if (_history.Count>1 && _history.ElementAt(1) == AccountWizard.CurrentPage)
47
            {
48
                _history.Pop();
49
                _history.Pop();
50
            }
51
            if (_history.Count > 0)
52
                lastPage = _history.Peek();
53

    
54
            if (lastPage != null)
55
                AccountWizard.CurrentPage.PreviousPage = lastPage;
56

    
57
            _history.Push(AccountWizard.CurrentPage);
58

    
59
        }
60

    
61
        private void OnTargetUpdated(object sender, DataTransferEventArgs e)
62
        {
63
            //It is not enough to change the value of the CanSelectNextPage property of the page to enable
64
            //the next page button.
65
            //Must force the re-evaluation of the NextPage command's CanExecute method             
66
            if (e.Property == WizardPage.CanSelectNextPageProperty)
67
                CommandManager.InvalidateRequerySuggested();
68
        }
69
    }
70
}