Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Preferences / AccountViewModel.cs @ 31c97141

History | View | Annotate | Download (3.7 kB)

1 31c97141 Panagiotis Kanavos
#region
2 31c97141 Panagiotis Kanavos
/* -----------------------------------------------------------------------
3 31c97141 Panagiotis Kanavos
 * <copyright file="AccountViewModel.cs" company="GRNet">
4 31c97141 Panagiotis Kanavos
 * 
5 31c97141 Panagiotis Kanavos
 * Copyright 2011-2012 GRNET S.A. All rights reserved.
6 31c97141 Panagiotis Kanavos
 *
7 31c97141 Panagiotis Kanavos
 * Redistribution and use in source and binary forms, with or
8 31c97141 Panagiotis Kanavos
 * without modification, are permitted provided that the following
9 31c97141 Panagiotis Kanavos
 * conditions are met:
10 31c97141 Panagiotis Kanavos
 *
11 31c97141 Panagiotis Kanavos
 *   1. Redistributions of source code must retain the above
12 31c97141 Panagiotis Kanavos
 *      copyright notice, this list of conditions and the following
13 31c97141 Panagiotis Kanavos
 *      disclaimer.
14 31c97141 Panagiotis Kanavos
 *
15 31c97141 Panagiotis Kanavos
 *   2. Redistributions in binary form must reproduce the above
16 31c97141 Panagiotis Kanavos
 *      copyright notice, this list of conditions and the following
17 31c97141 Panagiotis Kanavos
 *      disclaimer in the documentation and/or other materials
18 31c97141 Panagiotis Kanavos
 *      provided with the distribution.
19 31c97141 Panagiotis Kanavos
 *
20 31c97141 Panagiotis Kanavos
 *
21 31c97141 Panagiotis Kanavos
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
22 31c97141 Panagiotis Kanavos
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 31c97141 Panagiotis Kanavos
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 31c97141 Panagiotis Kanavos
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
25 31c97141 Panagiotis Kanavos
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 31c97141 Panagiotis Kanavos
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 31c97141 Panagiotis Kanavos
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 31c97141 Panagiotis Kanavos
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 31c97141 Panagiotis Kanavos
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 31c97141 Panagiotis Kanavos
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 31c97141 Panagiotis Kanavos
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 31c97141 Panagiotis Kanavos
 * POSSIBILITY OF SUCH DAMAGE.
33 31c97141 Panagiotis Kanavos
 *
34 31c97141 Panagiotis Kanavos
 * The views and conclusions contained in the software and
35 31c97141 Panagiotis Kanavos
 * documentation are those of the authors and should not be
36 31c97141 Panagiotis Kanavos
 * interpreted as representing official policies, either expressed
37 31c97141 Panagiotis Kanavos
 * or implied, of GRNET S.A.
38 31c97141 Panagiotis Kanavos
 * </copyright>
39 31c97141 Panagiotis Kanavos
 * -----------------------------------------------------------------------
40 31c97141 Panagiotis Kanavos
 */
41 31c97141 Panagiotis Kanavos
#endregion
42 31c97141 Panagiotis Kanavos
using Caliburn.Micro;
43 31c97141 Panagiotis Kanavos
using Pithos.Interfaces;
44 31c97141 Panagiotis Kanavos
45 31c97141 Panagiotis Kanavos
namespace Pithos.Client.WPF.Preferences
46 31c97141 Panagiotis Kanavos
{
47 31c97141 Panagiotis Kanavos
    /// <summary>
48 31c97141 Panagiotis Kanavos
    /// ViewModel wrapper for an account
49 31c97141 Panagiotis Kanavos
    /// </summary>
50 31c97141 Panagiotis Kanavos
    public class AccountViewModel:PropertyChangedBase
51 31c97141 Panagiotis Kanavos
    {
52 31c97141 Panagiotis Kanavos
53 31c97141 Panagiotis Kanavos
        private readonly AccountSettings _account;
54 31c97141 Panagiotis Kanavos
        
55 31c97141 Panagiotis Kanavos
        public AccountSettings Account
56 31c97141 Panagiotis Kanavos
        {
57 31c97141 Panagiotis Kanavos
            get { return _account; }
58 31c97141 Panagiotis Kanavos
        }
59 31c97141 Panagiotis Kanavos
60 31c97141 Panagiotis Kanavos
        public AccountViewModel(AccountSettings account)
61 31c97141 Panagiotis Kanavos
        {
62 31c97141 Panagiotis Kanavos
            _account = account;            
63 31c97141 Panagiotis Kanavos
        }
64 31c97141 Panagiotis Kanavos
65 31c97141 Panagiotis Kanavos
66 31c97141 Panagiotis Kanavos
        public string AccountName
67 31c97141 Panagiotis Kanavos
        {
68 31c97141 Panagiotis Kanavos
            get {
69 31c97141 Panagiotis Kanavos
                return _account.AccountName;
70 31c97141 Panagiotis Kanavos
            }
71 31c97141 Panagiotis Kanavos
            set {
72 31c97141 Panagiotis Kanavos
                _account.AccountName = value;
73 31c97141 Panagiotis Kanavos
                NotifyOfPropertyChange(()=>AccountName);
74 31c97141 Panagiotis Kanavos
            }
75 31c97141 Panagiotis Kanavos
        }
76 31c97141 Panagiotis Kanavos
77 31c97141 Panagiotis Kanavos
        public string RootPath
78 31c97141 Panagiotis Kanavos
        {
79 31c97141 Panagiotis Kanavos
            get { return _account.RootPath; }
80 31c97141 Panagiotis Kanavos
            set 
81 31c97141 Panagiotis Kanavos
            { 
82 31c97141 Panagiotis Kanavos
                _account.RootPath = value;
83 31c97141 Panagiotis Kanavos
                NotifyOfPropertyChange(()=>RootPath);
84 31c97141 Panagiotis Kanavos
            }
85 31c97141 Panagiotis Kanavos
        }
86 31c97141 Panagiotis Kanavos
87 31c97141 Panagiotis Kanavos
        public bool IsActive
88 31c97141 Panagiotis Kanavos
        {
89 31c97141 Panagiotis Kanavos
            get { return _account.IsActive; }
90 31c97141 Panagiotis Kanavos
            set
91 31c97141 Panagiotis Kanavos
            { 
92 31c97141 Panagiotis Kanavos
                _account.IsActive = value;
93 31c97141 Panagiotis Kanavos
                NotifyOfPropertyChange(()=>IsActive);
94 31c97141 Panagiotis Kanavos
            }
95 31c97141 Panagiotis Kanavos
        }
96 31c97141 Panagiotis Kanavos
97 31c97141 Panagiotis Kanavos
        public bool IsExpired
98 31c97141 Panagiotis Kanavos
        {
99 31c97141 Panagiotis Kanavos
            get { return _account.IsExpired; }
100 31c97141 Panagiotis Kanavos
            set 
101 31c97141 Panagiotis Kanavos
            { 
102 31c97141 Panagiotis Kanavos
                _account.IsExpired = value;
103 31c97141 Panagiotis Kanavos
                NotifyOfPropertyChange(()=>IsExpired);
104 31c97141 Panagiotis Kanavos
            }
105 31c97141 Panagiotis Kanavos
        }
106 31c97141 Panagiotis Kanavos
107 31c97141 Panagiotis Kanavos
        public string ServerUrl
108 31c97141 Panagiotis Kanavos
        {
109 31c97141 Panagiotis Kanavos
            get { return _account.ServerUrl; }
110 31c97141 Panagiotis Kanavos
            set 
111 31c97141 Panagiotis Kanavos
            { 
112 31c97141 Panagiotis Kanavos
                _account.ServerUrl = value;
113 31c97141 Panagiotis Kanavos
                NotifyOfPropertyChange(()=>ServerUrl);
114 31c97141 Panagiotis Kanavos
            }
115 31c97141 Panagiotis Kanavos
        }
116 31c97141 Panagiotis Kanavos
117 31c97141 Panagiotis Kanavos
        public string ApiKey
118 31c97141 Panagiotis Kanavos
        {
119 31c97141 Panagiotis Kanavos
            get { return _account.ApiKey; }
120 31c97141 Panagiotis Kanavos
            set 
121 31c97141 Panagiotis Kanavos
            {
122 31c97141 Panagiotis Kanavos
                _account.ApiKey = value;
123 31c97141 Panagiotis Kanavos
                NotifyOfPropertyChange(() => ApiKey);
124 31c97141 Panagiotis Kanavos
            }
125 31c97141 Panagiotis Kanavos
        }
126 31c97141 Panagiotis Kanavos
127 31c97141 Panagiotis Kanavos
128 31c97141 Panagiotis Kanavos
    }
129 31c97141 Panagiotis Kanavos
}