Revision 7d855abd trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs

b/trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs
43 43

  
44 44
using System.Collections.Concurrent;
45 45
using System.Collections.Generic;
46
using System.Collections.Specialized;
46 47
using System.ComponentModel.Composition;
47 48
using System.Diagnostics;
48 49
using System.IO;
......
55 56
using Pithos.Client.WPF.Configuration;
56 57
using Pithos.Client.WPF.Properties;
57 58
using Pithos.Client.WPF.SelectiveSynch;
59
using Pithos.Client.WPF.Utils;
58 60
using Pithos.Core;
59 61
using Pithos.Interfaces;
60 62
using System;
61 63
using System.Linq;
64
using Pithos.Network;
62 65
using MessageBox = System.Windows.MessageBox;
63 66
using Screen = Caliburn.Micro.Screen;
64 67

  
......
405 408
               var account = Accounts.FirstOrDefault(act => act.AccountName == wizard.AccountName && act.ServerUrl == wizard.CurrentServer);
406 409
               if (account != null)
407 410
               {
408
                   if (MessageBox.Show("The account you specified already exists. Do you want to update it?","The account exists") == MessageBoxResult.Yes)
411
                   if (MessageBox.Show("The account you specified already exists. Do you want to update it?", "The account exists") == MessageBoxResult.Yes)
409 412
                   {
410 413
                       account.ApiKey = wizard.Token;
411 414
                       account.IsExpired = false;
......
420 423
                                            ServerUrl = wizard.CurrentServer,
421 424
                                            ApiKey = wizard.Token,
422 425
                                            RootPath = actualRootPath,
423
                                            IsActive = wizard.IsAccountActive
426
                                            IsActive = wizard.IsAccountActive,
424 427
                                        };
428

  
429

  
430
                   var client = new CloudFilesClient(newAccount.AccountName, newAccount.ApiKey)
431
                                    {
432
                                        AuthenticationUrl = newAccount.ServerUrl, UsePithos = true
433
                                    };
434
                   client.Authenticate();
435

  
436

  
437
                   var dirs = (from container in client.ListContainers(newAccount.AccountName)
438
                               from dir in client.ListObjects(newAccount.AccountName, container.Name)
439
                               where container.Name != "trash"
440
                               select dir)
441
                               .ToTree()
442
                               .Select(d=>d.Uri.ToString())
443
                               .ToArray();
444
                              
445
                   newAccount.SelectiveFolders.AddRange(dirs);
446

  
447
                   //TODO:Add the "pithos" container as a default selection                   
448

  
425 449
                   _accountsToAdd.Add(newAccount);
426 450
                   var accountVm = new AccountViewModel(newAccount);
427 451
                   (Accounts as IProducerConsumerCollection<AccountViewModel>).TryAdd(accountVm);

Also available in: Unified diff