aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-04-14 20:25:47 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-04-14 20:25:47 +0300
commitd37bc3c65acb6ab3e265c3d1560ed54f1693249d (patch)
treecd30b91495eecec0b13defffc888156c5f90af24 /Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem
parent8f738753289dcb7118162122c5404d2a02b305f7 (diff)
downloadTango-d37bc3c65acb6ab3e265c3d1560ed54f1693249d.tar.gz
Tango-d37bc3c65acb6ab3e265c3d1560ed54f1693249d.zip
FSE TUP/TFP.
Refactored progress with TangoProgress<T>
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem')
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs37
1 files changed, 19 insertions, 18 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 9cceb4fa3..b1f4446d2 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs
@@ -17,6 +17,7 @@ namespace Tango.FSE.Common.FileSystem
private TaskCompletionSource<FileSystemHandlerStatus> _completionSource;
public event EventHandler<FileSystemHandlerStatus> StatusChanged;
+ public event EventHandler<TangoProgressChangedEventArgs<double>> ProgressChanged;
public FileSystemHandlerType Type { get; set; }
@@ -35,6 +36,13 @@ namespace Tango.FSE.Common.FileSystem
}
}
+ private TangoProgress<double> _progress;
+ public TangoProgress<double> Progress
+ {
+ get { return _progress; }
+ set { _progress = value; RaisePropertyChangedAuto(); }
+ }
+
private bool _isPaused;
public bool IsPaused
{
@@ -60,20 +68,6 @@ namespace Tango.FSE.Common.FileSystem
}
}
- private double _position;
- public double Position
- {
- get { return _position; }
- set { _position = value; RaisePropertyChangedAuto(); }
- }
-
- private double _length;
- public double Length
- {
- get { return _length; }
- set { _length = value; RaisePropertyChangedAuto(); }
- }
-
private long _transferRate;
public long TransferRate
{
@@ -94,6 +88,7 @@ namespace Tango.FSE.Common.FileSystem
public FileSystemHandler(FileSystemHandlerType type, FileSystemItem fileSystemItem, String destination, Action abortAction)
{
+ Progress = new TangoProgress<double>();
_completionSource = new TaskCompletionSource<FileSystemHandlerStatus>();
Type = type;
FileSystemItem = fileSystemItem;
@@ -109,8 +104,8 @@ namespace Tango.FSE.Common.FileSystem
return;
}
- TransferRate = (long)(Position - _lastPosition);
- _lastPosition = Position;
+ TransferRate = (long)(Progress.Value - _lastPosition);
+ _lastPosition = Progress.Value;
}
internal void InvalidateProgress(double position, double length)
@@ -122,8 +117,14 @@ namespace Tango.FSE.Common.FileSystem
_transferRateTimer.Start();
}
- Position = position;
- Length = length;
+ Progress = new TangoProgress<double>()
+ {
+ IsIndeterminate = false,
+ Value = position,
+ Maximum = length,
+ };
+
+ ProgressChanged?.Invoke(this, new TangoProgressChangedEventArgs<double>(Progress));
if (!IsPaused)
{