From 4847c2892d5fbc1d33ce4b2d2df0d4b2980dc964 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 19 Dec 2017 16:32:16 +0100 Subject: [PATCH] Spostamento update in MainForm --- IOB-WIN/AdapterForm.Designer.cs | 15 ++------- IOB-WIN/AdapterForm.cs | 26 ++++++++++------ IOB-WIN/MainForm.Designer.cs | 29 +++++++++--------- IOB-WIN/MainForm.cs | 54 +++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 37 deletions(-) diff --git a/IOB-WIN/AdapterForm.Designer.cs b/IOB-WIN/AdapterForm.Designer.cs index c0c62229..4aaa4404 100644 --- a/IOB-WIN/AdapterForm.Designer.cs +++ b/IOB-WIN/AdapterForm.Designer.cs @@ -45,7 +45,6 @@ this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.FileTSMI = new System.Windows.Forms.ToolStripMenuItem(); this.mLoadConf = new System.Windows.Forms.ToolStripMenuItem(); - this.mCheckUpdates = new System.Windows.Forms.ToolStripMenuItem(); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.trayMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); @@ -190,8 +189,7 @@ // FileTSMI // this.FileTSMI.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mLoadConf, - this.mCheckUpdates}); + this.mLoadConf}); this.FileTSMI.Name = "FileTSMI"; this.FileTSMI.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F))); this.FileTSMI.Size = new System.Drawing.Size(47, 24); @@ -201,18 +199,10 @@ // this.mLoadConf.Name = "mLoadConf"; this.mLoadConf.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.L))); - this.mLoadConf.Size = new System.Drawing.Size(244, 26); + this.mLoadConf.Size = new System.Drawing.Size(214, 26); this.mLoadConf.Text = "&LOAD CONF"; this.mLoadConf.Click += new System.EventHandler(this.mLoadConf_Click); // - // mCheckUpdates - // - this.mCheckUpdates.Name = "mCheckUpdates"; - this.mCheckUpdates.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.U))); - this.mCheckUpdates.Size = new System.Drawing.Size(244, 26); - this.mCheckUpdates.Text = "CHECK &UPDATES"; - this.mCheckUpdates.Click += new System.EventHandler(this.mCheckUpdates_Click); - // // notifyIcon1 // this.notifyIcon1.ContextMenuStrip = this.trayMenu; @@ -668,7 +658,6 @@ private System.Windows.Forms.Timer displTimer; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label lblRawData; - private System.Windows.Forms.ToolStripMenuItem mCheckUpdates; private System.Windows.Forms.Label lblOutMessage3; private System.Windows.Forms.Label lblOutMessage2; private System.Windows.Forms.Button btnClose; diff --git a/IOB-WIN/AdapterForm.cs b/IOB-WIN/AdapterForm.cs index 7f962117..db8f63ac 100644 --- a/IOB-WIN/AdapterForm.cs +++ b/IOB-WIN/AdapterForm.cs @@ -1,4 +1,6 @@ -using AutoUpdaterDotNET; +#if false +using AutoUpdaterDotNET; +#endif using IOB_UT; using NLog; using NLog.Targets; @@ -74,6 +76,7 @@ namespace IOB_WIN /// tipo di adapter prescelto... /// public tipoAdapter tipoScelto = tipoAdapter.DEMO; +#if false /// /// Ramo applicazione (x update) /// @@ -88,7 +91,8 @@ namespace IOB_WIN //string branchName = utils.CRS("appVers"); return string.Format("http://seriate.steamware.net:8083/SWS/MAPO/IOB-WIN/{0}/manifest.xml", branchName); } - } + } +#endif #endregion @@ -630,13 +634,13 @@ namespace IOB_WIN displayTaskAndLog(string.Format("Loading iniConfFile: {0}", iniConfFile)); IniFile fIni = new IniFile(iniConfFile); - // salvo branchName... - branchName = fIni.ReadString("BRANCH", "NAME", "develop"); - // se NON sono in DEBUG faccio check update... -#if !(DEBUG) - // avvio autoupdater... - AutoUpdater.Start(updateUrl); -#endif +// // salvo branchName... +// branchName = fIni.ReadString("BRANCH", "NAME", "develop"); +// // se NON sono in DEBUG faccio check update... +//#if !(DEBUG) +// // avvio autoupdater... +// AutoUpdater.Start(updateUrl); +//#endif // verifico tipo adapter tipoScelto = (tipoAdapter)Enum.Parse(typeof(tipoAdapter), fIni.ReadString("IOB", "CNCTYPE", "DEMO")); @@ -1090,12 +1094,14 @@ namespace IOB_WIN tslUptime.Text = string.Format("Uptime: {0}gg {1:00}:{2:00}:{3:00}", uptime.Days, uptime.Hours, uptime.Minutes, uptime.Seconds); } +#if false private void mCheckUpdates_Click(object sender, EventArgs e) { AutoUpdater.ShowSkipButton = false; AutoUpdater.ShowRemindLaterButton = false; AutoUpdater.Start(updateUrl); - } + } +#endif } } diff --git a/IOB-WIN/MainForm.Designer.cs b/IOB-WIN/MainForm.Designer.cs index 578776fd..28d9a626 100644 --- a/IOB-WIN/MainForm.Designer.cs +++ b/IOB-WIN/MainForm.Designer.cs @@ -31,10 +31,10 @@ this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.checkForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mCheckUpdates = new System.Windows.Forms.ToolStripMenuItem(); this.openChildToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.closeChildToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -64,22 +64,17 @@ // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.checkForUpdatesToolStripMenuItem}); + this.mCheckUpdates}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); this.fileToolStripMenuItem.Text = "&File"; // - // windowToolStripMenuItem + // mCheckUpdates // - this.windowToolStripMenuItem.Name = "windowToolStripMenuItem"; - this.windowToolStripMenuItem.Size = new System.Drawing.Size(76, 24); - this.windowToolStripMenuItem.Text = "&Window"; - // - // checkForUpdatesToolStripMenuItem - // - this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem"; - this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(205, 26); - this.checkForUpdatesToolStripMenuItem.Text = "Check for &Updates"; + this.mCheckUpdates.Name = "mCheckUpdates"; + this.mCheckUpdates.Size = new System.Drawing.Size(205, 26); + this.mCheckUpdates.Text = "Check for &Updates"; + this.mCheckUpdates.Click += new System.EventHandler(this.mCheckUpdates_Click); // // openChildToolStripMenuItem // @@ -95,6 +90,12 @@ this.closeChildToolStripMenuItem.Text = "Child -"; this.closeChildToolStripMenuItem.Click += new System.EventHandler(this.closeChildToolStripMenuItem_Click); // + // windowToolStripMenuItem + // + this.windowToolStripMenuItem.Name = "windowToolStripMenuItem"; + this.windowToolStripMenuItem.Size = new System.Drawing.Size(76, 24); + this.windowToolStripMenuItem.Text = "&Window"; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -118,7 +119,7 @@ private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem mCheckUpdates; private System.Windows.Forms.ToolStripMenuItem windowToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openChildToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem closeChildToolStripMenuItem; diff --git a/IOB-WIN/MainForm.cs b/IOB-WIN/MainForm.cs index 7e5a1438..fe69f57a 100644 --- a/IOB-WIN/MainForm.cs +++ b/IOB-WIN/MainForm.cs @@ -7,14 +7,66 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using AutoUpdaterDotNET; +using IOB_UT; +using NLog; +using NLog.Targets; +using NLog.Config; namespace IOB_WIN { public partial class MainForm : Form { + /// + /// URL stringa di UPDATE... + /// + protected string updateUrl + { + get + { + //string branchName = utils.CRS("appVers"); + return string.Format("http://seriate.steamware.net:8083/SWS/MAPO/IOB-WIN/{0}/manifest.xml", branchName); + } + } + /// + /// Ramo applicazione (x update) + /// + protected string branchName = "develop"; + public MainForm() { InitializeComponent(); + myInit(); + } + + protected void myInit() + { + loadIniFile(utils.defConfFilePath); + } + /// + /// Carica file ini della configurazione richiesta + /// + /// + private void loadIniFile(string iniConfFile) + { +#if false + displayTaskAndLog(string.Format("Loading iniConfFile: {0}", iniConfFile)); +#endif + + IniFile fIni = new IniFile(iniConfFile); + // salvo branchName... + branchName = fIni.ReadString("BRANCH", "NAME", "develop"); + // se NON sono in DEBUG faccio check update... +#if !(DEBUG) + // avvio autoupdater... + AutoUpdater.Start(updateUrl); +#endif + } + private void mCheckUpdates_Click(object sender, EventArgs e) + { + AutoUpdater.ShowSkipButton = false; + AutoUpdater.ShowRemindLaterButton = false; + AutoUpdater.Start(updateUrl); } protected void closeActiveChild() @@ -48,5 +100,7 @@ namespace IOB_WIN { openChild(); } + + } }