Revision 70f12b36

b/trunk/Pithos.Client.WPF/AppBootstrapper.cs
57 57
                catalog.Catalogs.Add(new AssemblyCatalog(type.Assembly));
58 58
            }
59 59

  
60
			container = new CompositionContainer(catalog);
60
			container = new CompositionContainer(catalog,true);
61 61

  
62 62
			var batch = new CompositionBatch();
63 63

  
......
76 76
		protected override object GetInstance(Type serviceType, string key)
77 77
		{
78 78
			string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key;
79
			var exports = container.GetExportedValues<object>(contract);
79
			var exports = container.GetExportedValues<object>(contract);            
80 80

  
81 81
			if (exports.Any())
82 82
				return exports.First();
b/trunk/Pithos.Client.WPF/Preferences/PreferencesView.xaml
8 8
        Title="Pithos Preferences" Height="381" Width="600" 
9 9
        ShowInTaskbar="true"
10 10
        WindowStartupLocation="CenterScreen"
11
        Icon="/Pithos.Client.WPF;component/Images/Tray.ico"
11
        Icon="/Pithos.Client.WPF;component/Images/PithosTaskbar.png"
12 12
        Background="{StaticResource {x:Static SystemColors.ControlBrushKey}}">
13 13
        
14 14
    <Window.Resources>
b/trunk/Pithos.Client.WPF/Shell/AboutView.xaml
1 1
<Window x:Class="Pithos.Client.WPF.Shell.AboutView"
2 2
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 3
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
        Title="AboutView" Height="300" Width="300">
4
        Title="AboutView" Height="300" Width="300" Icon="/Pithos.Client.WPF;component/Images/PithosTaskbar.png">
5 5
    <Grid>
6 6
        <Grid.RowDefinitions>
7 7
            <RowDefinition Height="Auto"/>
b/trunk/Pithos.Client.WPF/Shell/FeedbackView.xaml
1 1
<Window x:Class="Pithos.Client.WPF.Shell.FeedbackView"
2 2
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 3
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
        Title="FeedbackView" Height="389" Width="455" xmlns:my="clr-namespace:Pithos.Client.WPF.Converters">
4
        Title="FeedbackView" Height="389" Width="455" xmlns:my="clr-namespace:Pithos.Client.WPF.Converters" Icon="/Pithos.Client.WPF;component/Images/PithosTaskbar.png">
5 5
    <Window.Resources>
6 6
        <my:EmptyToVisibilityConverter x:Key="EmptyToVisible" />
7 7
    </Window.Resources>
b/trunk/Pithos.Client.WPF/Shell/MessageView.xaml
1 1
<Window x:Class="Pithos.Client.WPF.MessageView"
2 2
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 3
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
        Title="MessageView" Height="300" Width="500" Background="{StaticResource {x:Static SystemColors.ControlBrushKey}}" WindowStartupLocation="CenterScreen">
4
        Title="MessageView" Height="300" Width="500" Background="{StaticResource {x:Static SystemColors.ControlBrushKey}}" WindowStartupLocation="CenterScreen" Icon="/Pithos.Client.WPF;component/Images/PithosTaskbar.png">
5 5
    <Window.CommandBindings>
6 6
        <CommandBinding Command="ApplicationCommands.Close"
7 7
                    Executed="OnClose"/>
b/trunk/Pithos.Client.WPF/Shell/ShellView.xaml
5 5
        xmlns:cal="http://www.caliburnproject.org"
6 6
        x:Name="TheView" WindowStartupLocation="CenterScreen" WindowStyle="None"
7 7
        Visibility="Collapsed"
8
        Width="700" Height="200" SizeToContent="Width" WindowState="Minimized">
8
        Width="700" Height="200" SizeToContent="Width" WindowState="Minimized" Icon="/Pithos.Client.WPF;component/Images/PithosTaskbar.png">
9 9

  
10 10
<!--
11 11
    <Window.Background>
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs
186 186
					return;
187 187
				}
188 188

  
189
                
189 190
				//Create a new monitor/ Can't use MEF here, it would return a single instance for all monitors
190 191
				monitor = new PithosMonitor
191 192
							  {
b/trunk/Pithos.Core/Agents/CloudTransferAction.cs
81 81
        {
82 82
            return String.Format("{0}:{1}->{2}", this.Action, this.LocalFile.FullName, this.CloudFile.Name);
83 83
        }
84

  
85
        protected static ObjectInfo CreateObjectInfoFor(AccountInfo accountInfo, FileSystemInfo fileInfo)
86
        {
87
            Contract.Requires(accountInfo!=null);
88
            Contract.Requires(fileInfo!=null);
89
            Contract.Ensures(Contract.Result<ObjectInfo>()!=null);
90

  
91
            var capitalizedFileInfo = fileInfo.WithProperCapitalization();
92
            var fullLocalName = capitalizedFileInfo.FullName;
93
            var othersPath = Path.Combine(accountInfo.AccountPath, FolderConstants.OthersFolder);
94
            
95
            var isShared = fullLocalName.StartsWith(othersPath, StringComparison.InvariantCultureIgnoreCase);
96
            if (isShared)
97
            {                
98
                var pathRelativeToOther = fullLocalName.Substring(othersPath.Length + 1);
99
                var otherParts = pathRelativeToOther.Split('\\');
100
                var otherName = otherParts[0];
101
                var otherContainer = otherParts[1];
102
                return new ObjectInfo
103
                           {
104
                               Account = otherName, 
105
                               Container = otherContainer, 
106
                               Name = String.Join("/", otherParts.Splice(2))
107
                           };
108
            }
109
            return new ObjectInfo(accountInfo.AccountPath, accountInfo.UserName, fileInfo);
110
        }
84 111
    }    
85 112

  
86 113
    public class CloudDownloadAction:CloudAction
......
110 137
    public class CloudDeleteAction:CloudAction
111 138
    {
112 139
        public CloudDeleteAction(AccountInfo accountInfo,FileSystemInfo fileInfo, FileState fileState)
113
            : this(accountInfo,fileInfo,new ObjectInfo(accountInfo.AccountPath,accountInfo.UserName,fileInfo.WithProperCapitalization()),fileState)
140
            : this(accountInfo,fileInfo,CreateObjectInfoFor(accountInfo, fileInfo),fileState)
114 141
        {            
115 142
        }
116 143

  
......
142 169
    public class CloudUploadAction:CloudAction
143 170
    {
144 171
        public CloudUploadAction(AccountInfo accountInfo, FileSystemInfo fileInfo, FileState state, int blockSize, string algorithm)
145
            : base(accountInfo, CloudActionType.UploadUnconditional, fileInfo, 
146
            new ObjectInfo(accountInfo.AccountPath, accountInfo.UserName,fileInfo), state, blockSize, algorithm)
172
            : base(accountInfo, CloudActionType.UploadUnconditional,fileInfo,CreateObjectInfoFor(accountInfo,fileInfo),state,blockSize,algorithm)             
147 173
        {
148 174
        }
149 175

  
......
165 191
            :base(accountInfo,action)
166 192
        {
167 193
            LocalFile = newFile;
168
            CloudFile = new ObjectInfo(accountInfo.AccountPath, accountInfo.UserName, newFile);
194
            CloudFile = CreateObjectInfoFor(accountInfo, newFile);
169 195
            
170 196
            OldLocalFile = oldFile;
171
            OldCloudFile = new ObjectInfo(accountInfo.AccountPath, accountInfo.UserName, oldFile);
197
            OldCloudFile = CreateObjectInfoFor(accountInfo, oldFile);
172 198

  
173 199
            //This is a rename operation, a hash will not be used
174 200
            LocalHash = new Lazy<string>(() => String.Empty, LazyThreadSafetyMode.ExecutionAndPublication);
b/trunk/Pithos.Core/Agents/NetworkAgent.cs
676 676
                            state.FilePath.StartsWith(accountInfo.AccountPath)).ToList();*/
677 677

  
678 678

  
679
            var deleteCandidates = FileState.Queryable
680
                .Where(state => state.Modified <= pollTime
681
                            &&
682
                            state.FilePath.StartsWith(accountInfo.AccountPath)
683
                            && state.FileStatus != FileStatus.Conflict).ToList();
679
            var deleteCandidates = FileState.Queryable.Where(state => 
680
                state.Modified <= pollTime
681
                && state.FilePath.StartsWith(accountInfo.AccountPath)
682
                && state.FileStatus != FileStatus.Conflict).ToList();
684 683

  
685 684
            //TODO: filesToDelete must take into account the Others container
686 685
            var filesToDelete = (from deleteCandidate in deleteCandidates 
687 686
                         let localFile = FileInfoExtensions.FromPath(deleteCandidate.FilePath) 
688 687
                         let relativeFilePath = localFile.AsRelativeTo(accountInfo.AccountPath) 
689
                         where !cloudFiles.Any(r => 
690
                             Path.Combine(r.Container, r.Name) == relativeFilePath ||                   //Own file
691
                             Path.Combine(FolderConstants.OthersFolder,r.Account, r.Container, r.Name) == relativeFilePath  //Shared file
692
                             ) 
688
                         where !cloudFiles.Any(r => r.RelativeUrlToFilePath(accountInfo.UserName) == relativeFilePath ) 
693 689
                         select localFile).ToList();
694 690

  
695 691
            //On the first run
b/trunk/Pithos.Core/Agents/WorkflowAgent.cs
54 54
    [Export]
55 55
    public class WorkflowAgent
56 56
    {
57
        Agent<WorkflowState> _agent;
57
        readonly Agent<WorkflowState> _agent;
58 58
                
59 59
        public IStatusNotification StatusNotification { get; set; }
60 60
        [System.ComponentModel.Composition.Import]
......
65 65

  
66 66
        private static readonly ILog Log = LogManager.GetLogger("WorkflowAgent");
67 67

  
68
        public void Start()
68
        public WorkflowAgent()
69 69
        {
70 70
            _agent = Agent<WorkflowState>.Start(inbox =>
71 71
            {
b/trunk/Pithos.Core/EnumerableExtensions.cs
24 24
            for (var i = startIndex; i < endIndex; i++)
25 25
                yield return array[i];
26 26
        }
27

  
28
      
27 29
    }
28 30
}
b/trunk/Pithos.Core/PithosMonitor.cs
159 159
                //TODO; Warn user?
160 160
                return;
161 161

  
162
            WorkflowAgent.StatusNotification = StatusNotification;
163

  
162 164
            StatusNotification.NotifyChange("Starting");
163 165
            if (_started)
164 166
            {
......
198 200
            StartWatcherAgent();
199 201

  
200 202
            StartNetworkAgent();
201

  
202
            StartWorkflowAgent();
203
            
203 204
            WorkflowAgent.RestartInterruptedFiles(_accountInfo);
204 205
            _started = true;
205 206
        }
......
279 280
  
280 281

  
281 282

  
282
        private void StartWorkflowAgent()
283
       /* private void StartWorkflowAgent()
283 284
        {
284 285
            WorkflowAgent.StatusNotification = StatusNotification;
285 286

  
......
290 291
            {
291 292
                Task.Factory.StartNewDelayed(10000, StartWorkflowAgent);
292 293
                return;
293
            }*/
294
            }#1#
294 295

  
295 296
            try
296 297
            {
......
302 303
                //Retry after a while
303 304
                Task.Factory.StartNewDelayed(10000, StartWorkflowAgent);
304 305
            }
305
        }
306
        }*/
306 307

  
307 308
        internal class LocalFileComparer:EqualityComparer<CloudAction>
308 309
        {

Also available in: Unified diff