@@ -43,6 +43,8 @@ jobs:
|
|||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
@@ -54,6 +56,8 @@ jobs:
|
|||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
id: upload-release-asset
|
id: upload-release-asset
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.0.5
|
1.0.6
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<RootNamespace>MonsterMonitor</RootNamespace>
|
<RootNamespace>MonsterMonitor</RootNamespace>
|
||||||
<AssemblyName>MonsterMonitor</AssemblyName>
|
<AssemblyName>MonsterMonitor</AssemblyName>
|
||||||
<AssemblyVersion>1.0.5</AssemblyVersion>
|
<AssemblyVersion>1.0.6</AssemblyVersion>
|
||||||
<Version>1.0.5</Version>
|
<Version>1.0.6</Version>
|
||||||
<FileVersion>1.0.5</FileVersion>
|
<FileVersion>1.0.6</FileVersion>
|
||||||
<InformationalVersion>1.0.5</InformationalVersion>
|
<InformationalVersion>1.0.6</InformationalVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Costura.Fody" Version="6.0.0">
|
<PackageReference Include="Costura.Fody" Version="6.0.0">
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace MonsterMonitor.UI
|
|||||||
private readonly Button _btnSettings = new Button();
|
private readonly Button _btnSettings = new Button();
|
||||||
private readonly Button _btnExit = new Button();
|
private readonly Button _btnExit = new Button();
|
||||||
private readonly NotifyIcon _notifyIcon = new NotifyIcon();
|
private readonly NotifyIcon _notifyIcon = new NotifyIcon();
|
||||||
|
private readonly Timer _updateTimer = new Timer();
|
||||||
private readonly Icon _trayIcon;
|
private readonly Icon _trayIcon;
|
||||||
private readonly LogService _log = new LogService();
|
private readonly LogService _log = new LogService();
|
||||||
private readonly PowerManagementService _power = new PowerManagementService();
|
private readonly PowerManagementService _power = new PowerManagementService();
|
||||||
@@ -20,6 +21,7 @@ namespace MonsterMonitor.UI
|
|||||||
private AppController _controller;
|
private AppController _controller;
|
||||||
private AppSettings _settings;
|
private AppSettings _settings;
|
||||||
private bool _allowClose;
|
private bool _allowClose;
|
||||||
|
private bool _isUpdateCheckRunning;
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
@@ -43,7 +45,8 @@ namespace MonsterMonitor.UI
|
|||||||
_controller = new AppController(_log, _power);
|
_controller = new AppController(_log, _power);
|
||||||
_updateService = new GitHubUpdateService(_log);
|
_updateService = new GitHubUpdateService(_log);
|
||||||
RestartServices();
|
RestartServices();
|
||||||
_ = RunUpdateCheckAsync();
|
ConfigureUpdateTimer();
|
||||||
|
_ = RunUpdateCheckAsync(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildUi()
|
private void BuildUi()
|
||||||
@@ -148,6 +151,8 @@ namespace MonsterMonitor.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
_notifyIcon.Visible = false;
|
_notifyIcon.Visible = false;
|
||||||
|
_updateTimer.Stop();
|
||||||
|
_updateTimer.Dispose();
|
||||||
_controller?.Dispose();
|
_controller?.Dispose();
|
||||||
_trayIcon?.Dispose();
|
_trayIcon?.Dispose();
|
||||||
}
|
}
|
||||||
@@ -168,12 +173,41 @@ namespace MonsterMonitor.UI
|
|||||||
_console.ScrollToCaret();
|
_console.ScrollToCaret();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RunUpdateCheckAsync()
|
private void ConfigureUpdateTimer()
|
||||||
|
{
|
||||||
|
_updateTimer.Interval = (int)TimeSpan.FromHours(1).TotalMilliseconds;
|
||||||
|
_updateTimer.Tick += async (_, __) => await RunUpdateCheckAsync(false);
|
||||||
|
_updateTimer.Start();
|
||||||
|
_log.Info("Автопроверка обновлений включена (раз в 1 час).");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task RunUpdateCheckAsync(bool isInitialCheck)
|
||||||
|
{
|
||||||
|
if (_isUpdateCheckRunning)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_isUpdateCheckRunning = true;
|
||||||
|
if (isInitialCheck)
|
||||||
{
|
{
|
||||||
// Небольшая задержка, чтобы окно и лог уже успели инициализироваться.
|
// Небольшая задержка, чтобы окно и лог уже успели инициализироваться.
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_log.Info("Плановая проверка обновлений...");
|
||||||
|
}
|
||||||
|
|
||||||
await _updateService.CheckAndPrepareUpdateAsync();
|
await _updateService.CheckAndPrepareUpdateAsync();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_isUpdateCheckRunning = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static Color GetColor(LogLevel level)
|
private static Color GetColor(LogLevel level)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user