From 8545348b4ee7cba48d61dfe8fb6ca0f44743838f Mon Sep 17 00:00:00 2001 From: Drexel2k <13720303+Drexel2k@users.noreply.github.com> Date: Thu, 4 Jun 2020 13:43:11 +0200 Subject: [PATCH] Fixed bug: prevent every following upload from beeing started and stopped immediately, after stopping upload. --- VidUp.UI/CommonAssemblyInfo.cs | 6 +++--- VidUp.UI/ViewModels/MainWindowViewModel.cs | 2 +- VidUp.YouTube/Uploader.cs | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/VidUp.UI/CommonAssemblyInfo.cs b/VidUp.UI/CommonAssemblyInfo.cs index 98801f5..2a4426d 100644 --- a/VidUp.UI/CommonAssemblyInfo.cs +++ b/VidUp.UI/CommonAssemblyInfo.cs @@ -7,10 +7,10 @@ [assembly: System.Reflection.AssemblyProductAttribute("VidUp")] [assembly: System.Reflection.AssemblyTitleAttribute("VidUp")] [assembly: System.Reflection.AssemblyCompanyAttribute("Drexel Development")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.0.2")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.0.3")] //Shown in Gui/Setup -[assembly: System.Reflection.AssemblyVersionAttribute("1.2.0.2")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.0.2")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.2.0.3")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.0.3")] [assembly: System.Reflection.AssemblyCopyright("©2020 Drexel Development")] [assembly: ComVisible(false)] diff --git a/VidUp.UI/ViewModels/MainWindowViewModel.cs b/VidUp.UI/ViewModels/MainWindowViewModel.cs index c030ee4..cc33e88 100644 --- a/VidUp.UI/ViewModels/MainWindowViewModel.cs +++ b/VidUp.UI/ViewModels/MainWindowViewModel.cs @@ -753,7 +753,7 @@ private void stopUploading(object obj) Uploader uploader = this.uploader; if (uploader != null) { - uploader.StopUpload(); + uploader.StopUpload = true; } } } diff --git a/VidUp.YouTube/Uploader.cs b/VidUp.YouTube/Uploader.cs index 2256604..ce1fab4 100644 --- a/VidUp.YouTube/Uploader.cs +++ b/VidUp.YouTube/Uploader.cs @@ -34,6 +34,12 @@ public long MaxUploadInBytesPerSecond } } + public bool StopUpload + { + get => this.stopUpload; + set => this.stopUpload = value; + } + public Uploader(UploadList uploadList) { if (uploadList == null) @@ -74,7 +80,7 @@ public async Task Upload(Action notifyUploadStart, Action List uploadsOfSession = new List(); Upload upload = this.uploadList.GetUpload(PredicateCombiner.Or(predicates.ToArray())); - while (upload != null) + while (upload != null && !this.stopUpload) { uploadsOfSession.Add(upload); upload.UploadErrorMessage = null; @@ -153,11 +159,6 @@ void updateUploadProgress(YoutubeUploadStats stats) } } - public void StopUpload() - { - this.stopUpload = true; - } - private bool isStopped() { return this.stopUpload;