aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-03-20 04:03:05 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-03-20 04:03:05 +0200
commitd0dba9752d0a8e787d9ae1d4d25542bd4b386df6 (patch)
treeb71977215c188d65d61fcfb66e982a8363b4d803 /Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs
parent7f0b3b209792cb935b9cfca4542c45318a309717 (diff)
downloadTango-d0dba9752d0a8e787d9ae1d4d25542bd4b386df6.tar.gz
Tango-d0dba9752d0a8e787d9ae1d4d25542bd4b386df6.zip
Implemented priority queues for Transport Layer.
Working on file/folder download.
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.cs46
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;