diff --git a/EgwControlCenter.Core/CoreEnum.cs b/EgwControlCenter.Core/CoreEnum.cs new file mode 100644 index 0000000..9668e05 --- /dev/null +++ b/EgwControlCenter.Core/CoreEnum.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EgwControlCenter.Core +{ + public class CoreEnum + { + + public enum AppType + { + None, + Cli, + Machine, + WebApp, + WinApp + } + } +} diff --git a/EgwControlCenter.Core/EgwControlCenter.Core.csproj b/EgwControlCenter.Core/EgwControlCenter.Core.csproj index fa71b7a..8d46b1c 100644 --- a/EgwControlCenter.Core/EgwControlCenter.Core.csproj +++ b/EgwControlCenter.Core/EgwControlCenter.Core.csproj @@ -6,4 +6,10 @@ enable + + + + + + diff --git a/EgwControlCenter.Core/Models/ControlTarget.cs b/EgwControlCenter.Core/Models/ControlTarget.cs index 008e4c0..e24f0a4 100644 --- a/EgwControlCenter.Core/Models/ControlTarget.cs +++ b/EgwControlCenter.Core/Models/ControlTarget.cs @@ -1,8 +1,10 @@ -using System; +using Newtonsoft.Json.Converters; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; +using System.Text.Json.Serialization; using System.Threading.Tasks; namespace EgwControlCenter.Core.Models @@ -11,7 +13,16 @@ namespace EgwControlCenter.Core.Models { [Key] public int Idx { get; set; } = 0; - public string ObjType { get; set; } = ""; + + /// + /// Tipo applicazione da monitorare + /// + [JsonConverter(typeof(StringEnumConverter))] + public CoreEnum.AppType ApplicationType{ get; set; } = CoreEnum.AppType.None; + + /// + /// Path di base da monitorare + /// public string BasePath { get; set; } = ""; } } diff --git a/EgwControlCenter.Core/Models/ReleaseDTO.cs b/EgwControlCenter.Core/Models/ReleaseDTO.cs new file mode 100644 index 0000000..ce4ad68 --- /dev/null +++ b/EgwControlCenter.Core/Models/ReleaseDTO.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EgwControlCenter.Core.Models +{ + public class ReleaseDTO + { + /// + /// Codice/Nome applicativo + /// + public string CodApp { get; set; } = ""; + + /// + /// Versione applicativo formato semver numerico 4 blocchi + /// + public string VersNum { get; set; } = "0.0.0.0"; + + /// + /// Versione applicativo, formato testuale libero, può essere uguale a VersNum + /// + public string VersText { get; set; } = "a.b"; + + /// + /// Oggetto versione calcolato da VersNum + /// + public Version VersVal + { + get + { + Version answ = new Version(); + try + { + // solo se è una versione valida: SemVer = 2/3 punti + int numPunti = VersNum.Length - VersNum.Replace(".", "").Length; + if (numPunti >= 2 && numPunti <= 3) + { + answ = !string.IsNullOrEmpty(VersNum) ? new Version(VersNum) : new Version(); + } + } + catch { } + return answ; + } + } + + /// + /// Verifica se sia permessa la versione quando viene valutata la versione massima consentita + /// + public bool IsPermitted { get; set; } = false; + + /// + /// Data di release + /// + public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100); + + /// + /// Tag associati a versione, comma separated + /// + public string RelTags { get; set; } = ""; + + /// + /// Url pagina web di changelog (traduzione gestita sul sito target) - calcolato da CodApp + vers + /// + public string UrlChangelog { get; set; } = "http://releases.egalware.com"; + + /// + /// Url pagina web di changelog estesa (traduzione gestita sul sito target) - calcolato da CodApp + vers + /// + public string UrlChangelogExt { get; set; } = "http://releases.egalware.com"; + + /// + /// Attivo/Pubblico (qui calcolato, attivo se la data di release è passata, poi potrebbe essere gestito a parte da DB) + /// + public bool IsActive { get; set; } = false; + } +} diff --git a/EgwControlCenter.Core/Models/TargetStatus.cs b/EgwControlCenter.Core/Models/TargetStatus.cs new file mode 100644 index 0000000..8f90757 --- /dev/null +++ b/EgwControlCenter.Core/Models/TargetStatus.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace EgwControlCenter.Core.Models +{ + public class TargetStatus + { + #region Public Properties + + public string CodApp { get; set; } = ""; + + /// + /// Release locale (es Macchine: come letta da file *.mlde) + /// + public ReleaseDTO CurrLocal { get; set; } = new ReleaseDTO(); + + /// + /// DataOra ultima verifica locale + /// + public DateTime LastUpdateLoc { get; set; } = DateTime.Now; + + /// + /// DataOra ultima verifica remota + /// + public DateTime LastUpdateRem { get; set; } = DateTime.Now; + + /// + /// Elenco release remote da REST service + /// + public List ListRemote { get; set; } = new List(); + + #endregion Public Properties + + #region Public Methods + + /// + /// Calcolo condizione "ci sono update": + /// - almeno 1 rel remota + /// - la rel remota "+ recente" / + alta > rel locale + /// + /// + public bool HasUpdate() + { + bool answ = false; + if (ListRemote != null && ListRemote.Count > 0) + { + // prendo max release + var lastRemote = ListRemote.OrderByDescending(x => x.VersVal).FirstOrDefault(); + //devo averla trovata... + if (lastRemote != null) + { + answ = lastRemote.VersVal > CurrLocal.VersVal; + } + } + return answ; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/EgwControlCenter.Core/ReleaseChecker.cs b/EgwControlCenter.Core/ReleaseChecker.cs new file mode 100644 index 0000000..d3d9dba --- /dev/null +++ b/EgwControlCenter.Core/ReleaseChecker.cs @@ -0,0 +1,350 @@ +using EgwControlCenter.Core.Models; +using Newtonsoft.Json; +using NLog; +using RestSharp; +using RestSharp.Serializers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EgwControlCenter.Core +{ + public class ReleaseChecker + { + #region Public Constructors + + public ReleaseChecker(string baseDir, string currConfig) + { + AppDir = baseDir; + ConfName = currConfig; + // verifico path... + if (string.IsNullOrEmpty(AppDir)) + { + AppDir = AppDomain.CurrentDomain.BaseDirectory; + } + if (File.Exists(ConfPath)) + { + var rawData = File.ReadAllText(ConfPath); + if (!string.IsNullOrEmpty(rawData)) + { + CurrPatrolCont = JsonConvert.DeserializeObject(rawData) ?? new PatrolSettings(); + } + } + // cerco se presente file status precedente e lo ricarico... + if (File.Exists(StatusPath)) + { + var rawData = File.ReadAllText(StatusPath); + if (!string.IsNullOrEmpty(rawData)) + { + ListStatus = JsonConvert.DeserializeObject>(rawData) ?? new List(); + } + } + } + + #endregion Public Constructors + + #region Public Properties + + /// + /// Elenco degli oggetti stato dei programmi monitorati + /// + public List ListStatus { get; set; } = new List(); + + protected static string apiUrl = "https://liman.egalware.com/ELM.Api/"; + + #endregion Public Properties + + #region Public Methods + + /// + /// Esegue verifica remota versioni x i sw tracciati + /// + /// + public async Task CheckCurrReleases() + { + // ciclo x ogni item da controllare + foreach (var item in ListStatus) + { + if (item.CurrLocal != null) + { + // verifico release da remoto aggiorno obj + var ListRem = GetRemoteRel(item.CurrLocal.CodApp, item.CurrLocal.VersNum); + if (ListRem != null) + { + item.ListRemote = ListRem; + item.LastUpdateRem = DateTime.Now; + } + } + } + // salvo status... + SaveStatus(); + } + + + private static List GetRemoteRel(string CodApp, string CurrVers) + { + List answ = new List(); + try + { + // client chiamate rest + var client = new RestClient(apiUrl); + string rawData = ""; + // Chiamo il metodo! + var checkRel = new RestRequest($"/api/Release/filt/{CodApp}?VersMin={CurrVers}", Method.Get); + //var listNextRel = new RestRequest($"/api/Release/filt/TestMachine?VersMin=1.1.0.0", Method.Get); + + // effettuo vera chiamata + var pUpd = Task.Run(async () => + { + var currResp = await client.GetAsync(checkRel); + if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null) + { + var currList = JsonConvert.DeserializeObject>(currResp.Content); + if (currList != null) + { + answ = currList; + } + } + }); + pUpd.Wait(); + } + catch (Exception exc) + { + Log.Error($"Eccezione in fase gestione REST services{Environment.NewLine}{exc}"); + } + + return answ; + } + + /// + /// Classe logger + /// + public static Logger Log = LogManager.GetCurrentClassLogger(); + + /// + /// Aggiorna (se necessario) lo stato degli oggetti da monitorare + /// + /// + /// + public bool UpdateLocalStatus(bool doRefresh) + { + bool fatto = false; + // se non forzato verifico file dello status salvato x necessità refresh + if (!doRefresh) + { + doRefresh = checkScaduto(); + } + // verifico se procedere... + if (doRefresh) + { + // nuovo obj controlli + List newListStatus = new List(); + // ciclo x ogni item da controllare + foreach (var item in CurrPatrolCont.TargetList) + { + // verifico contenuto secondo tipo + if (item != null) + { + switch (item.ApplicationType) + { + case CoreEnum.AppType.None: + break; + + case CoreEnum.AppType.Cli: + break; + + case CoreEnum.AppType.Machine: + // processo la folder indicata e cerco tutte le macchine contenute + if (Directory.Exists(item.BasePath)) + { + // recupero elenco sottodirectory = macchine + var dirList = Directory.GetDirectories(item.BasePath); + // ciclo e cerco i file mlde... + foreach (var currDir in dirList) + { + // cerco se ci sia un file mlde... + var fileFound = Directory.GetFiles(currDir, "*.mlde"); + if (fileFound != null && fileFound.Count() > 0) + { + // prendo il primo... + var tgtFile = fileFound.FirstOrDefault() ?? ""; + var currRelDto = MldeGetRelease(tgtFile); + if (currRelDto != null) + { + newListStatus.Add(new TargetStatus() + { + CodApp = currDir, + CurrLocal = currRelDto, + LastUpdateLoc = DateTime.Now + }); + } + } + } + } + + break; + + case CoreEnum.AppType.WebApp: + break; + + case CoreEnum.AppType.WinApp: + break; + + default: + break; + } + } + + // aggiungo oggetto TargetStatus + } + // aggiorno obj... + ListStatus = newListStatus; + // salvo status... + SaveStatus(); + fatto = true; + } + return fatto; + } + + #endregion Public Methods + + #region Private Properties + + private string AppDir { get; set; } = ""; + + /// + /// Periodo minimo per autorefresh versioni default 1 gg) + /// protected TimeSpan AutoRefreshVeto { get; set; } = TimeSpan.FromDays(1); + /// + private TimeSpan AutoRefreshVeto { get; set; } = TimeSpan.FromSeconds(30); + + private string ConfName { get; set; } = ""; + + /// + /// Path file di conf check + /// + private string ConfPath + { + get => Path.Combine(AppDir, ConfName); + } + + /// + /// Configurazione degli oggetti da monitorare + /// + protected PatrolSettings CurrPatrolCont { get; set; } = new PatrolSettings(); + + private string StatusName { get; set; } = "LastStatus.json"; + + /// + /// Path file salvataggio status + /// + private string StatusPath + { + get => Path.Combine(AppDir, StatusName); + } + + #endregion Private Properties + + #region Private Methods + + /// + /// Verifica se il check sia scaduto rispetto ad AutoRefreshVeto + /// + /// + private bool checkScaduto() + { + bool answ = false; + DateTime adesso = DateTime.Now; + // ciclo per ogni oggetto della lista... + foreach (var item in ListStatus) + { + if (item.LastUpdateLoc.Add(AutoRefreshVeto) < adesso) + { + answ = true; + // esco! + break; + } + } + return answ; + } + + /// + /// Recupera oggetto releaseDTO da file indicato + /// + /// + /// + private ReleaseDTO? MldeGetRelease(string filePath) + { + ReleaseDTO? answ = null; + if (File.Exists(filePath)) + { + string versNum = ""; + string versTxt = ""; + string codApp = ""; + // leggo una riga alla volta e cerco le chaivi + using (StreamReader reader = new StreamReader(filePath)) + { + string? line; + bool stop = false; + while ((line = reader.ReadLine()) != null && !stop) + { + if (line.StartsWith("PP_VER")) + { + // splitto e prendo secondo + var splitTxt = line.Split("="); + if (splitTxt.Length > 1) + { + versTxt = splitTxt[1].Trim().Replace("'", "").Trim(); + } + } + else if (line.StartsWith("PP_NVER")) + { + // splitto e prendo secondo + var splitTxt = line.Split("="); + if (splitTxt.Length > 1) + { + versNum = splitTxt[1].Trim().Replace("'", "").Trim(); + } + } + else if (line.StartsWith("MACH_NAME")) + { + // splitto e prendo secondo + var splitTxt = line.Split("="); + if (splitTxt.Length > 1) + { + codApp = splitTxt[1].Trim().Replace("'", "").Trim(); + } + } + // se ho trovato tutto esco! + stop = !string.IsNullOrEmpty(versNum) && !string.IsNullOrEmpty(versTxt) && !string.IsNullOrEmpty(codApp); + } + } + // creo OBJ e lo restituisco... + answ = new ReleaseDTO() + { + CodApp = codApp, + ReleaseDate = DateTime.Now, + VersNum = versNum, + VersText = versTxt + }; + } + return answ; + } + + /// + /// Effettua salvataggio obj status + /// + private void SaveStatus() + { + var rawData = JsonConvert.SerializeObject(ListStatus, Formatting.Indented); + if (rawData != null && rawData.Length > 2) + { + File.WriteAllText(StatusPath, rawData); + } + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/EgwControlCenter/App.config b/EgwControlCenter/App.config index 9fb6570..246180f 100644 --- a/EgwControlCenter/App.config +++ b/EgwControlCenter/App.config @@ -56,7 +56,7 @@ - + diff --git a/EgwControlCenter/Conf/.placeholder b/EgwControlCenter/Conf/.placeholder new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/EgwControlCenter/Conf/.placeholder @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/EgwControlCenter/Conf/ConfPatrol.json b/EgwControlCenter/Conf/ConfPatrol.json new file mode 100644 index 0000000..c150129 --- /dev/null +++ b/EgwControlCenter/Conf/ConfPatrol.json @@ -0,0 +1,9 @@ +{ + "TargetList": [ + { + "Idx": 1, + "ApplicationType": "Machine", + "BasePath": "C:\\Testing\\Machine" + } + ] +} diff --git a/EgwControlCenter/ControlCenter.Designer.cs b/EgwControlCenter/ControlCenter.Designer.cs index 1e1462e..043fbf9 100644 --- a/EgwControlCenter/ControlCenter.Designer.cs +++ b/EgwControlCenter/ControlCenter.Designer.cs @@ -35,7 +35,8 @@ trayMenu = new ContextMenuStrip(components); notifyIcon1 = new NotifyIcon(components); btnSetup = new Button(); - txtAuth = new TextBox(); + btnUpdate = new Button(); + lblOut = new Label(); SuspendLayout(); // // label1 @@ -73,28 +74,40 @@ // // btnSetup // - btnSetup.Location = new Point(699, 77); + btnSetup.Location = new Point(761, 23); btnSetup.Name = "btnSetup"; - btnSetup.Size = new Size(75, 23); + btnSetup.Size = new Size(27, 23); btnSetup.TabIndex = 3; - btnSetup.Text = "Setup"; + btnSetup.Text = "..."; btnSetup.UseVisualStyleBackColor = true; btnSetup.Click += btnSetup_Click; // - // txtAuth + // btnUpdate // - txtAuth.Location = new Point(593, 77); - txtAuth.Name = "txtAuth"; - txtAuth.PasswordChar = '*'; - txtAuth.Size = new Size(100, 23); - txtAuth.TabIndex = 4; + btnUpdate.Location = new Point(577, 77); + btnUpdate.Name = "btnUpdate"; + btnUpdate.Size = new Size(75, 23); + btnUpdate.TabIndex = 4; + btnUpdate.Text = "Update"; + btnUpdate.UseVisualStyleBackColor = true; + btnUpdate.Click += btnUpdate_Click; + // + // lblOut + // + lblOut.AutoSize = true; + lblOut.Location = new Point(44, 117); + lblOut.Name = "lblOut"; + lblOut.Size = new Size(12, 15); + lblOut.TabIndex = 5; + lblOut.Text = "-"; // // ControlCenter // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(800, 450); - Controls.Add(txtAuth); + Controls.Add(lblOut); + Controls.Add(btnUpdate); Controls.Add(btnSetup); Controls.Add(label2); Controls.Add(label1); @@ -115,6 +128,7 @@ private ContextMenuStrip trayMenu; private NotifyIcon notifyIcon1; private Button btnSetup; - private TextBox txtAuth; + private Button btnUpdate; + private Label lblOut; } } diff --git a/EgwControlCenter/ControlCenter.cs b/EgwControlCenter/ControlCenter.cs index 11658db..da238be 100644 --- a/EgwControlCenter/ControlCenter.cs +++ b/EgwControlCenter/ControlCenter.cs @@ -1,5 +1,9 @@ using System.Windows.Forms; using static EgwControlCenter.AccEnum; +using Microsoft.VisualBasic; +using EgwControlCenter.Core; +using System.Diagnostics; +using Newtonsoft.Json; namespace EgwControlCenter { @@ -10,8 +14,9 @@ namespace EgwControlCenter public ControlCenter() { InitializeComponent(); - setupTrayIcon(); - createTrayMenu(); + SetupTrayIcon(); + CreateTrayMenu(); + InitObjects(); } #endregion Public Constructors @@ -25,12 +30,51 @@ namespace EgwControlCenter #endregion Protected Fields + #region Private Properties + + private ReleaseChecker CurrCheck { get; set; } = new ReleaseChecker("", ""); + + #endregion Private Properties + #region Private Methods + private void btnSetup_Click(object sender, EventArgs e) + { + string authPwd = Interaction.InputBox("Prego inserire pwd per abilitare lo sblocco", "Verifica Utente", "", 10, 10); + //verifico passphrase + if (authPwd == "24068Seriate") + { + TargetSetup tgtForm = new TargetSetup(); + tgtForm.Show(); + } + else + { + string message = "La passphrase inserita non è corretta. Impossibile procedere"; + string caption = "Auth Error"; + MessageBoxButtons buttons = MessageBoxButtons.OK; + DialogResult result; + result = MessageBox.Show(message, caption, buttons); + } + } + + private async void btnUpdate_Click(object sender, EventArgs e) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + // effettua un refresh del controllo status... + bool localOk = CurrCheck.UpdateLocalStatus(true); + await CurrCheck.CheckCurrReleases(); + sw.Stop(); + string rawConf = JsonConvert.SerializeObject(CurrCheck, Formatting.Indented); + lblOut.Text = rawConf; + lblOut.Text += $"{Environment.NewLine}---------------------{Environment.NewLine}"; + lblOut.Text += $"Eseguito refresh in {sw.ElapsedMilliseconds:N0} ms"; + } + /// /// Verifica stato windows (minimized/normal) e visibilità con tray... /// - private void checkFormVisibility() + private void CheckFormVisibility() { // se non può massimizzare imposto COMUNQUE a minimized... if (!AccUtils.CRB("windowCanMax")) @@ -61,43 +105,6 @@ namespace EgwControlCenter #endif } - /// - /// crea menù tray x applicazione - /// - private void createTrayMenu() - { - // Fix testi menù tray... - trayMenu.Items.Clear(); - // SE permessa massimizzazione... - trayMenu.Items.Add("Show EgalWare ACC"); - // se è permesso chiudere - trayMenu.Items.Add("Close EgalWare ACC"); - } - - /// - /// Gestisce "andata nel tray" della form - /// - private void sendToTray() - { - if (!notifyIcon1.Visible) - { - notifyIcon1.BalloonTipTitle = AccUtils.CRS("appName"); - notifyIcon1.BalloonTipText = $"{AccUtils.CRS("appName")} running on tray"; - notifyIcon1.Visible = true; - notifyIcon1.ShowBalloonTip(100); - } - Hide(); - } - - private void setupTrayIcon() - { - // fix icon! - var currObj = System.Reflection.Assembly.GetExecutingAssembly().GetName(); - notifyIcon1.Text = $"EgalWare's AppControlCenter | {currObj.Version}"; - //Icon = Icon.ExtractAssociatedIcon(AccUtils.defIconFilePath); - //notifyIcon1.Icon = Icon.ExtractAssociatedIcon(AccUtils.defIconFilePath); - } - /// /// evento chiusura /// @@ -106,40 +113,10 @@ namespace EgwControlCenter private void ControlCenter_FormClosing(object sender, FormClosingEventArgs e) { #if false - closeAllChild(); + closeAllChild(); #endif } - - /// - /// click su menù contestuale in tray - /// - /// - /// - private void trayMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) - { - if (e != null && e.ClickedItem != null && !string.IsNullOrEmpty(e.ClickedItem.Text)) - { - if (e.ClickedItem.Text.StartsWith("Close")) - { -#if false - // stop child adapters... - closeAllChild(); -#endif - // chiudo! - Close(); - } - else if (e.ClickedItem.Text.StartsWith("Show")) - { - if (AccUtils.CRB("windowCanMax")) - { - Show(); - WindowState = FormWindowState.Normal; - } - } - } - } - /// /// evento resize /// @@ -147,7 +124,7 @@ namespace EgwControlCenter /// private void ControlCenter_Resize(object sender, EventArgs e) { - checkFormVisibility(); + CheckFormVisibility(); } /// @@ -168,10 +145,29 @@ namespace EgwControlCenter } } #if false - displayTaskAndLog("Main Form SHOWN (MDI)"); + displayTaskAndLog("Main Form SHOWN (MDI)"); #endif } + /// + /// crea menù tray x applicazione + /// + private void CreateTrayMenu() + { + // Fix testi menù tray... + trayMenu.Items.Clear(); + // SE permessa massimizzazione... + trayMenu.Items.Add("Show EgalWare ACC"); + // se è permesso chiudere + trayMenu.Items.Add("Close EgalWare ACC"); + } + + private void InitObjects() + { + // init obj gestione check... + CurrCheck = new ReleaseChecker(AccUtils.confDir, "ConfPatrol.json"); + } + /// /// doppio click su tray icon /// @@ -187,20 +183,59 @@ namespace EgwControlCenter } } - #endregion Private Methods - - private void btnSetup_Click(object sender, EventArgs e) + /// + /// Gestisce "andata nel tray" della form + /// + private void sendToTray() { - //verifico passphrase - if (txtAuth.Text == "24068Seriate") + if (!notifyIcon1.Visible) { - TargetSetup tgtForm = new TargetSetup(); - tgtForm.Show(); + notifyIcon1.BalloonTipTitle = AccUtils.CRS("appName"); + notifyIcon1.BalloonTipText = $"{AccUtils.CRS("appName")} running on tray"; + notifyIcon1.Visible = true; + notifyIcon1.ShowBalloonTip(100); } - else + Hide(); + } + + private void SetupTrayIcon() + { + // fix icon! + var currObj = System.Reflection.Assembly.GetExecutingAssembly().GetName(); + notifyIcon1.Text = $"EgalWare's AppControlCenter | {currObj.Version}"; + //Icon = Icon.ExtractAssociatedIcon(AccUtils.defIconFilePath); + //notifyIcon1.Icon = Icon.ExtractAssociatedIcon(AccUtils.defIconFilePath); + } + + /// + /// click su menù contestuale in tray + /// + /// + /// + private void trayMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + if (e != null && e.ClickedItem != null && !string.IsNullOrEmpty(e.ClickedItem.Text)) { - txtAuth.Text = ""; + if (e.ClickedItem.Text.StartsWith("Close")) + { +#if false + // stop child adapters... + closeAllChild(); +#endif + // chiudo! + Close(); + } + else if (e.ClickedItem.Text.StartsWith("Show")) + { + if (AccUtils.CRB("windowCanMax")) + { + Show(); + WindowState = FormWindowState.Normal; + } + } } } + + #endregion Private Methods } } \ No newline at end of file diff --git a/EgwControlCenter/EgwControlCenter.csproj b/EgwControlCenter/EgwControlCenter.csproj index 17672c4..c538ad8 100644 --- a/EgwControlCenter/EgwControlCenter.csproj +++ b/EgwControlCenter/EgwControlCenter.csproj @@ -12,4 +12,13 @@ + + + Always + + + PreserveNewest + + + \ No newline at end of file