root / trunk / Pithos.Client.WPF / Configuration / PithosSettings.cs @ cd1bbba9
History | View | Annotate | Download (6.6 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 |
124 |
{ |
125 |
if (_settings.Accounts==null) |
126 |
_settings.Accounts=new AccountsCollection(); |
127 |
return _settings.Accounts; |
128 |
} |
129 |
set { _settings.Accounts = value; } |
130 |
} |
131 |
|
132 |
public string ProxyServer |
133 |
{ |
134 |
get { return _settings.ProxyServer; } |
135 |
set { _settings.ProxyServer = value; } |
136 |
} |
137 |
|
138 |
public int ProxyPort |
139 |
{ |
140 |
get { return _settings.ProxyPort; } |
141 |
set { _settings.ProxyPort = value; } |
142 |
} |
143 |
|
144 |
public string ProxyUsername |
145 |
{ |
146 |
get { return _settings.ProxyUsername; } |
147 |
set { _settings.ProxyUsername = value; } |
148 |
} |
149 |
|
150 |
|
151 |
public string ProxyPassword |
152 |
{ |
153 |
get { return _settings.ProxyPassword; } |
154 |
set { _settings.ProxyPassword = value; } |
155 |
} |
156 |
|
157 |
public string ProxyDomain |
158 |
{ |
159 |
get { return _settings.ProxyDomain; } |
160 |
set { _settings.ProxyDomain = value; } |
161 |
} |
162 |
|
163 |
public bool ProxyAuthentication |
164 |
{ |
165 |
|
166 |
get { return _settings.ProxyAuthentication; } |
167 |
set { _settings.ProxyAuthentication = value; } |
168 |
} |
169 |
|
170 |
|
171 |
|
172 |
public bool ExtensionsActivated |
173 |
{ |
174 |
|
175 |
get { return _settings.ExtensionsActivated; } |
176 |
set { _settings.ExtensionsActivated = value; } |
177 |
} |
178 |
|
179 |
public bool ShowDesktopNotifications |
180 |
{ |
181 |
get { return _settings.ShowDesktopNotifications; } |
182 |
set { _settings.ShowDesktopNotifications = value; } |
183 |
} |
184 |
|
185 |
|
186 |
public int PollingInterval |
187 |
{ |
188 |
get { return _settings.PollingInterval; } |
189 |
set |
190 |
{ |
191 |
if (value <= 0) |
192 |
throw new ArgumentOutOfRangeException(); |
193 |
_settings.PollingInterval = value; |
194 |
} |
195 |
} |
196 |
|
197 |
public TimeSpan StartupDelay |
198 |
{ |
199 |
get { return _settings.StartupDelay; } |
200 |
set |
201 |
{ |
202 |
if (value < TimeSpan.Zero) |
203 |
throw new ArgumentOutOfRangeException(); |
204 |
_settings.StartupDelay = value; |
205 |
} |
206 |
} |
207 |
|
208 |
|
209 |
public bool StartOnSystemStartup |
210 |
{ |
211 |
get { return _settings.StartOnSystemStartup; } |
212 |
set |
213 |
{ |
214 |
_settings.StartOnSystemStartup = value; |
215 |
} |
216 |
} |
217 |
|
218 |
public byte HashingParallelism |
219 |
{ |
220 |
get { return _settings.HashingParallelism; } |
221 |
set { _settings.HashingParallelism = value; } |
222 |
} |
223 |
|
224 |
public void Save() |
225 |
{ |
226 |
_settings.Save(); |
227 |
Proxy.SetFromSettings(this); |
228 |
} |
229 |
|
230 |
public void Reload() |
231 |
{ |
232 |
_settings.Reload(); |
233 |
} |
234 |
} |
235 |
} |