diff options
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs')
| -rw-r--r-- | Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs index 1b1e5f747..48fb35c0f 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs @@ -4,12 +4,14 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core; +using Tango.FileSystem; namespace Tango.FSE.Common.FileSystem { public class FileSystemHandler : ExtendedObject { private Action _abortAction; + private FileSystemHandlerStatus _statusBeforePause; public FileSystemHandlerType Type { get; set; } @@ -19,9 +21,31 @@ namespace Tango.FSE.Common.FileSystem get { return _status; } set { - if (_status != value) + _status = value; + RaisePropertyChangedAuto(); + } + } + + private bool _isPaused; + public bool IsPaused + { + get { return _isPaused; } + set + { + if (_isPaused != value) { - _status = value; + _isPaused = value; + + if (_isPaused) + { + _statusBeforePause = Status; + Status = FileSystemHandlerStatus.Paused; + } + else + { + Status = _statusBeforePause; + } + RaisePropertyChangedAuto(); } } @@ -48,12 +72,13 @@ namespace Tango.FSE.Common.FileSystem set { _failedException = value; RaisePropertyChangedAuto(); } } - public String Name { get; set; } + public FileSystemItem FileSystemItem { get; set; } public String Destination { get; set; } + public String OperationId { get; set; } - public FileSystemHandler(String name, String destination, Action abortAction) + public FileSystemHandler(FileSystemItem fileSystemItem, String destination, Action abortAction) { - Name = name; + FileSystemItem = fileSystemItem; Destination = destination; _abortAction = abortAction; } @@ -62,7 +87,11 @@ namespace Tango.FSE.Common.FileSystem { Position = position; Length = length; - Status = (Type == FileSystemHandlerType.FileDownload || Type == FileSystemHandlerType.FolderDownload) ? FileSystemHandlerStatus.Downloading : FileSystemHandlerStatus.Uploading; + + if (!IsPaused) + { + Status = (Type == FileSystemHandlerType.FileDownload || Type == FileSystemHandlerType.FolderDownload) ? FileSystemHandlerStatus.Downloading : FileSystemHandlerStatus.Uploading; + } } internal void RaiseFailed(Exception exception) @@ -71,6 +100,11 @@ namespace Tango.FSE.Common.FileSystem FailedException = exception; } + internal void RaiseAborted() + { + Status = FileSystemHandlerStatus.Aborted; + } + internal void RaiseCompleted() { Status = FileSystemHandlerStatus.Completed; |
