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 public bool UseDefaultProxy
26 get { return Settings.Default.UseDefaultProxy; }
27 set { Settings.Default.UseDefaultProxy = value; }
30 public bool UseManualProxy
32 get { return Settings.Default.UseManualProxy; }
33 set { Settings.Default.UseManualProxy = value; }
36 public bool UseNoProxy
38 get { return Settings.Default.UseNoProxy; }
39 set { Settings.Default.UseNoProxy = value; }
42 public string PithosPath
44 get { return Settings.Default.PithosPath; }
45 set { Settings.Default.PithosPath = value; }
48 public string PithosSite
50 get { return Settings.Default.PithosSite; }
53 public string PithosLoginUrl
55 get { return Settings.Default.PithosLoginUrl; }
58 public string IconsPath
60 get { return Settings.Default.IconPath; }
61 set { Settings.Default.IconPath = value; }
64 public string UserName
66 get { return Settings.Default.UserName; }
67 set { Settings.Default.UserName = value; }
72 get { return Settings.Default.ApiKey; }
73 set { Settings.Default.ApiKey = value; }
76 public AccountsCollection Accounts
78 get { return Settings.Default.Accounts; }
79 set { Settings.Default.Accounts = value; }
82 public string ProxyServer
84 get { return Settings.Default.ProxyServer; }
85 set { Settings.Default.ProxyServer = value; }
90 get { return Settings.Default.ProxyPort; }
91 set { Settings.Default.ProxyPort = value; }
94 public string ProxyUsername
96 get { return Settings.Default.ProxyUsername; }
97 set { Settings.Default.ProxyUsername = value; }
101 public string ProxyPassword
103 get { return Settings.Default.ProxyPassword; }
104 set { Settings.Default.ProxyPassword = value; }
107 public bool ProxyAuthentication
110 get { return Settings.Default.ProxyAuthentication; }
111 set { Settings.Default.ProxyAuthentication = value; }
116 public bool ExtensionsActivated
119 get { return Settings.Default.ExtensionsActivated; }
120 set { Settings.Default.ExtensionsActivated = value; }
123 public bool ShowDesktopNotifications
125 get { return Settings.Default.ShowDesktopNotifications; }
126 set { Settings.Default.ShowDesktopNotifications = value; }
129 public override IEnumerable<string> GetDynamicMemberNames()
131 return (from SettingsProperty property in Settings.Default.Properties
132 select property.Name);
136 private Lazy<ILookup<string, SettingsProperty>> _propertyNames = new Lazy<ILookup<string, SettingsProperty>>(
137 () => (from SettingsProperty property in
138 Settings.Default.Properties
139 select property).ToLookup(property => property.Name));
141 public override bool TryGetMember(GetMemberBinder binder, out object result)
144 if (!_propertyNames.Value.Contains(binder.Name))
146 result=Settings.Default.Properties[binder.Name];
153 Settings.Default.Save();
158 Settings.Default.Reload();