Revision f734ab5b

b/trunk/Pithos.Client.WPF/App.xaml.cs
21 21
    /// </summary>
22 22
    public partial class App : Application
23 23
    {
24
        private log4net.ILog Log = log4net.LogManager.GetLogger(typeof (App));
24
        private readonly log4net.ILog _log = log4net.LogManager.GetLogger(typeof (App));
25

  
25 26
        public App()
26 27
        {
27
            //var extensionController = new ShellExtensionController();
28
            //extensionController.RegisterExtensions();
29 28
            log4net.Config.XmlConfigurator.Configure();            
30

  
29
            
31 30
            this.DispatcherUnhandledException += OnUnhandledException;
32 31
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
33 32
            TaskScheduler.UnobservedTaskException += OnUnobservedException;
34 33

  
35
/*
36
            var appPatth =    Assembly.GetExecutingAssembly().Location;
37
            Registry.LocalMachine.SetValue(@"Software\Pithos\AppPath",appPatth );            
38
*/
39 34
            InitializeComponent();            
40
            //Application.Current.ApplyTheme("BureauBlue");
41 35
        }
42 36

  
43 37
        private void OnUnobservedException(object sender, UnobservedTaskExceptionEventArgs e)
......
104 98
        {
105 99
            var logMessage = CreateMessage(messages);
106 100

  
107
            Log.Error(logMessage);
108
        }
109

  
110
        private async void SendMessages(IEnumerable<UserMessage> messages )
111
        {
112
            var logMessage = CreateMessage(messages);
113

  
114
            var mailer = new SmtpClient();
115
            await mailer.SendTaskAsync("pithos@grnet.gr", "support@pithos.grnet.gr", "Errors", logMessage);
101
            _log.Error(logMessage);
116 102
        }
117 103

  
118 104
        private static string CreateMessage(IEnumerable<UserMessage> messages)
b/trunk/Pithos.Client.WPF/Configuration/PithosSettings.cs
21 21
    [Export]
22 22
    public class PithosSettings :  IPithosSettings
23 23
    {
24
        private readonly Settings _settings = Settings.Default;
25

  
24 26
        public bool UseDefaultProxy
25 27
        {
26
            get { return Settings.Default.UseDefaultProxy; }
27
            set { Settings.Default.UseDefaultProxy = value; }
28
            get { return _settings.UseDefaultProxy; }
29
            set { _settings.UseDefaultProxy = value; }
28 30
        }
29 31

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

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

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

  
48
        public string PithosSite
50
      /*  public string PithosSite
49 51
        {
50
            get { return Settings.Default.PithosSite; }
51
        }
52
            get { return _settings.PithosSite; }
53
        }*/
52 54

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

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

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

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

  
76 78
        public AccountsCollection Accounts
77 79
        {
78
            get { return Settings.Default.Accounts; }
79
            set { Settings.Default.Accounts = value; }
80
            get
81
            {
82
                if (_settings.Accounts==null)
83
                    _settings.Accounts=new AccountsCollection();
84
                return _settings.Accounts;
85
            }
86
            set { _settings.Accounts = value; }
80 87
        }
81 88

  
82 89
        public string ProxyServer
83 90
        {
84
            get { return Settings.Default.ProxyServer; }
85
            set { Settings.Default.ProxyServer = value; }
91
            get { return _settings.ProxyServer; }
92
            set { _settings.ProxyServer = value; }
86 93
        }
87 94

  
88 95
        public int ProxyPort
89 96
        {
90
            get { return Settings.Default.ProxyPort; }
91
            set { Settings.Default.ProxyPort = value; }
97
            get { return _settings.ProxyPort; }
98
            set { _settings.ProxyPort = value; }
92 99
        }
93 100

  
94 101
        public string ProxyUsername
95 102
        {
96
            get { return Settings.Default.ProxyUsername; }
97
            set { Settings.Default.ProxyUsername = value; }
103
            get { return _settings.ProxyUsername; }
104
            set { _settings.ProxyUsername = value; }
98 105
        }
99 106

  
100 107

  
101 108
        public string ProxyPassword
102 109
        {
103
            get { return Settings.Default.ProxyPassword; }
104
            set { Settings.Default.ProxyPassword = value; }
110
            get { return _settings.ProxyPassword; }
111
            set { _settings.ProxyPassword = value; }
105 112
        }
106 113

  
107 114
        public bool ProxyAuthentication
108 115
        {
109 116

  
110
            get { return Settings.Default.ProxyAuthentication; }
111
            set { Settings.Default.ProxyAuthentication = value; }
117
            get { return _settings.ProxyAuthentication; }
118
            set { _settings.ProxyAuthentication = value; }
112 119
        }
113 120

  
114 121
        
......
116 123
        public bool ExtensionsActivated
117 124
        {
118 125

  
119
            get { return Settings.Default.ExtensionsActivated; }
120
            set { Settings.Default.ExtensionsActivated = value; }
126
            get { return _settings.ExtensionsActivated; }
127
            set { _settings.ExtensionsActivated = value; }
121 128
        }
122 129

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

  
135 142

  
136 143
        private Lazy<ILookup<string, SettingsProperty>> _propertyNames = new Lazy<ILookup<string, SettingsProperty>>(
137 144
            () => (from SettingsProperty property in
138
                       Settings.Default.Properties
145
                       _settings.Properties
139 146
                   select property).ToLookup(property => property.Name));
140 147

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

  
151 158
        public void Save()
152 159
        {
153
            Settings.Default.Save();
160
            _settings.Save();
154 161
        }
155 162

  
156 163
        public void Reload()
157 164
        {
158
            Settings.Default.Reload();
165
            _settings.Reload();
159 166
        }
160 167
    }
161 168
}
b/trunk/Pithos.Client.WPF/FileProperties/FilePropertiesViewModel.cs
322 322
                Manifest = value.Manifest;
323 323
                IsPublic = value.IsPublic;
324 324
                if (IsPublic)
325
                    PublicUrl = String.Format("{0}/v1{1}", Settings.Default.PithosSite ,value.PublicUrl);
325
                    PublicUrl = String.Format("{0}/v1{1}", Shell.Accounts.First(account=>account.UserName==PithosFile.Account).SiteUri,value.PublicUrl);
326 326

  
327 327
                using (var icon = Icon.ExtractAssociatedIcon(LocalFileName))
328 328
                {
b/trunk/Pithos.Client.WPF/Preferences/AddAccountView.xaml
13 13
        <extToolkit:WizardPage x:Name="IntroPage" 
14 14
                                   Title="Add new Pithos Account"
15 15
                                   Description="This Wizard will walk you through adding a new Pithos account and retrieving an authentication token" />
16
        <extToolkit:WizardPage x:Name="ChooseServer" PageType="Interior"
17
                                   Title="Where do you want to connect?"
18
                                   Description="You can connect to the production or development server, or enter your own server URL"                               
19
                                    CanSelectNextPage="{Binding IsValidServer}"
20
                                    >
21
            <StackPanel >
22
                <Label Content="Pithos Server" Target="{Binding ElementName=Servers}"  />
23
                <ComboBox x:Name="Servers" IsEditable="True" ItemsSource="{Binding Servers}"
24
                          Text="{Binding CurrentServer,ValidatesOnExceptions=True, Mode=TwoWay}" >                        
25
                    <Validation.ErrorTemplate>
26
                        <ControlTemplate>
27
                            <StackPanel>
28
                                <AdornedElementPlaceholder />
29
                                <TextBlock Foreground="Red" >Invalid Path</TextBlock>
30
                            </StackPanel>
31
                        </ControlTemplate>
32
                    </Validation.ErrorTemplate>
33
                </ComboBox>                
34
            </StackPanel>
35
        </extToolkit:WizardPage>
16 36
        <extToolkit:WizardPage x:Name="ChooseMethodPage" PageType="Interior"
17 37
                                   Title="How do you want to add the account?"
18 38
                                   Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually"                               
......
24 44
        </extToolkit:WizardPage>
25 45
        <extToolkit:WizardPage x:Name="ManualAccountPage" PageType="Interior"
26 46
                                   Title="Add an account manually"
27
                                   Description="This is the second page in the process"
47
                                   Description="Please enter the account credentials and press &quot;Validate Credentials&quot;"
28 48
                               NextPage="{Binding ElementName=AccountPathPage}"                               
29
                               CanSelectNextPage="{Binding HasCredentials}"
49
                               CanSelectNextPage="{Binding HasValidCredentials}" 
30 50
                               >
31
            <Grid>
32
                <Grid.ColumnDefinitions>
33
                    <ColumnDefinition Width="Auto"/>
34
                    <ColumnDefinition Width="91*"/>
35
                </Grid.ColumnDefinitions>
36
                <Grid.RowDefinitions>
37
                    <RowDefinition Height="Auto"/>
38
                    <RowDefinition Height="Auto"/>
39
                    <RowDefinition />
40
                </Grid.RowDefinitions>
41
                <Label Content="Account" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
42
                <TextBox Name="AccountName" Grid.Column="1" Grid.Row="0" Margin="5"/>
43
                <Label Content="API Key" Grid.Column="0" Grid.Row="1" Margin="0,5" HorizontalAlignment="Left"/>
44
                <TextBox  Name="Token" Grid.Column="1" Grid.Row="1" Margin="5"/>
45
            </Grid>
51
            <extToolkit:BusyIndicator x:Name="ManualBusyIndicator" IsBusy="{Binding IsValidating,NotifyOnSourceUpdated=true}" DisplayAfter="0" >
52
                <extToolkit:BusyIndicator.BusyContent>
53
                    <TextBlock x:Name="ManualBusyMessage" Text="Validating credentials"  />
54
                </extToolkit:BusyIndicator.BusyContent>
55
                <extToolkit:BusyIndicator.Content>
56
                    <Grid>
57
                        <Grid.ColumnDefinitions>
58
                            <ColumnDefinition Width="Auto"/>
59
                            <ColumnDefinition Width="91*"/>
60
                        </Grid.ColumnDefinitions>
61
                        <Grid.RowDefinitions>
62
                            <RowDefinition Height="Auto"/>
63
                            <RowDefinition Height="Auto"/>
64
                            <RowDefinition Height="Auto"/>
65
                            <RowDefinition />
66
                        </Grid.RowDefinitions>
67
                        <Label Content="Account" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
68
                        <TextBox Name="AccountName" Grid.Column="1" Grid.Row="0" Margin="5"/>
69
                        <Label Content="API Key" Grid.Column="0" Grid.Row="1" Margin="0,5" HorizontalAlignment="Left"/>
70
                        <TextBox  Name="Token" Grid.Column="1" Grid.Row="1" Margin="5"/>
71
                        <Button x:Name="TestManualAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
72
                    </Grid>
73
                </extToolkit:BusyIndicator.Content>
74
            </extToolkit:BusyIndicator>
46 75
        </extToolkit:WizardPage>
47 76
        <extToolkit:WizardPage x:Name="AutoAccountPage" PageType="Interior"
48 77
                                   Title="Add an account automatically"
49 78
                                   Description="By clicking on the button below you will be taken to the Pithos web site where you can login with your username and password."
50 79
                               NextPage="{Binding ElementName=AutoConfirmedPage}"                               
51
                               CanSelectNextPage="{Binding IsConfirmed}"
80
                               CanSelectNextPage="{Binding HasValidCredentials}"
52 81
                               cal:Message.Attach="[Event GotFocus] = [Action RetrieveCredentials()]"
53 82
                               >
54 83
            <extToolkit:BusyIndicator IsBusy="{Binding IsRetrieving}">
......
63 92
                        <Button Margin="5" Name="RetrieveCredentials" Content="Retrieve Credentials" Width="150"/>
64 93

  
65 94
                        <TextBlock Text="Credentials Retrieved Succesfully" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasCredentials}" Margin="10" HorizontalAlignment="Center"/>
95
                        <Button x:Name="TestAutoAccount" Content="Validate Credentials" IsEnabled="{Binding HasCredentials}" HorizontalAlignment="Center" cal:Message.Attach="TestAccount" Margin="5"/>
66 96
                    </StackPanel>
67 97
                </extToolkit:BusyIndicator.Content>
68 98
                </extToolkit:BusyIndicator>
......
110 140
                    <RowDefinition Height="Auto"/>
111 141
                    <RowDefinition Height="Auto"/>
112 142
                    <RowDefinition Height="Auto"/>
143
                    <RowDefinition Height="Auto"/>
113 144
                    <RowDefinition />
114 145
                </Grid.RowDefinitions>
115 146
                <Grid.ColumnDefinitions>
......
122 153
                <TextBlock Text="{Binding Token}" Grid.Column="1" Grid.Row="1" Margin="5,2"/>
123 154
                <TextBlock Text="Account Path:" Grid.Column="0" Grid.Row="2" Margin="5,2"/>
124 155
                <TextBlock Text="{Binding AccountPath}" Grid.Column="1" Grid.Row="2" Margin="5,2"/>
125
                
126
            <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="3" Margin="5"/>
156

  
157
                <CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="4" Margin="5"/>
127 158
            </Grid>
128 159
        </extToolkit:WizardPage>
129 160
    </extToolkit:Wizard>
b/trunk/Pithos.Client.WPF/Preferences/AddAccountView.xaml.cs
21 21
    {
22 22
        public AddAccountView()
23 23
        {
24
            InitializeComponent();            
24
            InitializeComponent();
25
            
26
            //When the busy indicator changes, force a focus change. Workaround for delayed change of the Next button's visibility
27
            ManualBusyMessage.IsVisibleChanged += (sender, evt) => Token.Focus(); ;
25 28
        }
26 29

  
30

  
27 31
        private void Automatic_Checked(object sender, RoutedEventArgs e)
28 32
        {
29 33
            ChooseMethodPage.NextPage = AutoAccountPage;
b/trunk/Pithos.Client.WPF/Preferences/AddAccountViewModel.cs
5 5
using System.IO;
6 6
using System.Linq;
7 7
using System.Text;
8
using System.Threading.Tasks;
8 9
using System.Windows;
9 10
using System.Windows.Controls;
10 11
using System.Windows.Forms;
12
using Caliburn.Micro;
11 13
using Pithos.Client.WPF.Properties;
12 14
using Pithos.Core;
15
using Pithos.Network;
13 16
using MessageBox = System.Windows.MessageBox;
14 17
using Screen = Caliburn.Micro.Screen;
15 18

  
......
18 21
    [Export(typeof(AddAccountViewModel))]
19 22
    public class AddAccountViewModel:Screen
20 23
    {
24

  
25
        private readonly List<string> _servers;
26

  
27
        public List<string> Servers
28
        {
29
            get { return _servers; }
30
        }
31

  
32
        private bool _isValidServer;
33
        public bool IsValidServer
34
        {
35
            get { return _isValidServer; }
36
            set
37
            {
38
                _isValidServer = value;
39
                NotifyOfPropertyChange(()=>IsValidServer);
40
            }
41
        }
42

  
43

  
44
        private string _currentServer;
45
        public string CurrentServer
46
        {
47
            get { return _currentServer; }
48
            set
49
            {
50
                if (!Uri.IsWellFormedUriString(value, UriKind.Absolute))
51
                {
52
                    IsValidServer = false;
53
                    throw new UriFormatException();
54
                }
55
                _currentServer = value;
56
                IsValidServer = true;
57
                HasValidCredentials = false;
58
                IsConfirmed = false;
59
                NotifyOfPropertyChange(()=>CurrentServer);
60
            }
61
        }
62

  
21 63
        private string _accountName;
22 64
        public string AccountName
23 65
        {
......
74 116
            set
75 117
            {
76 118
                _isConfirmed = value;
119
                HasValidCredentials = false;
77 120
                NotifyOfPropertyChange(() => IsConfirmed);
78 121
            }
79 122
        }
......
139 182
            IsRetrieving = false;
140 183

  
141 184
        }
142
        
185

  
186
        public AddAccountViewModel()
187
        {
188
            _servers=new List<string>
189
                         {
190
                             Settings.Default.ProductionServer, 
191
                             Settings.Default.DevelopmentServer
192
                         };
193
            CurrentServer = _servers[0];
194
        }
195

  
196
        private bool _hasValidCredentials;
197
        public bool HasValidCredentials
198
        {
199
            get { return _hasValidCredentials; }
200
            set
201
            {
202
                _hasValidCredentials = value;
203
                NotifyOfPropertyChange(()=>HasValidCredentials);
204
            }
205
        }
206

  
207

  
208
        private bool _isValidating;
209
        public bool IsValidating
210
        {
211
            get { return _isValidating; }
212
            set
213
            {
214
                _isValidating = value;
215
                NotifyOfPropertyChange(()=>IsValidating);
216
            }
217
        }
218

  
219
        public async void TestAccount()
220
        {
221
            try
222
            {
223
                IsValidating = true;
224
                var client = new CloudFilesClient(AccountName, Token) {AuthenticationUrl = CurrentServer};                
225
                var containers = await TaskEx.Run(()=>
226
                                                      {
227
                                                          client.Authenticate();
228
                                                          return client.ListContainers(AccountName);
229
                                                      });
230
                HasValidCredentials = true;                
231
            }
232
            catch (Exception ex)
233
            {
234
                HasValidCredentials = false;
235
                MessageBox.Show("The account is not valid", "Account Error", MessageBoxButton.OK, MessageBoxImage.Stop);
236
                throw;
237
            }
238
            finally
239
            {
240
                IsValidating = false;
241
            }
242
        }
143 243

  
144 244
    }
145 245
}
b/trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs
85 85

  
86 86
            Settings=settings;
87 87
            Accounts = new ObservableConcurrentCollection<AccountSettings>();
88
            if (settings.Accounts == null)
89
            {
90
                settings.Accounts=new AccountsCollection();
91
                settings.Save();
92
            }
88 93
            Accounts.AddFromEnumerable(settings.Accounts);
89 94
            
90 95
            var startupPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
......
232 237
               var newAccount = new AccountSettings
233 238
                                    {
234 239
                                        AccountName = wizard.AccountName,
240
                                        ServerUrl=new Uri(wizard.CurrentServer),
235 241
                                        ApiKey=wizard.Token,
236 242
                                        RootPath=wizard.AccountPath,
237 243
                                        IsActive=wizard.IsAccountActive,
b/trunk/Pithos.Client.WPF/Properties/Settings.Designer.cs
205 205
        
206 206
        [global::System.Configuration.ApplicationScopedSettingAttribute()]
207 207
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
208
        [global::System.Configuration.DefaultSettingValueAttribute("http://pithos.dev.grnet.gr")]
209
        public string PithosSite {
210
            get {
211
                return ((string)(this["PithosSite"]));
212
            }
213
        }
214
        
215
        [global::System.Configuration.ApplicationScopedSettingAttribute()]
216
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
217
        [global::System.Configuration.DefaultSettingValueAttribute("https://pithos.dev.grnet.gr")]
218
        public string PithosAuthenticationUrl {
219
            get {
220
                return ((string)(this["PithosAuthenticationUrl"]));
221
            }
222
        }
223
        
224
        [global::System.Configuration.ApplicationScopedSettingAttribute()]
225
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
226 208
        [global::System.Configuration.DefaultSettingValueAttribute("https://auth.api.rackspacecloud.com")]
227 209
        public string CloudfilesAuthenticationUrl {
228 210
            get {
......
260 242
            }
261 243
        }
262 244
        
245
        [global::System.Configuration.ApplicationScopedSettingAttribute()]
246
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
247
        [global::System.Configuration.DefaultSettingValueAttribute("http://plus.pithos.grnet.gr")]
248
        public string ProductionServer {
249
            get {
250
                return ((string)(this["ProductionServer"]));
251
            }
252
        }
253
        
254
        [global::System.Configuration.ApplicationScopedSettingAttribute()]
255
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
256
        [global::System.Configuration.DefaultSettingValueAttribute("http://pithos.dev.grnet.gr")]
257
        public string DevelopmentServer {
258
            get {
259
                return ((string)(this["DevelopmentServer"]));
260
            }
261
        }
262
        
263 263
        [global::System.Configuration.UserScopedSettingAttribute()]
264 264
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
265
        [global::System.Configuration.DefaultSettingValueAttribute("\r\n          <ArrayOfAccountSettings xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-i" +
266
            "nstance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" />\r\n        ")]
267 265
        public global::Pithos.Interfaces.AccountsCollection Accounts {
268 266
            get {
269 267
                return ((global::Pithos.Interfaces.AccountsCollection)(this["Accounts"]));
b/trunk/Pithos.Client.WPF/Properties/Settings.settings
47 47
    <Setting Name="UseManualProxy" Type="System.Boolean" Scope="User">
48 48
      <Value Profile="(Default)">False</Value>
49 49
    </Setting>
50
    <Setting Name="PithosSite" Type="System.String" Scope="Application">
51
      <Value Profile="(Default)">http://pithos.dev.grnet.gr</Value>
52
    </Setting>
53
    <Setting Name="PithosAuthenticationUrl" Type="System.String" Scope="Application">
54
      <Value Profile="(Default)">https://pithos.dev.grnet.gr</Value>
55
    </Setting>
56 50
    <Setting Name="CloudfilesAuthenticationUrl" Type="System.String" Scope="Application">
57 51
      <Value Profile="(Default)">https://auth.api.rackspacecloud.com</Value>
58 52
    </Setting>
......
62 56
    <Setting Name="FeedbackUri" Type="System.String" Scope="Application">
63 57
      <Value Profile="(Default)">http://pithos.dev.grnet.gr/tools/feedback</Value>
64 58
    </Setting>
65
    <Setting Name="Accounts" Type="Pithos.Interfaces.AccountsCollection" Scope="User">
66
      <Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
67
&lt;ArrayOfAccountSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /&gt;</Value>
68
    </Setting>
69 59
    <Setting Name="MustUpgrade" Type="System.Boolean" Scope="User">
70 60
      <Value Profile="(Default)">True</Value>
71 61
    </Setting>
62
    <Setting Name="ProductionServer" Type="System.String" Scope="Application">
63
      <Value Profile="(Default)">http://plus.pithos.grnet.gr</Value>
64
    </Setting>
65
    <Setting Name="DevelopmentServer" Type="System.String" Scope="Application">
66
      <Value Profile="(Default)">http://pithos.dev.grnet.gr</Value>
67
    </Setting>
68
    <Setting Name="Accounts" Type="Pithos.Interfaces.AccountsCollection" Scope="User">
69
      <Value Profile="(Default)" />
70
    </Setting>
72 71
  </Settings>
73 72
</SettingsFile>
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs
131 131
        private async Task StartMonitoring()
132 132
        {
133 133
            try
134
            {                
134
            {
135
                if (Settings.Accounts == null)
136
                {
137
                    Settings.Accounts=new AccountsCollection();
138
                    Settings.Save();
139
                    return;
140
                }
141
                  
135 142
                foreach (var account in Settings.Accounts)
136 143
                {
137 144
                    await MonitorAccount(account);
......
196 203

  
197 204
                var appSettings = Properties.Settings.Default;
198 205
                monitor.AuthenticationUrl = account.UsePithos
199
                                                ? appSettings.PithosAuthenticationUrl
206
                                                ? account.ServerUrl.ToString()
200 207
                                                : appSettings.CloudfilesAuthenticationUrl;
201 208

  
202 209
                _monitors[accountName] = monitor;
......
326 333
        }
327 334

  
328 335
        
336
/*
329 337
        public void GoToSite()
330 338
        {            
331 339
            var site = Properties.Settings.Default.PithosSite;
332 340
            Process.Start(site);            
333 341
        }
342
*/
334 343

  
335 344
        public void GoToSite(AccountInfo account)
336 345
        {
337 346
            var site = String.Format("{0}/ui/?token={1}&user={2}",
338
                Properties.Settings.Default.PithosSite,account.Token,
347
                account.SiteUri,account.Token,
339 348
                account.UserName);
340 349
            Process.Start(site);
341 350
        }
......
624 633
                return;
625 634

  
626 635
            account.SiteUri= String.Format("{0}/ui/?token={1}&user={2}",
627
                Properties.Settings.Default.PithosSite, account.Token,
636
                account.SiteUri, account.Token,
628 637
                account.UserName);
629 638

  
630 639
            IProducerConsumerCollection<AccountInfo> accounts = Accounts;
b/trunk/Pithos.Client.WPF/app.config
72 72
      <setting name="UseManualProxy" serializeAs="String">
73 73
        <value>False</value>
74 74
      </setting>
75
      <setting name="Accounts" serializeAs="Xml">
76
        <value>
77
          <ArrayOfAccountSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
78
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
79
        </value>
80
      </setting>
81 75
      <setting name="MustUpgrade" serializeAs="String">
82 76
        <value>True</value>
83 77
      </setting>
......
98 92
  </startup>
99 93
  <applicationSettings>
100 94
    <Pithos.Client.WPF.Properties.Settings>
101
      <setting name="PithosSite" serializeAs="String">
102
        <value>http://pithos.dev.grnet.gr</value>
103
      </setting>
104
      <setting name="PithosAuthenticationUrl" serializeAs="String">
105
        <value>https://pithos.dev.grnet.gr</value>
106
      </setting>
107 95
      <setting name="CloudfilesAuthenticationUrl" serializeAs="String">
108 96
        <value>https://auth.api.rackspacecloud.com</value>
109 97
      </setting>
......
113 101
      <setting name="FeedbackUri" serializeAs="String">
114 102
        <value>http://pithos.dev.grnet.gr/tools/feedback</value>
115 103
      </setting>
104
      <setting name="ProductionServer" serializeAs="String">
105
        <value>http://plus.pithos.grnet.gr</value>
106
      </setting>
107
      <setting name="DevelopmentServer" serializeAs="String">
108
        <value>http://pithos.dev.grnet.gr</value>
109
      </setting>
116 110
    </Pithos.Client.WPF.Properties.Settings>
117 111
  </applicationSettings>
118 112
  <log4net>
b/trunk/Pithos.Interfaces/AccountSettings.cs
28 28

  
29 29
        public string RootPath { get; set; }
30 30

  
31
        public Uri ServerUrl { get; set; }
32

  
31 33
        private StringCollection _selectiveFolders = new StringCollection();
32 34

  
33 35
        
b/trunk/Pithos.Interfaces/IPithosSettings.cs
8 8
    public interface IPithosSettings
9 9
    {
10 10
        string PithosPath { get; set; }
11
        string PithosSite { get;  }
12 11
        string IconsPath { get; set; }
13 12
        string UserName { get; set; }
14 13
        string ApiKey { get; set; }
b/trunk/Pithos.Interfaces/PithosSettingsData.cs
45 45
            Contract.EndContractBlock();
46 46

  
47 47
            PithosPath = other.PithosPath;
48
            PithosSite = other.PithosSite;
49 48
            IconsPath = other.IconsPath;
50 49
            UserName = other.UserName;
51 50
            ApiKey = other.ApiKey;
b/trunk/Pithos.Network.Test/CloudFilesClientTest.cs
27 27

  
28 28
            Assert.AreEqual(0,result.Count);
29 29
        }
30
        
31
        [Test]
32
        public void TestAuthentication()
33
        {
34
            var account = "ikons@cslab.ece.ntua.gr";
35
            var apiKey = "fKzKaRd7Uhov+xca4B4rOQ==";
36
            var client = new CloudFilesClient(account, apiKey)
37
            {
38
                                 AuthenticationUrl = @"https://plus.pithos.grnet.gr", 
39
                                 UsePithos = true
40
                             };
41
            var accountInfo=client.Authenticate();
42
            var containers=client.ListContainers(accountInfo.UserName);
43
            Assert.IsNotNull(containers);
44
            var result=client.GetAccountPolicies(accountInfo);
45

  
46
            Assert.IsNotNull(accountInfo);
47
            Assert.IsNotNull(result);
48
        }
30 49

  
31 50

  
32 51
       
b/trunk/Pithos.ShellExtensions/Menus/FileContextMenu.cs
152 152
            var settings = Context.Settings;
153 153
            var activeAccount = settings.Accounts.FirstOrDefault(acc =>  Context.CurrentFile.StartsWith(acc.RootPath,StringComparison.InvariantCultureIgnoreCase));
154 154
            var address = String.Format("{0}/ui/?token={1}&user={2}",
155
                                        settings.PithosSite,
155
                                        activeAccount.ServerUrl,
156 156
                                        activeAccount.ApiKey,
157 157
                                        Uri.EscapeUriString(activeAccount.AccountName));
158 158

  
b/trunk/Pithos.ShellExtensions/ShellSettings.cs
55 55
            set { _settings.Value.PithosPath = value; }
56 56
        }
57 57

  
58
/*
58 59
        public string PithosSite
59 60
        {
60 61
            get { return _settings.Value.PithosSite; }
61 62
        }
63
*/
62 64

  
63 65
        public string IconsPath
64 66
        {
b/trunk/Pithos.sln
494 494
		{C6251981-3C49-404B-BB5B-9732887388D2}.Debug|Any CPU.ActiveCfg = Debug
495 495
		{C6251981-3C49-404B-BB5B-9732887388D2}.Debug|Mixed Platforms.ActiveCfg = Debug
496 496
		{C6251981-3C49-404B-BB5B-9732887388D2}.Debug|x64.ActiveCfg = Debug
497
		{C6251981-3C49-404B-BB5B-9732887388D2}.Debug|x64.Build.0 = Debug
498 497
		{C6251981-3C49-404B-BB5B-9732887388D2}.Debug|x86.ActiveCfg = Debug
499 498
		{C6251981-3C49-404B-BB5B-9732887388D2}.Premium Debug|Any CPU.ActiveCfg = Premium Debug
500 499
		{C6251981-3C49-404B-BB5B-9732887388D2}.Premium Debug|Mixed Platforms.ActiveCfg = Premium Debug

Also available in: Unified diff