// -----------------------------------------------------------------------
//
// TODO: Update copyright text.
//
// -----------------------------------------------------------------------
using System.ComponentModel.Composition;
using System.Configuration;
using System.Dynamic;
using Pithos.Client.WPF.Properties;
using Pithos.Interfaces;
namespace Pithos.Client.WPF.Configuration
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
[Export(typeof(IPithosSettings))]
[Export]
public class PithosSettings : IPithosSettings
{
public bool UseDefaultProxy
{
get { return Settings.Default.UseDefaultProxy; }
set { Settings.Default.UseDefaultProxy = value; }
}
public bool UseManualProxy
{
get { return Settings.Default.UseManualProxy; }
set { Settings.Default.UseManualProxy = value; }
}
public bool UseNoProxy
{
get { return Settings.Default.UseNoProxy; }
set { Settings.Default.UseNoProxy = value; }
}
public string PithosPath
{
get { return Settings.Default.PithosPath; }
set { Settings.Default.PithosPath = value; }
}
public string PithosSite
{
get { return Settings.Default.PithosSite; }
}
public string PithosLoginUrl
{
get { return Settings.Default.PithosLoginUrl; }
}
public string IconsPath
{
get { return Settings.Default.IconPath; }
set { Settings.Default.IconPath = value; }
}
public string UserName
{
get { return Settings.Default.UserName; }
set { Settings.Default.UserName = value; }
}
public string ApiKey
{
get { return Settings.Default.ApiKey; }
set { Settings.Default.ApiKey = value; }
}
public AccountsCollection Accounts
{
get { return Settings.Default.Accounts; }
set { Settings.Default.Accounts = value; }
}
public string ProxyServer
{
get { return Settings.Default.ProxyServer; }
set { Settings.Default.ProxyServer = value; }
}
public int ProxyPort
{
get { return Settings.Default.ProxyPort; }
set { Settings.Default.ProxyPort = value; }
}
public string ProxyUsername
{
get { return Settings.Default.ProxyUsername; }
set { Settings.Default.ProxyUsername = value; }
}
public string ProxyPassword
{
get { return Settings.Default.ProxyPassword; }
set { Settings.Default.ProxyPassword = value; }
}
public bool ProxyAuthentication
{
get { return Settings.Default.ProxyAuthentication; }
set { Settings.Default.ProxyAuthentication = value; }
}
public bool ExtensionsActivated
{
get { return Settings.Default.ExtensionsActivated; }
set { Settings.Default.ExtensionsActivated = value; }
}
public bool ShowDesktopNotifications
{
get { return Settings.Default.ShowDesktopNotifications; }
set { Settings.Default.ShowDesktopNotifications = value; }
}
/*
public override IEnumerable GetDynamicMemberNames()
{
return (from SettingsProperty property in Settings.Default.Properties
select property.Name);
}
private Lazy> _propertyNames = new Lazy>(
() => (from SettingsProperty property in
Settings.Default.Properties
select property).ToLookup(property => property.Name));
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
result = null;
if (!_propertyNames.Value.Contains(binder.Name))
return false;
result=Settings.Default.Properties[binder.Name];
return true;
}
*/
public void Save()
{
Settings.Default.Save();
}
public void Reload()
{
Settings.Default.Reload();
}
}
}