Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (3.9 kB)

1 255f5f86 Panagiotis Kanavos
#region
2 255f5f86 Panagiotis Kanavos
/* -----------------------------------------------------------------------
3 255f5f86 Panagiotis Kanavos
 * <copyright file="AddAccountView.xaml.cs" company="GRNet">
4 255f5f86 Panagiotis Kanavos
 * 
5 255f5f86 Panagiotis Kanavos
 * Copyright 2011-2012 GRNET S.A. All rights reserved.
6 255f5f86 Panagiotis Kanavos
 *
7 255f5f86 Panagiotis Kanavos
 * Redistribution and use in source and binary forms, with or
8 255f5f86 Panagiotis Kanavos
 * without modification, are permitted provided that the following
9 255f5f86 Panagiotis Kanavos
 * conditions are met:
10 255f5f86 Panagiotis Kanavos
 *
11 255f5f86 Panagiotis Kanavos
 *   1. Redistributions of source code must retain the above
12 255f5f86 Panagiotis Kanavos
 *      copyright notice, this list of conditions and the following
13 255f5f86 Panagiotis Kanavos
 *      disclaimer.
14 255f5f86 Panagiotis Kanavos
 *
15 255f5f86 Panagiotis Kanavos
 *   2. Redistributions in binary form must reproduce the above
16 255f5f86 Panagiotis Kanavos
 *      copyright notice, this list of conditions and the following
17 255f5f86 Panagiotis Kanavos
 *      disclaimer in the documentation and/or other materials
18 255f5f86 Panagiotis Kanavos
 *      provided with the distribution.
19 255f5f86 Panagiotis Kanavos
 *
20 255f5f86 Panagiotis Kanavos
 *
21 255f5f86 Panagiotis Kanavos
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
22 255f5f86 Panagiotis Kanavos
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 255f5f86 Panagiotis Kanavos
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 255f5f86 Panagiotis Kanavos
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
25 255f5f86 Panagiotis Kanavos
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 255f5f86 Panagiotis Kanavos
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 255f5f86 Panagiotis Kanavos
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 255f5f86 Panagiotis Kanavos
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 255f5f86 Panagiotis Kanavos
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 255f5f86 Panagiotis Kanavos
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 255f5f86 Panagiotis Kanavos
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 255f5f86 Panagiotis Kanavos
 * POSSIBILITY OF SUCH DAMAGE.
33 255f5f86 Panagiotis Kanavos
 *
34 255f5f86 Panagiotis Kanavos
 * The views and conclusions contained in the software and
35 255f5f86 Panagiotis Kanavos
 * documentation are those of the authors and should not be
36 255f5f86 Panagiotis Kanavos
 * interpreted as representing official policies, either expressed
37 255f5f86 Panagiotis Kanavos
 * or implied, of GRNET S.A.
38 255f5f86 Panagiotis Kanavos
 * </copyright>
39 255f5f86 Panagiotis Kanavos
 * -----------------------------------------------------------------------
40 255f5f86 Panagiotis Kanavos
 */
41 255f5f86 Panagiotis Kanavos
#endregion
42 255f5f86 Panagiotis Kanavos
using System;
43 77f3c897 Panagiotis Kanavos
using System.Collections.Generic;
44 77f3c897 Panagiotis Kanavos
using System.Linq;
45 77f3c897 Panagiotis Kanavos
using System.Text;
46 77f3c897 Panagiotis Kanavos
using System.Windows;
47 77f3c897 Panagiotis Kanavos
using System.Windows.Controls;
48 77f3c897 Panagiotis Kanavos
using System.Windows.Data;
49 77f3c897 Panagiotis Kanavos
using System.Windows.Documents;
50 77f3c897 Panagiotis Kanavos
using System.Windows.Input;
51 77f3c897 Panagiotis Kanavos
using System.Windows.Media;
52 77f3c897 Panagiotis Kanavos
using System.Windows.Media.Imaging;
53 77f3c897 Panagiotis Kanavos
using System.Windows.Shapes;
54 3ddbb7b8 Panagiotis Kanavos
using Microsoft.Windows.Controls;
55 77f3c897 Panagiotis Kanavos
56 77f3c897 Panagiotis Kanavos
namespace Pithos.Client.WPF.Preferences
57 77f3c897 Panagiotis Kanavos
{
58 77f3c897 Panagiotis Kanavos
    /// <summary>
59 77f3c897 Panagiotis Kanavos
    /// Interaction logic for AddAccountView.xaml
60 77f3c897 Panagiotis Kanavos
    /// </summary>
61 77f3c897 Panagiotis Kanavos
    public partial class AddAccountView : Window
62 77f3c897 Panagiotis Kanavos
    {
63 77f3c897 Panagiotis Kanavos
        public AddAccountView()
64 77f3c897 Panagiotis Kanavos
        {
65 f734ab5b Panagiotis Kanavos
            InitializeComponent();
66 3ddbb7b8 Panagiotis Kanavos
        }
67 3ddbb7b8 Panagiotis Kanavos
68 f734ab5b Panagiotis Kanavos
69 3ddbb7b8 Panagiotis Kanavos
        private void Automatic_Checked(object sender, RoutedEventArgs e)
70 3ddbb7b8 Panagiotis Kanavos
        {
71 3ddbb7b8 Panagiotis Kanavos
            ChooseMethodPage.NextPage = AutoAccountPage;
72 3ddbb7b8 Panagiotis Kanavos
            ChooseMethodPage.CanSelectNextPage = true;
73 3ddbb7b8 Panagiotis Kanavos
        }
74 3ddbb7b8 Panagiotis Kanavos
75 3ddbb7b8 Panagiotis Kanavos
        private void Manually_Checked(object sender, RoutedEventArgs e)
76 3ddbb7b8 Panagiotis Kanavos
        {
77 3ddbb7b8 Panagiotis Kanavos
            ChooseMethodPage.NextPage = ManualAccountPage;
78 3ddbb7b8 Panagiotis Kanavos
            ChooseMethodPage.CanSelectNextPage = true;
79 3ddbb7b8 Panagiotis Kanavos
        }
80 3ddbb7b8 Panagiotis Kanavos
81 3ddbb7b8 Panagiotis Kanavos
82 3ddbb7b8 Panagiotis Kanavos
        Stack<WizardPage>  _history=new Stack<WizardPage>();
83 3ddbb7b8 Panagiotis Kanavos
84 3ddbb7b8 Panagiotis Kanavos
        private void AccountWizard_PageChanged(object sender, RoutedEventArgs e)
85 3ddbb7b8 Panagiotis Kanavos
        {
86 3ddbb7b8 Panagiotis Kanavos
            WizardPage lastPage=null;
87 3ddbb7b8 Panagiotis Kanavos
            if (_history.Count>1 && _history.ElementAt(1) == AccountWizard.CurrentPage)
88 3ddbb7b8 Panagiotis Kanavos
            {
89 3ddbb7b8 Panagiotis Kanavos
                _history.Pop();
90 3ddbb7b8 Panagiotis Kanavos
                _history.Pop();
91 3ddbb7b8 Panagiotis Kanavos
            }
92 3ddbb7b8 Panagiotis Kanavos
            if (_history.Count > 0)
93 3ddbb7b8 Panagiotis Kanavos
                lastPage = _history.Peek();
94 3ddbb7b8 Panagiotis Kanavos
95 3ddbb7b8 Panagiotis Kanavos
            if (lastPage != null)
96 3ddbb7b8 Panagiotis Kanavos
                AccountWizard.CurrentPage.PreviousPage = lastPage;
97 3ddbb7b8 Panagiotis Kanavos
98 3ddbb7b8 Panagiotis Kanavos
            _history.Push(AccountWizard.CurrentPage);
99 3ddbb7b8 Panagiotis Kanavos
100 77f3c897 Panagiotis Kanavos
        }
101 53032fb7 Panagiotis Kanavos
102 53032fb7 Panagiotis Kanavos
        private void OnTargetUpdated(object sender, DataTransferEventArgs e)
103 53032fb7 Panagiotis Kanavos
        {
104 53032fb7 Panagiotis Kanavos
            //It is not enough to change the value of the CanSelectNextPage property of the page to enable
105 53032fb7 Panagiotis Kanavos
            //the next page button.
106 53032fb7 Panagiotis Kanavos
            //Must force the re-evaluation of the NextPage command's CanExecute method             
107 53032fb7 Panagiotis Kanavos
            if (e.Property == WizardPage.CanSelectNextPageProperty)
108 53032fb7 Panagiotis Kanavos
                CommandManager.InvalidateRequerySuggested();
109 53032fb7 Panagiotis Kanavos
        }
110 77f3c897 Panagiotis Kanavos
    }
111 77f3c897 Panagiotis Kanavos
}