Revision e5b65606 trunk/Pithos.Core/Agents/NetworkAgent.cs

b/trunk/Pithos.Core/Agents/NetworkAgent.cs
120 120
                throw new ArgumentException("The action.AccountInfo is empty","action");
121 121
            Contract.EndContractBlock();
122 122

  
123
            StatusKeeper.SetPithosStatus(PithosStatus.Syncing);
123 124
            var accountInfo = action.AccountInfo;
124 125

  
125 126
            using (log4net.ThreadContext.Stacks["NETWORK"].Push("PROCESS"))
......
135 136
                    if (action.Action == CloudActionType.DeleteCloud)
136 137
                    {
137 138
                        //Redirect deletes to the delete agent 
138
                        _deleteAgent.Post((CloudDeleteAction)action);                        
139
                        _deleteAgent.Post((CloudDeleteAction)action);
139 140
                    }
140 141
                    if (IsDeletedFile(action))
141 142
                    {
......
155 156
                                await DownloadCloudFile(accountInfo, cloudFile, downloadPath);
156 157
                                break;
157 158
                            case CloudActionType.RenameCloud:
158
                                var moveAction = (CloudMoveAction) action;
159
                                var moveAction = (CloudMoveAction)action;
159 160
                                RenameCloudFile(accountInfo, moveAction);
160 161
                                break;
161 162
                            case CloudActionType.MustSynch:
......
186 187
                    Log.ErrorFormat("{0} : {1} -> {2}  failed because the directory was not found.\n Rescheduling a delete",
187 188
                        action.Action, action.LocalFile, action.CloudFile);
188 189
                    //Post a delete action for the missing file
189
                    Post(new CloudDeleteAction(action));                    
190
                    Post(new CloudDeleteAction(action));
190 191
                }
191 192
                catch (FileNotFoundException)
192 193
                {
......
201 202
                                     action.Action, action.LocalFile, action.CloudFile, exc);
202 203

  
203 204
                    _agent.Post(action);
204
                }                
205
                }
206
                finally
207
                {
208
                    StatusKeeper.SetPithosStatus(PithosStatus.InSynch);
209
                }
205 210
            }
206 211
        }
207 212

  
......
376 381
            Contract.EndContractBlock();
377 382

  
378 383
            StatusKeeper.SetFileOverlayStatus(downloadPath, FileOverlayStatus.Conflict);
384
            StatusKeeper.SetPithosStatus(PithosStatus.HasConflicts);
379 385
            var message = String.Format("Conflict detected for file {0}", downloadPath);
380 386
            Log.Warn(message);
381 387
            StatusNotification.NotifyChange(message, TraceLevel.Warning);
......
447 453
        //Remote files are polled periodically. Any changes are processed
448 454
        public async Task PollRemoteFiles(DateTime? since = null,bool repeat=true)
449 455
        {
450

  
456
            StatusNotification.Notify(new Notification{Title="Polling Pithos"});
457
            StatusKeeper.SetPithosStatus(PithosStatus.Syncing);
451 458

  
452 459
            using (log4net.ThreadContext.Stacks["Retrieve Remote"].Push("All accounts"))
453 460
            {
......
504 511
                throw new ArgumentException("The AccountInfo.AccountPath is empty","accountInfo");
505 512
            Contract.EndContractBlock();
506 513

  
514
            StatusNotification.Notify(new Notification{Title=String.Format("Polling {0}",accountInfo.UserName)});
515

  
507 516
            using (log4net.ThreadContext.Stacks["Retrieve Remote"].Push(accountInfo.UserName))
508 517
            {
509 518
                Log.Info("Scheduled");
......
603 612
                            .Except(_agent.GetEnumerable(), new PithosMonitor.LocalFileComparer())
604 613
                            .ToList();
605 614

  
615
                        if (distinctActions.Any())
616
                        {
617
                            StatusNotification.Notify(new Notification {Title = "Changes Detected",Message=String.Format("{0} files were modified",distinctActions.Count)});
618
                        }
606 619
                        //Queue all the actions
607 620
                        foreach (var message in distinctActions)
608 621
                        {
......
685 698
                {
686 699
                    StatusKeeper.SetFileState(item.FullName, FileStatus.Conflict, FileOverlayStatus.Deleted);
687 700
                }
701
                StatusKeeper.SetPithosStatus(PithosStatus.HasConflicts);
688 702
                StatusNotification.NotifyConflicts(filesToDelete, String.Format("{0} local files are missing from Pithos, possibly because they were deleted",filesToDelete.Count));
689 703
            }
690 704
            else

Also available in: Unified diff