Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Configuration / PithosSettings.cs @ 74d78c90

History | View | Annotate | Download (4.5 kB)

1
// -----------------------------------------------------------------------
2
// <copyright file="PithosSettings.cs" company="Microsoft">
3
// TODO: Update copyright text.
4
// </copyright>
5
// -----------------------------------------------------------------------
6

    
7
using System.ComponentModel.Composition;
8
using System.Configuration;
9
using System.Dynamic;
10
using Pithos.Client.WPF.Properties;
11
using Pithos.Interfaces;
12

    
13
namespace Pithos.Client.WPF.Configuration
14
{
15
    using System;
16
    using System.Collections.Generic;
17
    using System.Linq;
18
    using System.Text;
19

    
20
    [Export(typeof(IPithosSettings))]
21
    [Export]
22
    public class PithosSettings :  IPithosSettings
23
    {
24
        private readonly Settings _settings = Settings.Default;
25

    
26
        public PithosSettings()
27
        {
28
                _settings.Upgrade();
29
        }
30

    
31
        public bool UseDefaultProxy
32
        {
33
            get { return _settings.UseDefaultProxy; }
34
            set { _settings.UseDefaultProxy = value; }
35
        }
36

    
37
        public bool UseManualProxy
38
        {
39
            get { return _settings.UseManualProxy; }
40
            set { _settings.UseManualProxy = value; }
41
        }
42

    
43
        public bool UseNoProxy
44
        {
45
            get { return _settings.UseNoProxy; }
46
            set { _settings.UseNoProxy = value; }
47
        }
48

    
49
        public string PithosPath
50
        {
51
            get { return _settings.PithosPath; }
52
            set { _settings.PithosPath = value; }
53
        }
54

    
55
      /*  public string PithosSite
56
        {
57
            get { return _settings.PithosSite; }
58
        }*/
59

    
60
        public string PithosLoginUrl
61
        {
62
            get { return _settings.PithosLoginUrl; }
63
        }
64

    
65
        public string IconsPath
66
        {
67
            get { return _settings.IconPath; }
68
            set { _settings.IconPath = value; }
69
        }
70

    
71
        public string UserName
72
        {
73
            get { return _settings.UserName; }
74
            set { _settings.UserName = value; }
75
        }
76

    
77
        public string ApiKey
78
        {
79
            get { return _settings.ApiKey; }
80
            set { _settings.ApiKey = value; }
81
        }
82

    
83
        public AccountsCollection Accounts
84
        {
85
            get
86
            {
87
                if (_settings.Accounts==null)
88
                    _settings.Accounts=new AccountsCollection();
89
                return _settings.Accounts;
90
            }
91
            set { _settings.Accounts = value; }
92
        }
93

    
94
        public string ProxyServer
95
        {
96
            get { return _settings.ProxyServer; }
97
            set { _settings.ProxyServer = value; }
98
        }
99

    
100
        public int ProxyPort
101
        {
102
            get { return _settings.ProxyPort; }
103
            set { _settings.ProxyPort = value; }
104
        }
105

    
106
        public string ProxyUsername
107
        {
108
            get { return _settings.ProxyUsername; }
109
            set { _settings.ProxyUsername = value; }
110
        }
111

    
112

    
113
        public string ProxyPassword
114
        {
115
            get { return _settings.ProxyPassword; }
116
            set { _settings.ProxyPassword = value; }
117
        }
118

    
119
        public bool ProxyAuthentication
120
        {
121

    
122
            get { return _settings.ProxyAuthentication; }
123
            set { _settings.ProxyAuthentication = value; }
124
        }
125

    
126
        
127
        
128
        public bool ExtensionsActivated
129
        {
130

    
131
            get { return _settings.ExtensionsActivated; }
132
            set { _settings.ExtensionsActivated = value; }
133
        }
134

    
135
        public bool ShowDesktopNotifications
136
        {
137
            get { return _settings.ShowDesktopNotifications; }
138
            set { _settings.ShowDesktopNotifications = value; }
139
        }
140
/*
141
        public override IEnumerable<string> GetDynamicMemberNames()
142
        {
143
            return (from SettingsProperty property in _settings.Properties
144
                        select property.Name);
145
        }
146

    
147

    
148
        private Lazy<ILookup<string, SettingsProperty>> _propertyNames = new Lazy<ILookup<string, SettingsProperty>>(
149
            () => (from SettingsProperty property in
150
                       _settings.Properties
151
                   select property).ToLookup(property => property.Name));
152

    
153
        public override bool TryGetMember(GetMemberBinder binder, out object result)
154
        {
155
            result = null;
156
            if (!_propertyNames.Value.Contains(binder.Name))
157
                return false;
158
            result=_settings.Properties[binder.Name];
159
            return true;
160
        }
161
*/
162

    
163
        public void Save()
164
        {
165
            _settings.Save();
166
        }
167

    
168
        public void Reload()
169
        {
170
            _settings.Reload();
171
        }
172
    }
173
}