1 // -----------------------------------------------------------------------
2 // <copyright file="PithosSettings.cs" company="Microsoft">
3 // TODO: Update copyright text.
5 // -----------------------------------------------------------------------
7 using System.ComponentModel.Composition;
8 using System.Configuration;
10 using Pithos.Client.WPF.Properties;
11 using Pithos.Interfaces;
13 namespace Pithos.Client.WPF.Configuration
16 using System.Collections.Generic;
20 [Export(typeof(IPithosSettings))]
22 public class PithosSettings : IPithosSettings
24 private readonly Settings _settings = Settings.Default;
26 public PithosSettings()
31 public bool UseDefaultProxy
33 get { return _settings.UseDefaultProxy; }
34 set { _settings.UseDefaultProxy = value; }
37 public bool UseManualProxy
39 get { return _settings.UseManualProxy; }
40 set { _settings.UseManualProxy = value; }
43 public bool UseNoProxy
45 get { return _settings.UseNoProxy; }
46 set { _settings.UseNoProxy = value; }
49 public string PithosPath
51 get { return _settings.PithosPath; }
52 set { _settings.PithosPath = value; }
55 /* public string PithosSite
57 get { return _settings.PithosSite; }
60 public string PithosLoginUrl
62 get { return _settings.PithosLoginUrl; }
65 public string IconsPath
67 get { return _settings.IconPath; }
68 set { _settings.IconPath = value; }
71 public string UserName
73 get { return _settings.UserName; }
74 set { _settings.UserName = value; }
79 get { return _settings.ApiKey; }
80 set { _settings.ApiKey = value; }
83 public AccountsCollection Accounts
87 if (_settings.Accounts==null)
88 _settings.Accounts=new AccountsCollection();
89 return _settings.Accounts;
91 set { _settings.Accounts = value; }
94 public string ProxyServer
96 get { return _settings.ProxyServer; }
97 set { _settings.ProxyServer = value; }
102 get { return _settings.ProxyPort; }
103 set { _settings.ProxyPort = value; }
106 public string ProxyUsername
108 get { return _settings.ProxyUsername; }
109 set { _settings.ProxyUsername = value; }
113 public string ProxyPassword
115 get { return _settings.ProxyPassword; }
116 set { _settings.ProxyPassword = value; }
119 public bool ProxyAuthentication
122 get { return _settings.ProxyAuthentication; }
123 set { _settings.ProxyAuthentication = value; }
128 public bool ExtensionsActivated
131 get { return _settings.ExtensionsActivated; }
132 set { _settings.ExtensionsActivated = value; }
135 public bool ShowDesktopNotifications
137 get { return _settings.ShowDesktopNotifications; }
138 set { _settings.ShowDesktopNotifications = value; }
141 public override IEnumerable<string> GetDynamicMemberNames()
143 return (from SettingsProperty property in _settings.Properties
144 select property.Name);
148 private Lazy<ILookup<string, SettingsProperty>> _propertyNames = new Lazy<ILookup<string, SettingsProperty>>(
149 () => (from SettingsProperty property in
151 select property).ToLookup(property => property.Name));
153 public override bool TryGetMember(GetMemberBinder binder, out object result)
156 if (!_propertyNames.Value.Contains(binder.Name))
158 result=_settings.Properties[binder.Name];