root / trunk / Pithos.Client.WPF / Configuration / PithosSettings.cs @ 759bd3c4
History | View | Annotate | Download (6.4 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.Dynamic; |
45 |
using Pithos.Client.WPF.Properties; |
46 |
using Pithos.Interfaces; |
47 |
|
48 |
namespace Pithos.Client.WPF.Configuration |
49 |
{ |
50 |
using System; |
51 |
using System.Collections.Generic; |
52 |
using System.Linq; |
53 |
using System.Text; |
54 |
|
55 |
[Export(typeof(IPithosSettings))] |
56 |
[Export] |
57 |
public class PithosSettings : IPithosSettings |
58 |
{ |
59 |
private readonly Settings _settings = Settings.Default; |
60 |
|
61 |
public PithosSettings() |
62 |
{ |
63 |
_settings.Upgrade(); |
64 |
} |
65 |
|
66 |
public bool UseDefaultProxy |
67 |
{ |
68 |
get { return _settings.UseDefaultProxy; } |
69 |
set { _settings.UseDefaultProxy = value; } |
70 |
} |
71 |
|
72 |
public bool UseManualProxy |
73 |
{ |
74 |
get { return _settings.UseManualProxy; } |
75 |
set { _settings.UseManualProxy = value; } |
76 |
} |
77 |
|
78 |
public bool UseNoProxy |
79 |
{ |
80 |
get { return _settings.UseNoProxy; } |
81 |
set { _settings.UseNoProxy = value; } |
82 |
} |
83 |
|
84 |
public string PithosPath |
85 |
{ |
86 |
get { return _settings.PithosPath; } |
87 |
set { _settings.PithosPath = value; } |
88 |
} |
89 |
|
90 |
/* public string PithosSite |
91 |
{ |
92 |
get { return _settings.PithosSite; } |
93 |
}*/ |
94 |
|
95 |
public string PithosLoginUrl |
96 |
{ |
97 |
get { return _settings.PithosLoginUrl; } |
98 |
} |
99 |
|
100 |
public string IconsPath |
101 |
{ |
102 |
get { return _settings.IconPath; } |
103 |
set { _settings.IconPath = value; } |
104 |
} |
105 |
|
106 |
public string UserName |
107 |
{ |
108 |
get { return _settings.UserName; } |
109 |
set { _settings.UserName = value; } |
110 |
} |
111 |
|
112 |
public string ApiKey |
113 |
{ |
114 |
get { return _settings.ApiKey; } |
115 |
set { _settings.ApiKey = value; } |
116 |
} |
117 |
|
118 |
public AccountsCollection Accounts |
119 |
{ |
120 |
get |
121 |
{ |
122 |
if (_settings.Accounts==null) |
123 |
_settings.Accounts=new AccountsCollection(); |
124 |
return _settings.Accounts; |
125 |
} |
126 |
set { _settings.Accounts = value; } |
127 |
} |
128 |
|
129 |
public string ProxyServer |
130 |
{ |
131 |
get { return _settings.ProxyServer; } |
132 |
set { _settings.ProxyServer = value; } |
133 |
} |
134 |
|
135 |
public int ProxyPort |
136 |
{ |
137 |
get { return _settings.ProxyPort; } |
138 |
set { _settings.ProxyPort = value; } |
139 |
} |
140 |
|
141 |
public string ProxyUsername |
142 |
{ |
143 |
get { return _settings.ProxyUsername; } |
144 |
set { _settings.ProxyUsername = value; } |
145 |
} |
146 |
|
147 |
|
148 |
public string ProxyPassword |
149 |
{ |
150 |
get { return _settings.ProxyPassword; } |
151 |
set { _settings.ProxyPassword = value; } |
152 |
} |
153 |
|
154 |
public string ProxyDomain |
155 |
{ |
156 |
get { return _settings.ProxyDomain; } |
157 |
set { _settings.ProxyDomain = value; } |
158 |
} |
159 |
|
160 |
public bool ProxyAuthentication |
161 |
{ |
162 |
|
163 |
get { return _settings.ProxyAuthentication; } |
164 |
set { _settings.ProxyAuthentication = value; } |
165 |
} |
166 |
|
167 |
|
168 |
|
169 |
public bool ExtensionsActivated |
170 |
{ |
171 |
|
172 |
get { return _settings.ExtensionsActivated; } |
173 |
set { _settings.ExtensionsActivated = value; } |
174 |
} |
175 |
|
176 |
public bool ShowDesktopNotifications |
177 |
{ |
178 |
get { return _settings.ShowDesktopNotifications; } |
179 |
set { _settings.ShowDesktopNotifications = value; } |
180 |
} |
181 |
|
182 |
|
183 |
public int PollingInterval |
184 |
{ |
185 |
get { return _settings.PollingInterval; } |
186 |
set |
187 |
{ |
188 |
if (value <= 0) |
189 |
throw new ArgumentOutOfRangeException(); |
190 |
_settings.PollingInterval = value; |
191 |
} |
192 |
} |
193 |
|
194 |
public TimeSpan StartupDelay |
195 |
{ |
196 |
get { return _settings.StartupDelay; } |
197 |
set |
198 |
{ |
199 |
if (value < TimeSpan.Zero) |
200 |
throw new ArgumentOutOfRangeException(); |
201 |
_settings.StartupDelay = value; |
202 |
} |
203 |
} |
204 |
|
205 |
|
206 |
public bool StartOnSystemStartup |
207 |
{ |
208 |
get { return _settings.StartOnSystemStartup; } |
209 |
set |
210 |
{ |
211 |
_settings.StartOnSystemStartup = value; |
212 |
} |
213 |
} |
214 |
|
215 |
public byte HashingParallelism |
216 |
{ |
217 |
get { return _settings.HashingParallelism; } |
218 |
set { _settings.HashingParallelism = value; } |
219 |
} |
220 |
|
221 |
public void Save() |
222 |
{ |
223 |
_settings.Save(); |
224 |
Proxy.SetFromSettings(this); |
225 |
} |
226 |
|
227 |
public void Reload() |
228 |
{ |
229 |
_settings.Reload(); |
230 |
} |
231 |
} |
232 |
} |