Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c6cc15281 |
@@ -15,9 +15,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>1.1.4</Version>
|
||||
<AssemblyVersion>1.1.4.0</AssemblyVersion>
|
||||
<FileVersion>1.1.4.0</FileVersion>
|
||||
<Version>1.1.5</Version>
|
||||
<AssemblyVersion>1.1.5.0</AssemblyVersion>
|
||||
<FileVersion>1.1.5.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -187,13 +187,26 @@
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="#444" CornerRadius="8,8,0,0" Padding="12,10">
|
||||
<Grid>
|
||||
<TextBlock Text="Monitor Control" Foreground="White" FontSize="14" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||||
<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.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<TextBlock Text="Monitor Control" Foreground="White" FontSize="14" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||||
<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>
|
||||
</Border>
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ public partial class MainWindow : Window
|
||||
private List<(XMonitor Monitor, List<InputSourceOption> Options)> _loadedMonitors = new();
|
||||
private Storyboard? _spinnerStoryboard;
|
||||
private DispatcherTimer? _showLogButtonTimer;
|
||||
private UpdateInfo? _pendingUpdate;
|
||||
private DateTime _lastUpdateCheck = DateTime.MinValue;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
@@ -53,12 +55,50 @@ public partial class MainWindow : Window
|
||||
};
|
||||
_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(() =>
|
||||
{
|
||||
Top = workArea.Bottom - ActualHeight - 10;
|
||||
}), 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)
|
||||
{
|
||||
Hide();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define MyAppName "Monitor Control"
|
||||
#define MyAppVersion "1.1.4"
|
||||
#define MyAppVersion "1.1.5"
|
||||
#define MyAppPublisher "MarketAlly"
|
||||
#define MyAppExeName "DellMonitorControl.exe"
|
||||
#define MyAppIcon "MonitorIcon.ico"
|
||||
|
||||
Reference in New Issue
Block a user