From 43d6ea82cd11bb727cabe1ed6eeccb8cc41a11d5 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Tue, 24 May 2022 08:57:11 -0600 Subject: [PATCH] Change failure behavior to match previous implementation --- .../ProcessQueue/ProcessBook.cs | 1 - .../ProcessQueue/ProcessBookControl.cs | 4 +-- .../ProcessQueueControl.Designer.cs | 28 +++++++++---------- .../ProcessQueue/ProcessQueueControl.cs | 13 +++++---- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Source/LibationWinForms/ProcessQueue/ProcessBook.cs b/Source/LibationWinForms/ProcessQueue/ProcessBook.cs index f84db515..7c9778a5 100644 --- a/Source/LibationWinForms/ProcessQueue/ProcessBook.cs +++ b/Source/LibationWinForms/ProcessQueue/ProcessBook.cs @@ -131,7 +131,6 @@ namespace LibationWinForms.ProcessQueue { ProcessBookResult.Success => ProcessBookStatus.Completed, ProcessBookResult.Cancelled => ProcessBookStatus.Cancelled, - ProcessBookResult.FailedRetry => ProcessBookStatus.Queued, _ => ProcessBookStatus.Failed, }; } diff --git a/Source/LibationWinForms/ProcessQueue/ProcessBookControl.cs b/Source/LibationWinForms/ProcessQueue/ProcessBookControl.cs index 7eee6913..62062468 100644 --- a/Source/LibationWinForms/ProcessQueue/ProcessBookControl.cs +++ b/Source/LibationWinForms/ProcessQueue/ProcessBookControl.cs @@ -72,8 +72,8 @@ namespace LibationWinForms.ProcessQueue Status = ProcessBookStatus.Cancelled; break; case ProcessBookResult.FailedRetry: - statusText = "Queued"; - Status = ProcessBookStatus.Queued; + statusText = "Error, will retry later"; + Status = ProcessBookStatus.Failed; break; case ProcessBookResult.FailedSkip: statusText = "Error, Skippping"; diff --git a/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.Designer.cs b/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.Designer.cs index 3e99394f..f600fd5d 100644 --- a/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.Designer.cs +++ b/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.Designer.cs @@ -51,9 +51,9 @@ this.logEntryColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.panel4 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); + this.logCopyBtn = new System.Windows.Forms.Button(); this.clearLogBtn = new System.Windows.Forms.Button(); this.counterTimer = new System.Windows.Forms.Timer(this.components); - this.logCopyBtn = new System.Windows.Forms.Button(); this.statusStrip1.SuspendLayout(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); @@ -264,10 +264,21 @@ this.panel2.Size = new System.Drawing.Size(390, 25); this.panel2.TabIndex = 1; // + // logCopyBtn + // + this.logCopyBtn.Dock = System.Windows.Forms.DockStyle.Left; + this.logCopyBtn.Location = new System.Drawing.Point(0, 0); + this.logCopyBtn.Name = "logCopyBtn"; + this.logCopyBtn.Size = new System.Drawing.Size(57, 23); + this.logCopyBtn.TabIndex = 1; + this.logCopyBtn.Text = "Copy"; + this.logCopyBtn.UseVisualStyleBackColor = true; + this.logCopyBtn.Click += new System.EventHandler(this.LogCopyBtn_Click); + // // clearLogBtn // - this.clearLogBtn.Dock = System.Windows.Forms.DockStyle.Left; - this.clearLogBtn.Location = new System.Drawing.Point(0, 0); + this.clearLogBtn.Dock = System.Windows.Forms.DockStyle.Right; + this.clearLogBtn.Location = new System.Drawing.Point(328, 0); this.clearLogBtn.Name = "clearLogBtn"; this.clearLogBtn.Size = new System.Drawing.Size(60, 23); this.clearLogBtn.TabIndex = 0; @@ -280,17 +291,6 @@ this.counterTimer.Interval = 950; this.counterTimer.Tick += new System.EventHandler(this.CounterTimer_Tick); // - // logCopyBtn - // - this.logCopyBtn.Dock = System.Windows.Forms.DockStyle.Right; - this.logCopyBtn.Location = new System.Drawing.Point(331, 0); - this.logCopyBtn.Name = "logCopyBtn"; - this.logCopyBtn.Size = new System.Drawing.Size(57, 23); - this.logCopyBtn.TabIndex = 1; - this.logCopyBtn.Text = "Copy"; - this.logCopyBtn.UseVisualStyleBackColor = true; - this.logCopyBtn.Click += new System.EventHandler(this.LogCopyBtn_Click); - // // ProcessQueueControl // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); diff --git a/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs b/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs index f1830f51..a55dc071 100644 --- a/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs +++ b/Source/LibationWinForms/ProcessQueue/ProcessQueueControl.cs @@ -151,12 +151,15 @@ namespace LibationWinForms.ProcessQueue var result = await nextBook.ProcessOneAsync(); - if (result == ProcessBookResult.FailedRetry) - Queue.Enqueue(nextBook); - else if (result == ProcessBookResult.ValidationFail) + if (result == ProcessBookResult.ValidationFail) Queue.ClearCurrent(); else if (result == ProcessBookResult.FailedAbort) - return; + Queue.ClearQueue(); + else if (result == ProcessBookResult.FailedSkip) + { + nextBook.LibraryBook.Book.UserDefinedItem.BookStatus = DataLayer.LiberatedStatus.Error; + ApplicationServices.LibraryCommands.UpdateUserDefinedItem(nextBook.LibraryBook.Book); + } } Queue_CompletedCountChanged(this, 0); counterTimer.Stop(); @@ -176,7 +179,7 @@ namespace LibationWinForms.ProcessQueue private void Queue_CompletedCountChanged(object sender, int e) { - int errCount = Queue.Completed.Count(p => p.Result is ProcessBookResult.FailedAbort or ProcessBookResult.FailedSkip or ProcessBookResult.ValidationFail); + int errCount = Queue.Completed.Count(p => p.Result is ProcessBookResult.FailedAbort or ProcessBookResult.FailedSkip or ProcessBookResult.FailedRetry or ProcessBookResult.ValidationFail); int completeCount = Queue.Completed.Count(p => p.Result is ProcessBookResult.Success); ErrorCount = errCount;