From 79d8b00de8b36697057aefb0aa62db8a09a5e120 Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Fri, 26 Feb 2021 03:31:05 +0000 Subject: [PATCH] Replaced AllowUpdatesDialog with a ThreeButtonDialog. For reasons of code reduction and also because the look and feel of this dialog was slightly different from the usual application pop-ups. Signed-off-by: Konstantina Chremmou --- .../Dialogs/AllowUpdatesDialog.Designer.cs | 95 ------ XenAdmin/Dialogs/AllowUpdatesDialog.cs | 91 ------ XenAdmin/Dialogs/AllowUpdatesDialog.ja.resx | 294 ------------------ XenAdmin/Dialogs/AllowUpdatesDialog.resx | 294 ------------------ .../Dialogs/AllowUpdatesDialog.zh-CN.resx | 294 ------------------ XenAdmin/MainWindow.cs | 29 +- XenAdmin/XenAdmin.csproj | 16 - XenModel/Messages.Designer.cs | 18 ++ XenModel/Messages.resx | 6 + 9 files changed, 52 insertions(+), 1085 deletions(-) delete mode 100644 XenAdmin/Dialogs/AllowUpdatesDialog.Designer.cs delete mode 100644 XenAdmin/Dialogs/AllowUpdatesDialog.cs delete mode 100644 XenAdmin/Dialogs/AllowUpdatesDialog.ja.resx delete mode 100644 XenAdmin/Dialogs/AllowUpdatesDialog.resx delete mode 100644 XenAdmin/Dialogs/AllowUpdatesDialog.zh-CN.resx diff --git a/XenAdmin/Dialogs/AllowUpdatesDialog.Designer.cs b/XenAdmin/Dialogs/AllowUpdatesDialog.Designer.cs deleted file mode 100644 index e6f95152f..000000000 --- a/XenAdmin/Dialogs/AllowUpdatesDialog.Designer.cs +++ /dev/null @@ -1,95 +0,0 @@ -namespace XenAdmin.Dialogs -{ - partial class AllowUpdatesDialog - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AllowUpdatesDialog)); - this.BlurbLabel = new System.Windows.Forms.Label(); - this.NoButton = new System.Windows.Forms.Button(); - this.YesButton = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); - this.SuspendLayout(); - // - // BlurbLabel - // - resources.ApplyResources(this.BlurbLabel, "BlurbLabel"); - this.BlurbLabel.Name = "BlurbLabel"; - // - // NoButton - // - resources.ApplyResources(this.NoButton, "NoButton"); - this.NoButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.NoButton.Name = "NoButton"; - this.NoButton.UseVisualStyleBackColor = true; - // - // YesButton - // - resources.ApplyResources(this.YesButton, "YesButton"); - this.YesButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.YesButton.Name = "YesButton"; - this.YesButton.UseVisualStyleBackColor = true; - // - // groupBox1 - // - resources.ApplyResources(this.groupBox1, "groupBox1"); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.TabStop = false; - // - // checkBox1 - // - resources.ApplyResources(this.checkBox1, "checkBox1"); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.UseVisualStyleBackColor = true; - // - // AllowUpdatesDialog - // - this.AcceptButton = this.YesButton; - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.CancelButton = this.NoButton; - this.Controls.Add(this.checkBox1); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.YesButton); - this.Controls.Add(this.NoButton); - this.Controls.Add(this.BlurbLabel); - this.Name = "AllowUpdatesDialog"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AllowUpdatesDialog_FormClosing); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.Label BlurbLabel; - private System.Windows.Forms.Button NoButton; - private System.Windows.Forms.Button YesButton; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.CheckBox checkBox1; - } -} \ No newline at end of file diff --git a/XenAdmin/Dialogs/AllowUpdatesDialog.cs b/XenAdmin/Dialogs/AllowUpdatesDialog.cs deleted file mode 100644 index d77bf189c..000000000 --- a/XenAdmin/Dialogs/AllowUpdatesDialog.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (c) Citrix Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, - * with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -using System; -using System.Windows.Forms; -using XenAdmin.Plugins; - -namespace XenAdmin.Dialogs -{ - public partial class AllowUpdatesDialog : XenDialogBase - { - private readonly PluginManager m_pluginManager; - - public AllowUpdatesDialog(PluginManager pluginManager) - { - InitializeComponent(); - m_pluginManager = pluginManager; - ControlBox = true; - } - - private void SetAllowUpdates(bool value) - { - Properties.Settings.Default.AllowXenCenterUpdates = value; - Properties.Settings.Default.AllowPatchesUpdates = value; - Properties.Settings.Default.AllowXenServerUpdates = value; - } - - private void YesButtonClicked() - { - SetAllowUpdates(true); - Properties.Settings.Default.SeenAllowUpdatesDialog = true; - if (checkBox1.Checked) - { - using (var dialog = new OptionsDialog(m_pluginManager)) - { - dialog.SelectConnectionOptionsPage(); - dialog.ShowDialog(this); - } - } - Settings.TrySaveSettings(); - } - - private void NoButtonClicked() - { - SetAllowUpdates(false); - Properties.Settings.Default.SeenAllowUpdatesDialog = true; - Settings.TrySaveSettings(); - } - - private void AllowUpdatesDialog_FormClosing(object sender, FormClosingEventArgs e) - { - switch (DialogResult) - { - case DialogResult.OK: - YesButtonClicked(); - break; - case DialogResult.Cancel: - NoButtonClicked(); - break; - } - } - } -} \ No newline at end of file diff --git a/XenAdmin/Dialogs/AllowUpdatesDialog.ja.resx b/XenAdmin/Dialogs/AllowUpdatesDialog.ja.resx deleted file mode 100644 index 5de7dba4a..000000000 --- a/XenAdmin/Dialogs/AllowUpdatesDialog.ja.resx +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Top, Left, Right - - - - Segoe UI, 9pt - - - 58, 14 - - - 340, 61 - - - - 1 - - - [XenCenter] で定期的に [XenServer] や [XenCenter] のアップデートおよび新しいバージョンをインターネットでチェックしますか? - - - BlurbLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - - - Bottom, Right - - - Segoe UI, 9pt - - - 311, 66 - - - 87, 27 - - - 2 - - - いいえ(&N) - - - NoButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - Bottom, Right - - - Segoe UI, 9pt - - - 218, 66 - - - 87, 27 - - - 2 - - - はい(&Y) - - - YesButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - - - Bottom, Left, Right - - - Segoe UI, 9pt - - - 0, 99 - - - 418, 2 - - - 3 - - - groupBox1 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - - - Bottom, Left - - - True - - - Segoe UI, 9pt - - - 12, 106 - - - 175, 19 - - - 4 - - - インターネット プロキシ設定を表示する(&S) - - - checkBox1 - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - - - True - - - 96, 96 - - - 412, 131 - - - Segoe UI, 9pt - - - [XenCenter] - - - AllowUpdatesDialog - - - XenAdmin.Dialogs.XenDialogBase, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - \ No newline at end of file diff --git a/XenAdmin/Dialogs/AllowUpdatesDialog.resx b/XenAdmin/Dialogs/AllowUpdatesDialog.resx deleted file mode 100644 index bf90286f2..000000000 --- a/XenAdmin/Dialogs/AllowUpdatesDialog.resx +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Top, Left, Right - - - - Segoe UI, 9pt - - - 12, 14 - - - 386, 49 - - - - 1 - - - Would you like [XenCenter] to periodically check the internet for [XenServer] updates and new versions of [XenCenter]? - - - BlurbLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - - - Bottom, Right - - - Segoe UI, 9pt - - - 311, 66 - - - 87, 27 - - - 2 - - - &No - - - NoButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - Bottom, Right - - - Segoe UI, 9pt - - - 218, 66 - - - 87, 27 - - - 2 - - - &Yes - - - YesButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - - - Bottom, Left, Right - - - Segoe UI, 9pt - - - 0, 99 - - - 418, 2 - - - 3 - - - groupBox1 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - - - Bottom, Left - - - True - - - Segoe UI, 9pt - - - 12, 106 - - - 176, 19 - - - 4 - - - &Show internet proxy settings - - - checkBox1 - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - - - True - - - 96, 96 - - - 412, 131 - - - Segoe UI, 9pt - - - [XenCenter] - - - AllowUpdatesDialog - - - XenAdmin.Dialogs.XenDialogBase, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - \ No newline at end of file diff --git a/XenAdmin/Dialogs/AllowUpdatesDialog.zh-CN.resx b/XenAdmin/Dialogs/AllowUpdatesDialog.zh-CN.resx deleted file mode 100644 index 390e1b5e6..000000000 --- a/XenAdmin/Dialogs/AllowUpdatesDialog.zh-CN.resx +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Top, Left, Right - - - - Segoe UI, 9pt - - - 58, 14 - - - 340, 61 - - - - 1 - - - 是否希望 [XenCenter] 定期在 Internet 中检查 [XenServer] 更新和新版本的 [XenCenter]? - - - BlurbLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - - - Bottom, Right - - - Segoe UI, 9pt - - - 311, 66 - - - 87, 27 - - - 2 - - - 否(&N) - - - NoButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - Bottom, Right - - - Segoe UI, 9pt - - - 218, 66 - - - 87, 27 - - - 2 - - - 是(&Y) - - - YesButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - - - Bottom, Left, Right - - - Segoe UI, 9pt - - - 0, 99 - - - 418, 2 - - - 3 - - - groupBox1 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - - - Bottom, Left - - - True - - - Segoe UI, 9pt - - - 12, 106 - - - 175, 19 - - - 4 - - - 显示 Internet 代理设置(&S) - - - checkBox1 - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - - - True - - - 96, 96 - - - 412, 131 - - - Segoe UI, 9pt - - - [XenCenter] - - - AllowUpdatesDialog - - - XenAdmin.Dialogs.XenDialogBase, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - \ No newline at end of file diff --git a/XenAdmin/MainWindow.cs b/XenAdmin/MainWindow.cs index 7306c3f97..09e3f8782 100755 --- a/XenAdmin/MainWindow.cs +++ b/XenAdmin/MainWindow.cs @@ -615,7 +615,34 @@ namespace XenAdmin if (!Program.RunInAutomatedTestMode && !Helpers.CommonCriteriaCertificationRelease) { if (!Properties.Settings.Default.SeenAllowUpdatesDialog) - new AllowUpdatesDialog(pluginManager).ShowDialog(this); + using (var dlg = new NoIconDialog(string.Format(Messages.ALLOWED_UPDATES_DIALOG_MESSAGE, + BrandManager.BrandConsole, BrandManager.ProductBrand), + ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo) + { + HelpButton = true, + HelpNameSetter = "AllowUpdatesDialog", + ShowCheckbox = true, + CheckboxCaption = Messages.ALLOWED_UPDATES_DIALOG_CHECKBOX + }) + { + var result = dlg.ShowDialog(this) == DialogResult.Yes; + + Properties.Settings.Default.AllowXenCenterUpdates = result; + Properties.Settings.Default.AllowPatchesUpdates = result; + Properties.Settings.Default.AllowXenServerUpdates = result; + Properties.Settings.Default.SeenAllowUpdatesDialog = true; + + if (result && dlg.IsCheckBoxChecked) + { + using (var dialog = new OptionsDialog(pluginManager)) + { + dialog.SelectConnectionOptionsPage(); + dialog.ShowDialog(this); + } + } + + Settings.TrySaveSettings(); + } // start checkforupdates thread CheckForUpdatesTimer.Interval = 1000 * 60 * 60 * 24; // 24 hours diff --git a/XenAdmin/XenAdmin.csproj b/XenAdmin/XenAdmin.csproj index d85906638..9597f5779 100755 --- a/XenAdmin/XenAdmin.csproj +++ b/XenAdmin/XenAdmin.csproj @@ -642,12 +642,6 @@ - - Form - - - AllowUpdatesDialog.cs - Form @@ -2010,10 +2004,6 @@ Designer GraphList.cs - - Designer - AllowUpdatesDialog.cs - BondProperties.cs Designer @@ -5131,12 +5121,6 @@ AlertSummaryPage.cs - - AllowUpdatesDialog.cs - - - AllowUpdatesDialog.cs - AssignLicenseDialog.cs diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 70e59c483..28bdcab25 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -5219,6 +5219,24 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to &Show internet proxy settings. + /// + public static string ALLOWED_UPDATES_DIALOG_CHECKBOX { + get { + return ResourceManager.GetString("ALLOWED_UPDATES_DIALOG_CHECKBOX", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Would you like {0} to periodically check the internet for {1} updates and new versions of {0}?. + /// + public static string ALLOWED_UPDATES_DIALOG_MESSAGE { + get { + return ResourceManager.GetString("ALLOWED_UPDATES_DIALOG_MESSAGE", resourceCulture); + } + } + /// /// Looks up a localized string similar to The SR '{0}' is currently attached elsewhere. Do you want to attach it to '{1}'? /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index ed5db7692..8d52439db 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -1886,6 +1886,12 @@ Note that if RBAC is enabled, only alerts which you have privileges to dismiss w Allowed MTU value: {0} + + Would you like {0} to periodically check the internet for {1} updates and new versions of {0}? + + + &Show internet proxy settings + &Allow to continue