root / trunk / Pithos.Client.WPF / Configuration / PithosSettings.cs @ 049333d2
History | View | Annotate | Download (6.9 kB)
1 |
#region |
---|---|
2 |
/* ----------------------------------------------------------------------- |
3 |
* <copyright file="PithosSettings.cs" company="GRNet"> |
4 |
* |
5 |
* Copyright 2011-2012 GRNET S.A. All rights reserved. |
6 |
* |
7 |
* Redistribution and use in source and binary forms, with or |
8 |
* without modification, are permitted provided that the following |
9 |
* conditions are met: |
10 |
* |
11 |
* 1. Redistributions of source code must retain the above |
12 |
* copyright notice, this list of conditions and the following |
13 |
* disclaimer. |
14 |
* |
15 |
* 2. Redistributions in binary form must reproduce the above |
16 |
* copyright notice, this list of conditions and the following |
17 |
* disclaimer in the documentation and/or other materials |
18 |
* provided with the distribution. |
19 |
* |
20 |
* |
21 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
22 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
23 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
24 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
25 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
26 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
27 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
28 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
29 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
31 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
32 |
* POSSIBILITY OF SUCH DAMAGE. |
33 |
* |
34 |
* The views and conclusions contained in the software and |
35 |
* documentation are those of the authors and should not be |
36 |
* interpreted as representing official policies, either expressed |
37 |
* or implied, of GRNET S.A. |
38 |
* </copyright> |
39 |
* ----------------------------------------------------------------------- |
40 |
*/ |
41 |
#endregion |
42 |
using System.ComponentModel.Composition; |
43 |
using System.Configuration; |
44 |
using System.Diagnostics; |
45 |
using System.Dynamic; |
46 |
using Pithos.Client.WPF.Properties; |
47 |
using Pithos.Interfaces; |
48 |
|
49 |
namespace Pithos.Client.WPF.Configuration |
50 |
{ |
51 |
using System; |
52 |
using System.Collections.Generic; |
53 |
using System.Linq; |
54 |
using System.Text; |
55 |
|
56 |
[Export(typeof(IPithosSettings))] |
57 |
[Export] |
58 |
public class PithosSettings : IPithosSettings |
59 |
{ |
60 |
private readonly Settings _settings = Settings.Default; |
61 |
|
62 |
public PithosSettings() |
63 |
{ |
64 |
//Settings should already be upgraded by the time we reach this point |
65 |
Debug.Assert(!_settings.MustUpgrade); |
66 |
//_settings.Upgrade(); |
67 |
} |
68 |
|
69 |
public bool UseDefaultProxy |
70 |
{ |
71 |
get { return _settings.UseDefaultProxy; } |
72 |
set { _settings.UseDefaultProxy = value; } |
73 |
} |
74 |
|
75 |
public bool UseManualProxy |
76 |
{ |
77 |
get { return _settings.UseManualProxy; } |
78 |
set { _settings.UseManualProxy = value; } |
79 |
} |
80 |
|
81 |
public bool UseNoProxy |
82 |
{ |
83 |
get { return _settings.UseNoProxy; } |
84 |
set { _settings.UseNoProxy = value; } |
85 |
} |
86 |
|
87 |
public string PithosPath |
88 |
{ |
89 |
get { return _settings.PithosPath; } |
90 |
set { _settings.PithosPath = value; } |
91 |
} |
92 |
|
93 |
/* public string PithosSite |
94 |
{ |
95 |
get { return _settings.PithosSite; } |
96 |
}*/ |
97 |
|
98 |
public string PithosLoginUrl |
99 |
{ |
100 |
get { return _settings.PithosLoginUrl; } |
101 |
} |
102 |
|
103 |
public string IconsPath |
104 |
{ |
105 |
get { return _settings.IconPath; } |
106 |
set { _settings.IconPath = value; } |
107 |
} |
108 |
|
109 |
public string UserName |
110 |
{ |
111 |
get { return _settings.UserName; } |
112 |
set { _settings.UserName = value; } |
113 |
} |
114 |
|
115 |
public string ApiKey |
116 |
{ |
117 |
get { return _settings.ApiKey; } |
118 |
set { _settings.ApiKey = value; } |
119 |
} |
120 |
|
121 |
public AccountsCollection Accounts |
122 |
{ |
123 |
get { return _settings.Accounts ?? (_settings.Accounts = new AccountsCollection()); } |
124 |
set { _settings.Accounts = value; } |
125 |
} |
126 |
|
127 |
public string ProxyServer |
128 |
{ |
129 |
get { return _settings.ProxyServer; } |
130 |
set { _settings.ProxyServer = value; } |
131 |
} |
132 |
|
133 |
public int ProxyPort |
134 |
{ |
135 |
get { return _settings.ProxyPort; } |
136 |
set { _settings.ProxyPort = value; } |
137 |
} |
138 |
|
139 |
public string ProxyUsername |
140 |
{ |
141 |
get { return _settings.ProxyUsername; } |
142 |
set { _settings.ProxyUsername = value; } |
143 |
} |
144 |
|
145 |
|
146 |
public string ProxyPassword |
147 |
{ |
148 |
get { return _settings.ProxyPassword; } |
149 |
set { _settings.ProxyPassword = value; } |
150 |
} |
151 |
|
152 |
public string ProxyDomain |
153 |
{ |
154 |
get { return _settings.ProxyDomain; } |
155 |
set { _settings.ProxyDomain = value; } |
156 |
} |
157 |
|
158 |
public bool ProxyAuthentication |
159 |
{ |
160 |
|
161 |
get { return _settings.ProxyAuthentication; } |
162 |
set { _settings.ProxyAuthentication = value; } |
163 |
} |
164 |
|
165 |
|
166 |
|
167 |
public bool ExtensionsActivated |
168 |
{ |
169 |
|
170 |
get { return _settings.ExtensionsActivated; } |
171 |
set { _settings.ExtensionsActivated = value; } |
172 |
} |
173 |
|
174 |
public bool ShowDesktopNotifications |
175 |
{ |
176 |
get { return _settings.ShowDesktopNotifications; } |
177 |
set { _settings.ShowDesktopNotifications = value; } |
178 |
} |
179 |
|
180 |
|
181 |
public int PollingInterval |
182 |
{ |
183 |
get { return _settings.PollingInterval; } |
184 |
set |
185 |
{ |
186 |
if (value <= 0) |
187 |
throw new ArgumentOutOfRangeException(); |
188 |
_settings.PollingInterval = value; |
189 |
} |
190 |
} |
191 |
|
192 |
public TimeSpan StartupDelay |
193 |
{ |
194 |
get { return _settings.StartupDelay; } |
195 |
set |
196 |
{ |
197 |
if (value < TimeSpan.Zero) |
198 |
throw new ArgumentOutOfRangeException(); |
199 |
_settings.StartupDelay = value; |
200 |
} |
201 |
} |
202 |
|
203 |
|
204 |
public bool StartOnSystemStartup |
205 |
{ |
206 |
get { return _settings.StartOnSystemStartup; } |
207 |
set |
208 |
{ |
209 |
_settings.StartOnSystemStartup = value; |
210 |
} |
211 |
} |
212 |
|
213 |
public byte HashingParallelism |
214 |
{ |
215 |
get { return _settings.HashingParallelism; } |
216 |
set { _settings.HashingParallelism = value; } |
217 |
} |
218 |
|
219 |
public string UpdateUrl |
220 |
{ |
221 |
get { return _settings.UpdateUrl; } |
222 |
} |
223 |
|
224 |
public bool UpdateDiagnostics |
225 |
{ |
226 |
get { return _settings.UpdateDiagnostics; } |
227 |
} |
228 |
|
229 |
public TimeSpan UpdateCheckInterval |
230 |
{ |
231 |
get { return _settings.UpdateCheckInterval; } |
232 |
} |
233 |
|
234 |
public void Save() |
235 |
{ |
236 |
_settings.Save(); |
237 |
Proxy.SetFromSettings(this); |
238 |
} |
239 |
|
240 |
public void Reload() |
241 |
{ |
242 |
_settings.Reload(); |
243 |
} |
244 |
|
245 |
public void Reset() |
246 |
{ |
247 |
_settings.Reset(); |
248 |
_settings.Save(); |
249 |
} |
250 |
} |
251 |
} |