CP-28284: Changes following code review

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2018-06-18 23:13:35 +01:00 committed by Konstantina Chremmou
parent 631d7656a2
commit 59b9b695db
5 changed files with 25 additions and 110 deletions

View File

@ -32,7 +32,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Threading;
using log4net;
@ -139,8 +138,6 @@ namespace XenAdmin.Wizards.PatchingWizard
else if (WizardMode == WizardMode.NewVersion)
labelTitle.Text = Messages.PATCHINGWIZARD_UPLOAD_AND_INSTALL_TITLE_NEW_VERSION_AUTOMATED_MODE;
ToggleRetryButton();
if (!StartUpgradeWorkers())
{
_thisPageIsCompleted = true;
@ -470,42 +467,8 @@ namespace XenAdmin.Wizards.PatchingWizard
doWorkEventArgs.Result = new Exception(action.Title, e);
failedWorkers.Add(sender as UpdateProgressBackgroundWorker);
failedWorkers.Add(bgw);
bgw.ReportProgress(0);
//this pool failed, we will stop here, but try to remove update files at least
/*try
{
if (action is DownloadPatchPlanAction || action is UploadPatchToMasterPlanAction)
return;
var pos = 0;
if (action is RemoveUpdateFileFromMasterPlanAction)
pos = bgw.FinalActions.IndexOf(action) + 1;
for (int i = pos; i < bgw.FinalActions.Count; i++)
{
action = bgw.FinalActions[i];
if (bgw.CancellationPending)
{
doWorkEventArgs.Cancel = true;
return;
}
if (action is RemoveUpdateFileFromMasterPlanAction)
RunPlanAction(bgw, action);
}
}
catch (Exception ex2)
{
//already in an error case - best effort
log.Error("Failed to clean up (this was a best effort attempt)", ex2);
}
finally
{
bgw.ReportProgress(0);
}*/
}
}
@ -552,6 +515,7 @@ namespace XenAdmin.Wizards.PatchingWizard
? Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_MANY
: Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_ONE;
pictureBox1.Image = Images.StaticImages._000_error_h32bit_16;
buttonRetry.Visible = true;
}
else
{
@ -559,12 +523,10 @@ namespace XenAdmin.Wizards.PatchingWizard
? Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_SUCCESS_MANY
: Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_SUCCESS_ONE;
pictureBox1.Image = Images.StaticImages._000_Tick_h32bit_16;
buttonRetry.Visible = false;
progressBar.Value = 100;
}
// show the retry button, if needed
ToggleRetryButton();
_thisPageIsCompleted = true;
_cancelEnabled = false;
_nextEnabled = true;
@ -596,7 +558,6 @@ namespace XenAdmin.Wizards.PatchingWizard
{
_someWorkersFailed = false;
panel1.Visible = false;
ToggleRetryButton();
var workers = new List<UpdateProgressBackgroundWorker>(failedWorkers);
failedWorkers.Clear();
@ -612,14 +573,9 @@ namespace XenAdmin.Wizards.PatchingWizard
OnPageUpdated();
}
private void ToggleRetryButton()
{
labelRetry.Visible = buttonRetry.Visible = _someWorkersFailed;
}
#endregion
private void retryButton_Click(object sender, EventArgs e)
private void buttonRetry_Click(object sender, EventArgs e)
{
RetryFailedActions();
}

View File

@ -36,7 +36,6 @@ namespace XenAdmin.Wizards.PatchingWizard
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.TableLayoutPanel();
this.buttonRetry = new System.Windows.Forms.Button();
this.labelRetry = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
@ -78,22 +77,14 @@ namespace XenAdmin.Wizards.PatchingWizard
this.panel1.Controls.Add(this.pictureBox1, 0, 0);
this.panel1.Controls.Add(this.labelError, 1, 0);
this.panel1.Controls.Add(this.buttonRetry, 2, 0);
this.panel1.Controls.Add(this.labelRetry, 1, 1);
this.panel1.Name = "panel1";
//
// buttonRetry
//
resources.ApplyResources(this.buttonRetry, "buttonRetry");
this.buttonRetry.Name = "buttonRetry";
this.panel1.SetRowSpan(this.buttonRetry, 2);
this.buttonRetry.UseVisualStyleBackColor = true;
this.buttonRetry.Click += new System.EventHandler(this.retryButton_Click);
//
// labelRetry
//
resources.ApplyResources(this.labelRetry, "labelRetry");
this.labelRetry.BackColor = System.Drawing.SystemColors.Control;
this.labelRetry.Name = "labelRetry";
this.buttonRetry.Click += new System.EventHandler(this.buttonRetry_Click);
//
// PatchingWizard_AutomatedUpdatesPage
//
@ -121,7 +112,5 @@ namespace XenAdmin.Wizards.PatchingWizard
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.TableLayoutPanel panel1;
private System.Windows.Forms.Button buttonRetry;
private System.Windows.Forms.Label labelRetry;
}
}

View File

@ -163,7 +163,7 @@
<value>Both</value>
</data>
<data name="textBoxLog.Size" type="System.Drawing.Size, System.Drawing">
<value>502, 222</value>
<value>502, 235</value>
</data>
<data name="textBoxLog.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@ -220,10 +220,10 @@
<value>NoControl</value>
</data>
<data name="labelError.Location" type="System.Drawing.Point, System.Drawing">
<value>25, 4</value>
<value>25, 5</value>
</data>
<data name="labelError.Size" type="System.Drawing.Size, System.Drawing">
<value>426, 13</value>
<value>402, 13</value>
</data>
<data name="labelError.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@ -273,17 +273,20 @@
<data name="panel1.ColumnCount" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="buttonRetry.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
<data name="buttonRetry.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="buttonRetry.Location" type="System.Drawing.Point, System.Drawing">
<value>457, 3</value>
<value>433, 0</value>
</data>
<data name="buttonRetry.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 0, 3, 0</value>
</data>
<data name="buttonRetry.Size" type="System.Drawing.Size, System.Drawing">
<value>51, 23</value>
<value>75, 23</value>
</data>
<data name="buttonRetry.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
<value>0</value>
</data>
<data name="buttonRetry.Text" xml:space="preserve">
<value>&amp;Retry</value>
@ -300,50 +303,17 @@
<data name="&gt;&gt;buttonRetry.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="labelRetry.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left, Right</value>
</data>
<data name="labelRetry.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelRetry.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labelRetry.Location" type="System.Drawing.Point, System.Drawing">
<value>25, 25</value>
</data>
<data name="labelRetry.Size" type="System.Drawing.Size, System.Drawing">
<value>426, 13</value>
</data>
<data name="labelRetry.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="labelRetry.Text" xml:space="preserve">
<value>The update process has been paused. Press Retry to resume the update process.</value>
</data>
<data name="&gt;&gt;labelRetry.Name" xml:space="preserve">
<value>labelRetry</value>
</data>
<data name="&gt;&gt;labelRetry.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelRetry.Parent" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;labelRetry.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
</data>
<data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 293</value>
<value>0, 312</value>
</data>
<data name="panel1.RowCount" type="System.Int32, mscorlib">
<value>2</value>
<value>1</value>
</data>
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
<value>511, 42</value>
<value>511, 23</value>
</data>
<data name="panel1.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
@ -361,7 +331,7 @@
<value>0</value>
</data>
<data name="panel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="pictureBox1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="labelError" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="buttonRetry" Row="0" RowSpan="2" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="labelRetry" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /&gt;&lt;Rows Styles="Percent,100,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="pictureBox1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="labelError" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="buttonRetry" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /&gt;&lt;Rows Styles="Percent,100" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>

View File

@ -27113,7 +27113,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to One or more of the automated updates processes were not completed successfully..
/// Looks up a localized string similar to One or more of the automated updates processes were not completed successfully. The update process has been paused. Press Retry to resume it..
/// </summary>
public static string PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_MANY {
get {
@ -27122,7 +27122,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to The automated updates process was not completed successfuly..
/// Looks up a localized string similar to The automated updates process was not completed successfuly. The update process has been paused. Press Retry to resume it..
/// </summary>
public static string PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_ONE {
get {

View File

@ -9352,10 +9352,10 @@ However, there is not enough space to perform the repartitioning, so the current
<value>Paste</value>
</data>
<data name="PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_MANY" xml:space="preserve">
<value>One or more of the automated updates processes were not completed successfully.</value>
<value>One or more of the automated updates processes were not completed successfully. The update process has been paused. Press Retry to resume it.</value>
</data>
<data name="PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_ONE" xml:space="preserve">
<value>The automated updates process was not completed successfuly.</value>
<value>The automated updates process was not completed successfuly. The update process has been paused. Press Retry to resume it.</value>
</data>
<data name="PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_POOL_MANY" xml:space="preserve">
<value>The following errors occurred while automated updates were in progress:</value>