diff --git a/EgwControlCenter.App/BlazorForm.Designer.cs b/EgwControlCenter.App/BlazorForm.Designer.cs index 4b9b0d1..a11513f 100644 --- a/EgwControlCenter.App/BlazorForm.Designer.cs +++ b/EgwControlCenter.App/BlazorForm.Designer.cs @@ -33,6 +33,7 @@ blazorWebView1 = new Microsoft.AspNetCore.Components.WebView.WindowsForms.BlazorWebView(); notifyIcon1 = new NotifyIcon(components); trayMenu = new ContextMenuStrip(components); + timerCheck = new System.Windows.Forms.Timer(components); SuspendLayout(); // // blazorWebView1 @@ -40,7 +41,7 @@ blazorWebView1.Dock = DockStyle.Fill; blazorWebView1.Location = new Point(0, 0); blazorWebView1.Name = "blazorWebView1"; - blazorWebView1.Size = new Size(800, 450); + blazorWebView1.Size = new Size(690, 370); blazorWebView1.StartPath = "/"; blazorWebView1.TabIndex = 0; blazorWebView1.Text = "blazorWebView1"; @@ -60,11 +61,16 @@ trayMenu.Size = new Size(61, 4); trayMenu.ItemClicked += trayMenu_ItemClicked; // + // timerCheck + // + timerCheck.Interval = 1000; + timerCheck.Tick += timerCheck_Tick; + // // BlazorForm // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(690, 370); Controls.Add(blazorWebView1); Icon = (Icon)resources.GetObject("$this.Icon"); Name = "BlazorForm"; @@ -80,5 +86,6 @@ private Microsoft.AspNetCore.Components.WebView.WindowsForms.BlazorWebView blazorWebView1; private NotifyIcon notifyIcon1; private ContextMenuStrip trayMenu; + private System.Windows.Forms.Timer timerCheck; } } diff --git a/EgwControlCenter.App/BlazorForm.cs b/EgwControlCenter.App/BlazorForm.cs index ea69bc4..0e5e878 100644 --- a/EgwControlCenter.App/BlazorForm.cs +++ b/EgwControlCenter.App/BlazorForm.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualBasic.Logging; using NLog; using System.Data; +using System.Reflection; namespace EgwControlCenter.App { @@ -15,12 +16,21 @@ namespace EgwControlCenter.App public BlazorForm() { InitializeComponent(); - //init preliminare servizio controllo - MainAppControlService = new AppControlService(); + FormInit(); InitBlazorView(); ForceReload(); } + private void FormInit() + { + //init preliminare servizio controllo + MainAppControlService = new AppControlService(); + timerCheck.Interval = (MainAppControlService.RefreshPeriod * 1000); + MainAppControlService.EA_StatusUpdated += MainAppControlService_EA_StatusUpdated; + // sistemo timer + timerCheck.Start(); + } + #endregion Public Constructors #region Private Fields @@ -46,8 +56,8 @@ namespace EgwControlCenter.App private void BlazorForm_FormClosing(object sender, FormClosingEventArgs e) { - //timerCheck.Stop(); - //timerCheck.Dispose(); + timerCheck.Stop(); + timerCheck.Dispose(); } private void BlazorForm_Load(object sender, EventArgs e) @@ -95,7 +105,7 @@ namespace EgwControlCenter.App /// private void ForceReload() { - MainAppControlService.DoForceCheck(); + MainAppControlService.DoFullCheck(true); } private void InitBlazorView() @@ -113,6 +123,23 @@ namespace EgwControlCenter.App blazorWebView1.RootComponents.Add("#app"); } + /// + /// Verifica se ci siano update da mostrare come notifica in tray + /// + /// + private void MainAppControlService_EA_StatusUpdated() + { + // notifica ballontip se ho aggiornamenti... + if (WindowState != FormWindowState.Normal) + { + notifyIcon1.BalloonTipTitle = "EgalWare's App Control Center"; + notifyIcon1.BalloonTipText = "Update found!"; + notifyIcon1.BalloonTipIcon = ToolTipIcon.Warning; + notifyIcon1.BalloonTipClicked += NotifyIcon1_BalloonTipClicked; + notifyIcon1.ShowBalloonTip(200); + } + } + private void NotifyIcon1_BalloonTipClicked(object? sender, EventArgs e) { Show(); @@ -159,6 +186,16 @@ namespace EgwControlCenter.App { // fix icon! notifyIcon1.Text = $"EgalWare's AppControlCenter | {CurrAssembly.Version}"; + Assembly assembly = Assembly.GetExecutingAssembly(); + string startDir = Path.GetDirectoryName(assembly.Location)!; + string icoPath = Path.Combine(startDir, "favicon.ico"); + notifyIcon1.Icon = Icon.ExtractAssociatedIcon(icoPath); + } + + private void timerCheck_Tick(object sender, EventArgs e) + { + // esegue controllo locale ed eventualmente remoto se scaduto... + MainAppControlService.DoFullCheck(false); } /// diff --git a/EgwControlCenter.App/BlazorForm.resx b/EgwControlCenter.App/BlazorForm.resx index dc23c51..548a0ea 100644 --- a/EgwControlCenter.App/BlazorForm.resx +++ b/EgwControlCenter.App/BlazorForm.resx @@ -290,6 +290,9 @@ AAA= + + 236, 17 + AAABAAEAMDAAAAEAIACoJQAAFgAAACgAAAAwAAAAYAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA diff --git a/EgwControlCenter.App/Components/Compo/TargetSetup.razor b/EgwControlCenter.App/Components/Compo/TargetSetup.razor index 2d3da3a..14f1392 100644 --- a/EgwControlCenter.App/Components/Compo/TargetSetup.razor +++ b/EgwControlCenter.App/Components/Compo/TargetSetup.razor @@ -6,7 +6,7 @@ {
- +
@@ -21,7 +21,7 @@
- +
diff --git a/EgwControlCenter.App/Components/Pages/Index.razor.cs b/EgwControlCenter.App/Components/Pages/Index.razor.cs index a2cfa17..a19dfee 100644 --- a/EgwControlCenter.App/Components/Pages/Index.razor.cs +++ b/EgwControlCenter.App/Components/Pages/Index.razor.cs @@ -22,7 +22,7 @@ namespace EgwControlCenter.App.Components.Pages protected void ForceCheck() { - ACService.DoForceCheck(); + ACService.DoFullCheck(true); } #endregion Protected Methods diff --git a/EgwControlCenter.App/EgwControlCenter.App.csproj b/EgwControlCenter.App/EgwControlCenter.App.csproj index efffa66..cdc5737 100644 --- a/EgwControlCenter.App/EgwControlCenter.App.csproj +++ b/EgwControlCenter.App/EgwControlCenter.App.csproj @@ -27,4 +27,9 @@ PreserveNewest + + + Always + + \ No newline at end of file diff --git a/EgwControlCenter.App/favicon.ico b/EgwControlCenter.App/favicon.ico new file mode 100644 index 0000000..28dcc86 Binary files /dev/null and b/EgwControlCenter.App/favicon.ico differ diff --git a/EgwControlCenter.App/wwwroot/css/app.css b/EgwControlCenter.App/wwwroot/css/app.css index f39d87c..2fcd330 100644 --- a/EgwControlCenter.App/wwwroot/css/app.css +++ b/EgwControlCenter.App/wwwroot/css/app.css @@ -66,4 +66,16 @@ a, background-color: #000000; height: 1.6rem; align-items: center; +} +@media (max-width: 640px) { + body { + font-size: 0.8em; + line-height: 1.1; + } +} +@media (max-width: 1650px) { + body { + font-size: 0.9em; + line-height: 1.2; + } } \ No newline at end of file diff --git a/EgwControlCenter.App/wwwroot/css/app.less b/EgwControlCenter.App/wwwroot/css/app.less index 9bcd85c..8f57c7f 100644 --- a/EgwControlCenter.App/wwwroot/css/app.less +++ b/EgwControlCenter.App/wwwroot/css/app.less @@ -67,4 +67,21 @@ a, .btn-link { background-color: #000000; height: 1.6rem; align-items: center; -} \ No newline at end of file +} + + +@media (max-width: 640px) { + + body { + font-size: 0.8em; + line-height: 1.1; + } +} + +@media (max-width: 1650px) { + + body { + font-size: 0.9em; + line-height: 1.2; + } +} diff --git a/EgwControlCenter.App/wwwroot/css/app.min.css b/EgwControlCenter.App/wwwroot/css/app.min.css index 508357c..b925241 100644 --- a/EgwControlCenter.App/wwwroot/css/app.min.css +++ b/EgwControlCenter.App/wwwroot/css/app.min.css @@ -1 +1 @@ -h1,h2,h3,h4,h5,h6,b,display-1,display-2,display-3,display-4{font-family:'Lato',sans-serif;}html,body{font-family:'Roboto Condensed',sans-serif;line-height:1.3;}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.bottom-row{color:#dedede;background-color:#000;height:1.6rem;align-items:center;} \ No newline at end of file +h1,h2,h3,h4,h5,h6,b,display-1,display-2,display-3,display-4{font-family:'Lato',sans-serif;}html,body{font-family:'Roboto Condensed',sans-serif;line-height:1.3;}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.bottom-row{color:#dedede;background-color:#000;height:1.6rem;align-items:center;}@media(max-width:640px){body{font-size:.8em;line-height:1.1;}}@media(max-width:1650px){body{font-size:.9em;line-height:1.2;}} \ No newline at end of file diff --git a/EgwControlCenter.Core/AppControlService.cs b/EgwControlCenter.Core/AppControlService.cs index bac613a..dcdb529 100644 --- a/EgwControlCenter.Core/AppControlService.cs +++ b/EgwControlCenter.Core/AppControlService.cs @@ -29,12 +29,23 @@ namespace EgwControlCenter.Core #region Public Events public event Action EA_ConfigUpdated = null!; + public event Action EA_StatusUpdated = null!; #endregion Public Events #region Public Properties + public List ListAppStatus + { + get => CurrCheck.ListAppStatus; + set + { + CurrCheck.ListAppStatus = value; + ReportStatusUpd(); + } + } + public int RefreshPeriod { get => CurrCheck.CurrPatrolCont.RefreshIntSec; @@ -49,6 +60,16 @@ namespace EgwControlCenter.Core } } + public List TargetList + { + get => CurrCheck.CurrPatrolCont.TargetList; + set + { + CurrCheck.CurrPatrolCont.TargetList = value; + ReportConfigUpd(); + } + } + public int VetoCheck { get => CurrCheck.CurrPatrolCont.VetoCheckMinutes; @@ -63,47 +84,28 @@ namespace EgwControlCenter.Core } } - public List TargetList - { - get => CurrCheck.CurrPatrolCont.TargetList; - set - { - CurrCheck.CurrPatrolCont.TargetList = value; - ReportConfigUpd(); - } - } - - public List ListAppStatus - { - get => CurrCheck.ListAppStatus; - set - { - CurrCheck.ListAppStatus = value; - ReportStatusUpd(); - } - } - - public void DoForceCheck() - { - //// forzo rilettura... - //CurrCheck = new ReleaseChecker(ConfDir, DataDir); - // effettua un refresh del controllo status... - bool locCheckOk = CurrCheck.UpdateLocalStatus(true); - if (locCheckOk) - { - bool remCheckOk = CurrCheck.CheckRemoteReleases(); - } - ReportStatusUpd(); - } - #endregion Public Properties #region Public Methods /// - /// Effettua rilettura configurazione e setup controlli... + /// Effettua un controllo completo (loacele remoto) /// - /// + /// se true esegue anche prima della scadenza veto + public void DoFullCheck(bool doForce) + { + // effettua un refresh del controllo status... + bool locCheckOk = CurrCheck.UpdateLocalStatus(doForce); + if (locCheckOk) + { + bool remCheckOk = CurrCheck.CheckRemoteReleases(); + ReportStatusUpd(); + } + } + + /// + /// Effettua rilettura configurazione e setup controlli... + /// /// Effettua salvataggio configurazione /// - /// public void DoSaveConfig() { try @@ -168,11 +169,19 @@ namespace EgwControlCenter.Core EA_ConfigUpdated?.Invoke(); } } + private void ReportStatusUpd() { - if (EA_StatusUpdated!= null) + if (EA_StatusUpdated != null) { - EA_StatusUpdated?.Invoke(); + // controllo se almeno 1 app abbia update... + foreach (var item in ListAppStatus) + { + if (item.HasUpdate) + { + EA_StatusUpdated?.Invoke(); + } + } } } diff --git a/EgwControlCenter.Core/IAppControlService.cs b/EgwControlCenter.Core/IAppControlService.cs index f06d5b1..48942df 100644 --- a/EgwControlCenter.Core/IAppControlService.cs +++ b/EgwControlCenter.Core/IAppControlService.cs @@ -8,10 +8,38 @@ namespace EgwControlCenter.Core { public interface IAppControlService { + #region Public Events + + /// + /// Evento update configurazione + /// event Action EA_ConfigUpdated; + + /// + /// Evento udpate status app + /// event Action EA_StatusUpdated; - void DoForceCheck(); + + #endregion Public Events + + #region Public Methods + + /// + /// Effettua un controllo completo (loacele remoto) + /// + /// se true esegue anche prima della scadenza veto + void DoFullCheck(bool doForce); + + /// + /// Effettua rilettura configurazione e setup controlli... + /// void DoReloadConfig(); + + /// + /// Effettua salvataggio configurazione + /// void DoSaveConfig(); + + #endregion Public Methods } -} +} \ No newline at end of file