Check for updates when tray menu opens
- Checks for updates in background when user clicks tray icon - Shows clickable blue banner when update available - Rate limited to once per hour to avoid spam - Version 1.1.5 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,9 +15,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.1.4</Version>
|
<Version>1.1.5</Version>
|
||||||
<AssemblyVersion>1.1.4.0</AssemblyVersion>
|
<AssemblyVersion>1.1.5.0</AssemblyVersion>
|
||||||
<FileVersion>1.1.4.0</FileVersion>
|
<FileVersion>1.1.5.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -187,13 +187,26 @@
|
|||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<Border Grid.Row="0" Background="#444" CornerRadius="8,8,0,0" Padding="12,10">
|
<Border Grid.Row="0" Background="#444" CornerRadius="8,8,0,0" Padding="12,10">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock Text="Monitor Control" Foreground="White" FontSize="14" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
<Grid.RowDefinitions>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<RowDefinition Height="Auto"/>
|
||||||
<Button Content="About" Margin="0,0,6,0" Click="AboutButton_Click"
|
<RowDefinition Height="Auto"/>
|
||||||
Style="{StaticResource DarkButton}" FontSize="11"/>
|
</Grid.RowDefinitions>
|
||||||
<Button Content="Exit" Click="ExitButton_Click"
|
<Grid Grid.Row="0">
|
||||||
Style="{StaticResource DarkButton}" FontSize="11"/>
|
<TextBlock Text="Monitor Control" Foreground="White" FontSize="14" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||||||
</StackPanel>
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Content="About" Margin="0,0,6,0" Click="AboutButton_Click"
|
||||||
|
Style="{StaticResource DarkButton}" FontSize="11"/>
|
||||||
|
<Button Content="Exit" Click="ExitButton_Click"
|
||||||
|
Style="{StaticResource DarkButton}" FontSize="11"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<!-- Update Banner -->
|
||||||
|
<Border Name="updateBanner" Grid.Row="1" Background="#0078D4" CornerRadius="3"
|
||||||
|
Padding="8,4" Margin="0,8,0,0" Visibility="Collapsed" Cursor="Hand"
|
||||||
|
MouseLeftButtonUp="UpdateBanner_Click">
|
||||||
|
<TextBlock Name="updateText" Text="Update available!" Foreground="White"
|
||||||
|
FontSize="11" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public partial class MainWindow : Window
|
|||||||
private List<(XMonitor Monitor, List<InputSourceOption> Options)> _loadedMonitors = new();
|
private List<(XMonitor Monitor, List<InputSourceOption> Options)> _loadedMonitors = new();
|
||||||
private Storyboard? _spinnerStoryboard;
|
private Storyboard? _spinnerStoryboard;
|
||||||
private DispatcherTimer? _showLogButtonTimer;
|
private DispatcherTimer? _showLogButtonTimer;
|
||||||
|
private UpdateInfo? _pendingUpdate;
|
||||||
|
private DateTime _lastUpdateCheck = DateTime.MinValue;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
@@ -53,12 +55,50 @@ public partial class MainWindow : Window
|
|||||||
};
|
};
|
||||||
_showLogButtonTimer.Start();
|
_showLogButtonTimer.Start();
|
||||||
|
|
||||||
|
// Check for updates in background (max once per hour)
|
||||||
|
if ((DateTime.Now - _lastUpdateCheck).TotalMinutes > 60)
|
||||||
|
{
|
||||||
|
_lastUpdateCheck = DateTime.Now;
|
||||||
|
_ = CheckForUpdatesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
Dispatcher.BeginInvoke(new Action(() =>
|
Dispatcher.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
Top = workArea.Bottom - ActualHeight - 10;
|
Top = workArea.Bottom - ActualHeight - 10;
|
||||||
}), DispatcherPriority.Loaded);
|
}), DispatcherPriority.Loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task CheckForUpdatesAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var update = await UpdateChecker.CheckForUpdateAsync();
|
||||||
|
if (update != null)
|
||||||
|
{
|
||||||
|
_pendingUpdate = update;
|
||||||
|
await Dispatcher.InvokeAsync(() => ShowUpdateBanner(update));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Silently ignore update check failures
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowUpdateBanner(UpdateInfo update)
|
||||||
|
{
|
||||||
|
updateBanner.Visibility = Visibility.Visible;
|
||||||
|
updateText.Text = $"v{update.LatestVersion} available - Click to update";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateBanner_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (_pendingUpdate != null && !string.IsNullOrEmpty(_pendingUpdate.DownloadUrl))
|
||||||
|
{
|
||||||
|
UpdateChecker.OpenDownloadPage(_pendingUpdate.DownloadUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Window_Deactivated(object sender, EventArgs e)
|
private void Window_Deactivated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Hide();
|
Hide();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#define MyAppName "Monitor Control"
|
#define MyAppName "Monitor Control"
|
||||||
#define MyAppVersion "1.1.4"
|
#define MyAppVersion "1.1.5"
|
||||||
#define MyAppPublisher "MarketAlly"
|
#define MyAppPublisher "MarketAlly"
|
||||||
#define MyAppExeName "DellMonitorControl.exe"
|
#define MyAppExeName "DellMonitorControl.exe"
|
||||||
#define MyAppIcon "MonitorIcon.ico"
|
#define MyAppIcon "MonitorIcon.ico"
|
||||||
|
|||||||
Reference in New Issue
Block a user