Fix to current account behavior in Preferences/PreferencesView.xaml
authorPanagiotis Kanavos <pkanavos@gmail.com>
Mon, 24 Oct 2011 15:36:38 +0000 (18:36 +0300)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Mon, 24 Oct 2011 15:36:38 +0000 (18:36 +0300)
Modified Upload to always use block uploading. Need cleanup of dead code

trunk/Pithos.Client.WPF/Preferences/PreferencesView.xaml
trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs
trunk/Pithos.Core/Agents/NetworkAgent.cs

index 0d57a99..50c96cd 100644 (file)
@@ -4,7 +4,7 @@
         xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification"
         xmlns:cal="http://www.caliburnproject.org" 
         x:Name="TheView"
-        Title="Pithos Preferences" Height="381" Width="548" 
+        Title="Pithos Preferences" Height="381" Width="600" 
         ShowInTaskbar="true"
         WindowStartupLocation="CenterScreen"
         Icon="/Pithos.Client.WPF;component/Images/Tray.ico"
@@ -59,7 +59,7 @@
                         <ColumnDefinition Width="Auto"/>
                         <ColumnDefinition Width="*"/>
                     </Grid.ColumnDefinitions>
-                    <Grid Margin="5,10,5,5" Column="0" Width="150">
+                    <Grid Margin="5,10,5,5" Column="0" Width="250">
                         <Grid.RowDefinitions>
                             <RowDefinition Height="*"/>
                             <RowDefinition Height="Auto"/>
@@ -72,7 +72,8 @@
                             </ListBox.ItemTemplate>
                         </ListBox>
                         <StackPanel Orientation="Horizontal" Grid.Row="1">
-                            <Button Name="AddPithosAccount" Content="Add" Style="{StaticResource ButtonStyle}" Width="50"/>
+                            <Button Name="AddPithosAccount" Content="Add Pithos" Style="{StaticResource ButtonStyle}" Width="70"/>
+                            <Button Name="AddAccount" Content="Add Manual" Style="{StaticResource ButtonStyle}" Width="70"/>
                             <Button Name="RemoveAccount" Content="Remove" Style="{StaticResource ButtonStyle}" Width="50"/>                            
                         </StackPanel>
                     </Grid>
index dea2b54..7a8f836 100644 (file)
@@ -220,9 +220,9 @@ namespace Pithos.Client.WPF
 */
        public void AddAccount()
         {
-            var newAccount = new AccountSettings();
+            var newAccount = new AccountSettings{AccountName="New Account"};
             Settings.Accounts.Add(newAccount);
-            //SelectedAccountIndex= Settings.Accounts.Count-1;
+            (Accounts as IProducerConsumerCollection<AccountSettings>).TryAdd(newAccount);
            CurrentAccount = newAccount;
             NotifyOfPropertyChange(() => Accounts);
             NotifyOfPropertyChange(()=>Settings);
index 5a76056..34d682d 100644 (file)
@@ -849,9 +849,12 @@ namespace Pithos.Core.Agents
                 StatusKeeper.SetFileOverlayStatus(fullFileName, FileOverlayStatus.Modified);
                 //And then upload it
 
-                //If the file is larger than the block size, try a hashmap PUT
+                //Upload even small files using the Hashmap. The server may already containt
+                //the relevant folder
+/*
                 if (fileInfo.Length > accountInfo.BlockSize )
                 {
+*/
                     //To upload using a hashmap
                     //First, calculate the tree hash
                     var treeHash = Signature.CalculateTreeHashAsync(fileInfo.FullName, accountInfo.BlockSize,
@@ -860,12 +863,14 @@ namespace Pithos.Core.Agents
                     
                     yield return Task.Factory.Iterate(UploadWithHashMap(accountInfo,cloudFile,fileInfo,url,treeHash));
                                         
+/*
                 }
                 else
                 {
                     //Otherwise do a regular PUT
                     yield return client.PutObject(account, container, url, fullFileName, hash);                    
                 }
+*/
                 //If everything succeeds, change the file and overlay status to normal
                 this.StatusKeeper.SetFileState(fullFileName, FileStatus.Unchanged, FileOverlayStatus.Normal);
             }