Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Configuration / PithosSettings.cs @ 20e9a378

History | View | Annotate | Download (4.4 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
    [Export]
22
    public class PithosSettings :  IPithosSettings
23
    {
24
        public bool UseDefaultProxy
25
        {
26
            get { return Settings.Default.UseDefaultProxy; }
27
            set { Settings.Default.UseDefaultProxy = value; }
28
        }
29

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

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

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

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

    
53
        public string PithosLoginUrl
54
        {
55
            get { return Settings.Default.PithosLoginUrl; }
56
        }
57

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

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

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

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

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

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

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

    
100

    
101
        public string ProxyPassword
102
        {
103
            get { return Settings.Default.ProxyPassword; }
104
            set { Settings.Default.ProxyPassword = value; }
105
        }
106

    
107
        public bool ProxyAuthentication
108
        {
109

    
110
            get { return Settings.Default.ProxyAuthentication; }
111
            set { Settings.Default.ProxyAuthentication = value; }
112
        }
113

    
114
        
115
        
116
        public bool ExtensionsActivated
117
        {
118

    
119
            get { return Settings.Default.ExtensionsActivated; }
120
            set { Settings.Default.ExtensionsActivated = value; }
121
        }
122

    
123
        public bool ShowDesktopNotifications
124
        {
125
            get { return Settings.Default.ShowDesktopNotifications; }
126
            set { Settings.Default.ShowDesktopNotifications = value; }
127
        }
128
/*
129
        public override IEnumerable<string> GetDynamicMemberNames()
130
        {
131
            return (from SettingsProperty property in Settings.Default.Properties
132
                        select property.Name);
133
        }
134

    
135

    
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));
140

    
141
        public override bool TryGetMember(GetMemberBinder binder, out object result)
142
        {
143
            result = null;
144
            if (!_propertyNames.Value.Contains(binder.Name))
145
                return false;
146
            result=Settings.Default.Properties[binder.Name];
147
            return true;
148
        }
149
*/
150

    
151
        public void Save()
152
        {
153
            Settings.Default.Save();
154
        }
155

    
156
        public void Reload()
157
        {
158
            Settings.Default.Reload();
159
        }
160
    }
161
}