Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Configuration / PithosSettings.cs @ 5bcf6d70

History | View | Annotate | Download (4.1 kB)

1
// -----------------------------------------------------------------------
2
// <copyright file="PithosSettings.cs" company="Microsoft">
3
// TODO: Update copyright text.
4
// </copyright>
5
// -----------------------------------------------------------------------
6

    
7
using System.ComponentModel.Composition;
8
using System.Configuration;
9
using System.Dynamic;
10
using Pithos.Client.WPF.Properties;
11
using Pithos.Interfaces;
12

    
13
namespace Pithos.Client.WPF.Configuration
14
{
15
    using System;
16
    using System.Collections.Generic;
17
    using System.Linq;
18
    using System.Text;
19

    
20
    [Export(typeof(IPithosSettings))]
21
    public class PithosSettings :  IPithosSettings
22
    {
23
        public bool UseDefaultProxy
24
        {
25
            get { return Settings.Default.UseDefaultProxy; }
26
            set { Settings.Default.UseDefaultProxy = value; }
27
        }
28

    
29
        public bool UseManualProxy
30
        {
31
            get { return Settings.Default.UseManualProxy; }
32
            set { Settings.Default.UseManualProxy = value; }
33
        }
34

    
35
        public bool UseNoProxy
36
        {
37
            get { return Settings.Default.UseNoProxy; }
38
            set { Settings.Default.UseNoProxy = value; }
39
        }
40

    
41
        public string PithosPath
42
        {
43
            get { return Settings.Default.PithosPath; }
44
            set { Settings.Default.PithosPath = value; }
45
        }
46

    
47
        public string PithosSite
48
        {
49
            get { return Settings.Default.PithosSite; }
50
        }
51

    
52
        public string IconsPath
53
        {
54
            get { return Settings.Default.IconPath; }
55
            set { Settings.Default.IconPath = value; }
56
        }
57

    
58
        public string UserName
59
        {
60
            get { return Settings.Default.UserName; }
61
            set { Settings.Default.UserName = value; }
62
        }
63

    
64
        public string ApiKey
65
        {
66
            get { return Settings.Default.ApiKey; }
67
            set { Settings.Default.ApiKey = value; }
68
        }
69

    
70
        public AccountsCollection Accounts
71
        {
72
            get { return Settings.Default.Accounts; }
73
            set { Settings.Default.Accounts = value; }
74
        }
75

    
76
        public string ProxyServer
77
        {
78
            get { return Settings.Default.ProxyServer; }
79
            set { Settings.Default.ProxyServer = value; }
80
        }
81

    
82
        public int ProxyPort
83
        {
84
            get { return Settings.Default.ProxyPort; }
85
            set { Settings.Default.ProxyPort = value; }
86
        }
87

    
88
        public string ProxyUsername
89
        {
90
            get { return Settings.Default.ProxyUsername; }
91
            set { Settings.Default.ProxyUsername = value; }
92
        }
93

    
94

    
95
        public string ProxyPassword
96
        {
97
            get { return Settings.Default.ProxyPassword; }
98
            set { Settings.Default.ProxyPassword = value; }
99
        }
100

    
101
        public bool ProxyAuthentication
102
        {
103

    
104
            get { return Settings.Default.ProxyAuthentication; }
105
            set { Settings.Default.ProxyAuthentication = value; }
106
        }
107
        
108
        public bool ExtensionsActivated
109
        {
110

    
111
            get { return Settings.Default.ExtensionsActivated; }
112
            set { Settings.Default.ExtensionsActivated = value; }
113
        }
114

    
115
/*
116
        public override IEnumerable<string> GetDynamicMemberNames()
117
        {
118
            return (from SettingsProperty property in Settings.Default.Properties
119
                        select property.Name);
120
        }
121

    
122

    
123
        private Lazy<ILookup<string, SettingsProperty>> _propertyNames = new Lazy<ILookup<string, SettingsProperty>>(
124
            () => (from SettingsProperty property in
125
                       Settings.Default.Properties
126
                   select property).ToLookup(property => property.Name));
127

    
128
        public override bool TryGetMember(GetMemberBinder binder, out object result)
129
        {
130
            result = null;
131
            if (!_propertyNames.Value.Contains(binder.Name))
132
                return false;
133
            result=Settings.Default.Properties[binder.Name];
134
            return true;
135
        }
136
*/
137

    
138
        public void Save()
139
        {
140
            Settings.Default.Save();
141
        }
142

    
143
        public void Reload()
144
        {
145
            Settings.Default.Reload();
146
        }
147
    }
148
}