5 Commits

Author SHA1 Message Date
3a87285e58 Update icons 2024-09-26 21:42:44 -04:00
14ac34f27f Set an application icon 2024-09-26 21:35:17 -04:00
72644ef84f Tweaks to install 2024-09-26 21:22:35 -04:00
e732fe9d91 Small updates
- Add manual GH action trigger
- Update release name
2024-09-26 21:00:33 -04:00
3a189986da Adjust startup 2024-09-26 20:53:27 -04:00
4 changed files with 27 additions and 8 deletions

View File

@@ -5,6 +5,8 @@ on:
branches:
- main
workflow_dispatch:
jobs:
deploy-to-github-releases:
runs-on: windows-latest
@@ -24,11 +26,11 @@ jobs:
dotnet-version: 8.0.x
- name: Publish Application
run: dotnet publish WorldClockStatusWindow.csproj -c Release -o publish -r win-x64 --self-contained true
run: dotnet publish WorldClockStatusWindow.csproj -c Release -o publish
- name: Create Velopack Release
run: |
dotnet tool install -g vpk
vpk download github --repoUrl https://github.com/ckaczor/WorldClockStatusWindow
vpk pack -u WorldClockStatusWindow -v ${{ steps.version.outputs.version }} -p publish
vpk upload github --repoUrl https://github.com/ckaczor/WorldClockStatusWindow --publish --releaseName "WorldClockStatusWindow ${{ steps.version.outputs.version }}" --tag v${{ steps.version.outputs.version }} --token ${{ secrets.GITHUB_TOKEN }}
vpk pack -u WorldClockStatusWindow -v ${{ steps.version.outputs.version }} -p publish --packTitle "World Clock Status Window" --shortcuts StartMenuRoot --framework net8.0-x64-desktop
vpk upload github --repoUrl https://github.com/ckaczor/WorldClockStatusWindow --publish --releaseName "${{ steps.version.outputs.version }}" --tag v${{ steps.version.outputs.version }} --token ${{ secrets.GITHUB_TOKEN }}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 198 KiB

View File

@@ -1,4 +1,5 @@
using ChrisKaczor.Wpf.Windows.FloatingStatusWindow;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,11 +9,8 @@ using System.Text.Json;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Threading;
using Serilog;
using Serilog.Core;
using Velopack;
using Velopack.Sources;
using WorldClockStatusWindow.Properties;
namespace WorldClockStatusWindow;
@@ -37,7 +35,7 @@ internal class WindowSource : IWindowSource, IDisposable
_timer = new Timer(1000);
Task.Factory.StartNew(UpdateApp).ContinueWith(_ => Start());
Task.Factory.StartNew(UpdateApp).ContinueWith(task => Start(task.Result.Result));
}
private async Task<bool> UpdateApp()
@@ -47,6 +45,8 @@ internal class WindowSource : IWindowSource, IDisposable
if (!_updateManager.IsInstalled)
return false;
Log.Logger.Information("Checking for update");
await _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText("Checking for update..."));
var newVersion = await _updateManager.CheckForUpdatesAsync();
@@ -54,10 +54,14 @@ internal class WindowSource : IWindowSource, IDisposable
if (newVersion == null)
return false;
Log.Logger.Information("Downloading update");
await _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText("Downloading update..."));
await _updateManager.DownloadUpdatesAsync(newVersion);
Log.Logger.Information("Installing update");
await _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText("Installing update..."));
_updateManager.ApplyUpdatesAndRestart(newVersion);
@@ -70,10 +74,19 @@ internal class WindowSource : IWindowSource, IDisposable
return true;
}
private void Start()
private void Start(bool hasUpdate)
{
Log.Logger.Information($"Start: hasUpdate={hasUpdate}");
if (hasUpdate)
return;
Log.Logger.Information("Load");
Load();
Log.Logger.Information("Starting timer");
_timer.Elapsed += HandleTimerElapsed;
_timer.Enabled = true;
}

View File

@@ -6,10 +6,14 @@
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<StartupObject>WorldClockStatusWindow.Program</StartupObject>
<ApplicationIcon>Resources\Application.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Application.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ChrisKaczor.Wpf.Application.StartWithWindows" Version="1.0.5" />
<PackageReference Include="ChrisKaczor.Wpf.Windows.FloatingStatusWindow" Version="2.0.0.5" />