From 628e9cf390c5b7f51d678611153eab1d81cd62c9 Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 18 Apr 2012 17:18:11 +0000 Subject: [PATCH] Add caption to End-User License Aggreement form Added LastVersion to config to present EULA on version change Display EULA when version changes Added Property to change button label (Agree for EULA) Changed DialogResult to OK for OK Button. --- PROMS/VEPROMS User Interface/AboutVEPROMS.cs | 1 + PROMS/VEPROMS User Interface/App.config | 9 ++++ .../Properties/Settings.Designer.cs | 12 ++++++ .../Properties/Settings.settings | 3 ++ PROMS/VEPROMS User Interface/frmVEPROMS.cs | 41 ++++++++++++++++++- .../frmViewTextFile.Designer.cs | 2 +- .../frmViewTextFile.cs | 8 ++-- 7 files changed, 71 insertions(+), 5 deletions(-) diff --git a/PROMS/VEPROMS User Interface/AboutVEPROMS.cs b/PROMS/VEPROMS User Interface/AboutVEPROMS.cs index a384794e..7d426b6c 100644 --- a/PROMS/VEPROMS User Interface/AboutVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/AboutVEPROMS.cs @@ -148,6 +148,7 @@ namespace VEPROMS { string strEULA = System.Environment.CurrentDirectory + "\\EULA.TXT"; frmViewTextFile ViewFile = new frmViewTextFile(strEULA,RichTextBoxStreamType.PlainText); + ViewFile.Text = "End-User License Agreement"; ViewFile.ShowDialog(); } diff --git a/PROMS/VEPROMS User Interface/App.config b/PROMS/VEPROMS User Interface/App.config index f8295f04..be950f12 100644 --- a/PROMS/VEPROMS User Interface/App.config +++ b/PROMS/VEPROMS User Interface/App.config @@ -128,6 +128,15 @@ True + + + + + + + + 0.0 + diff --git a/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs b/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs index 4f2ee3a4..c86f08f7 100644 --- a/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs +++ b/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs @@ -255,5 +255,17 @@ namespace VEPROMS.Properties { this["DefaultDB"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0.0")] + public string LastVersion { + get { + return ((string)(this["LastVersion"])); + } + set { + this["LastVersion"] = value; + } + } } } diff --git a/PROMS/VEPROMS User Interface/Properties/Settings.settings b/PROMS/VEPROMS User Interface/Properties/Settings.settings index 295099da..97a5b6dc 100644 --- a/PROMS/VEPROMS User Interface/Properties/Settings.settings +++ b/PROMS/VEPROMS User Interface/Properties/Settings.settings @@ -62,5 +62,8 @@ + + 0.0 + \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 1662b22d..63ee814d 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -426,7 +426,46 @@ namespace VEPROMS displaySearch1.Enter += new EventHandler(displaySearch1_Enter); displayHistory.Enter += new EventHandler(displayHistory_Enter); ctrlAnnotationDetails.Enter += new EventHandler(ctrlAnnotationDetails_Enter); - RunAutomatic(); + Application.DoEvents(); + if (RunningNewRevision && ShowEULA() != DialogResult.OK) + { + Timer tmrShutDown = new Timer(); + tmrShutDown.Interval = 250; + tmrShutDown.Tick += new EventHandler(tmrShutDown_Tick); + tmrShutDown.Enabled = true; + } + else + RunAutomatic(); + } + void tmrShutDown_Tick(object sender, EventArgs e) + { + (sender as Timer).Enabled = false; + this.Close(); + } + private DialogResult ShowEULA() + { + string strEULA = System.Environment.CurrentDirectory + "\\EULA.TXT"; + frmViewTextFile ViewFile = new frmViewTextFile(strEULA, RichTextBoxStreamType.PlainText); + ViewFile.Text = "End-User License Agreement"; + ViewFile.ButtonText = "Agree"; + if (ViewFile.ShowDialog() == DialogResult.OK) + { + System.Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + string thisVersion = ver.Major.ToString() + "." + ver.Minor.ToString(); + Properties.Settings.Default.LastVersion = thisVersion; + return DialogResult.OK; + } + return DialogResult.Cancel; + } + private bool RunningNewRevision + { + get + { + string lastVersion = Properties.Settings.Default.LastVersion; + System.Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + string thisVersion = ver.Major.ToString() + "." + ver.Minor.ToString(); + return thisVersion != lastVersion; + } } void displayHistory_Enter(object sender, EventArgs e) { diff --git a/PROMS/Volian.Controls.Library/frmViewTextFile.Designer.cs b/PROMS/Volian.Controls.Library/frmViewTextFile.Designer.cs index 094a8ec6..8a7346a9 100644 --- a/PROMS/Volian.Controls.Library/frmViewTextFile.Designer.cs +++ b/PROMS/Volian.Controls.Library/frmViewTextFile.Designer.cs @@ -48,7 +48,7 @@ namespace Volian.Controls.Library this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.buttonX1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonX1.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.buttonX1.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonX1.DialogResult = System.Windows.Forms.DialogResult.OK; this.buttonX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonX1.Location = new System.Drawing.Point(559, 691); this.buttonX1.Name = "buttonX1"; diff --git a/PROMS/Volian.Controls.Library/frmViewTextFile.cs b/PROMS/Volian.Controls.Library/frmViewTextFile.cs index 3435e491..f75e7585 100644 --- a/PROMS/Volian.Controls.Library/frmViewTextFile.cs +++ b/PROMS/Volian.Controls.Library/frmViewTextFile.cs @@ -13,20 +13,22 @@ namespace Volian.Controls.Library { string _FileName; RichTextBoxStreamType _RTBType; - //public string FileName //{ // get { return _FileName; } // set { _FileName = value; } //} - + public string ButtonText + { + get { return buttonX1.Text; } + set { buttonX1.Text = value; } + } public frmViewTextFile(string filename, RichTextBoxStreamType rtbtype) { _FileName = filename; _RTBType = rtbtype; InitializeComponent(); } - private void frmViewTextFile_Load(object sender, EventArgs e) { if (File.Exists(_FileName))