EACC
- ok notifica in tray
This commit is contained in:
+9
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
private void ForceReload()
|
||||
{
|
||||
MainAppControlService.DoForceCheck();
|
||||
MainAppControlService.DoFullCheck(true);
|
||||
}
|
||||
|
||||
private void InitBlazorView()
|
||||
@@ -113,6 +123,23 @@ namespace EgwControlCenter.App
|
||||
blazorWebView1.RootComponents.Add<MainBlazor>("#app");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se ci siano update da mostrare come notifica in tray
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -290,6 +290,9 @@
|
||||
AAA=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="timerCheck.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>236, 17</value>
|
||||
</metadata>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAMDAAAAEAIACoJQAAFgAAACgAAAAwAAAAYAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<button class="btn btn-warning btn-lg w-100 shadow" @onclick="DoCancel">Cancel</button>
|
||||
<button class="btn btn-warning btn-lg w-100 shadow" @onclick="DoCancel"><i class="fa-solid fa-ban"></i></button>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-floating">
|
||||
@@ -21,7 +21,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-success btn-lg w-100 shadow" @onclick="DoSave">Save</button>
|
||||
<button class="btn btn-success btn-lg w-100 shadow" @onclick="DoSave"><i class="fa-regular fa-floppy-disk"></i></button>
|
||||
</div>
|
||||
<div class="col-12 my-2">
|
||||
<table class="table table-striped table-sm text-start shadow border">
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace EgwControlCenter.App.Components.Pages
|
||||
|
||||
protected void ForceCheck()
|
||||
{
|
||||
ACService.DoForceCheck();
|
||||
ACService.DoFullCheck(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -27,4 +27,9 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="favicon.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -67,4 +67,21 @@ a, .btn-link {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;}
|
||||
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;}}
|
||||
@@ -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<VersStatusDTO> 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<ControlTarget> 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<ControlTarget> TargetList
|
||||
{
|
||||
get => CurrCheck.CurrPatrolCont.TargetList;
|
||||
set
|
||||
{
|
||||
CurrCheck.CurrPatrolCont.TargetList = value;
|
||||
ReportConfigUpd();
|
||||
}
|
||||
}
|
||||
|
||||
public List<VersStatusDTO> 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
|
||||
|
||||
/// <summary>
|
||||
/// Effettua rilettura configurazione e setup controlli...
|
||||
/// Effettua un controllo completo (loacele remoto)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <param name="doForce">se true esegue anche prima della scadenza veto</param>
|
||||
public void DoFullCheck(bool doForce)
|
||||
{
|
||||
// effettua un refresh del controllo status...
|
||||
bool locCheckOk = CurrCheck.UpdateLocalStatus(doForce);
|
||||
if (locCheckOk)
|
||||
{
|
||||
bool remCheckOk = CurrCheck.CheckRemoteReleases();
|
||||
ReportStatusUpd();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua rilettura configurazione e setup controlli...
|
||||
/// </summary
|
||||
public void DoReloadConfig()
|
||||
{
|
||||
try
|
||||
@@ -121,7 +123,6 @@ namespace EgwControlCenter.Core
|
||||
/// <summary>
|
||||
/// Effettua salvataggio configurazione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,38 @@ namespace EgwControlCenter.Core
|
||||
{
|
||||
public interface IAppControlService
|
||||
{
|
||||
#region Public Events
|
||||
|
||||
/// <summary>
|
||||
/// Evento update configurazione
|
||||
/// </summary>
|
||||
event Action EA_ConfigUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Evento udpate status app
|
||||
/// </summary>
|
||||
event Action EA_StatusUpdated;
|
||||
void DoForceCheck();
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua un controllo completo (loacele remoto)
|
||||
/// </summary>
|
||||
/// <param name="doForce">se true esegue anche prima della scadenza veto</param>
|
||||
void DoFullCheck(bool doForce);
|
||||
|
||||
/// <summary>
|
||||
/// Effettua rilettura configurazione e setup controlli...
|
||||
/// </summary>
|
||||
void DoReloadConfig();
|
||||
|
||||
/// <summary>
|
||||
/// Effettua salvataggio configurazione
|
||||
/// </summary>
|
||||
void DoSaveConfig();
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user