Add autostart and update translations

This commit is contained in:
2026-02-14 14:54:23 +01:00
parent bfd3581f26
commit 497795604e
8 changed files with 105 additions and 30 deletions

View File

@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MaxSlurper" xmlns:local="clr-namespace:MaxSlurper"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
StartupUri="MainWindow.xaml"> >
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -1,5 +1,4 @@
using System.Configuration; using System.Linq;
using System.Data;
using Wpf.Ui.Appearance; using Wpf.Ui.Appearance;
namespace MaxSlurper namespace MaxSlurper
@@ -13,7 +12,22 @@ namespace MaxSlurper
{ {
base.OnStartup(e); base.OnStartup(e);
// The theme will be applied automatically when the window is shown bool startMinimized = e.Args.Contains("--minimized", System.StringComparer.OrdinalIgnoreCase);
var mainWindow = new MainWindow();
MainWindow = mainWindow;
if (startMinimized)
{
// Only show the tray icon, don't show the window
mainWindow.WindowState = System.Windows.WindowState.Minimized;
mainWindow.ShowInTaskbar = false;
mainWindow.Hide();
}
else
{
mainWindow.Show();
}
} }
} }
} }

View File

@@ -2,8 +2,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="Farbe aussuche" Title="Farbe auswählen"
Height="500" Height="500"
Width="400" Width="400"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
@@ -26,8 +26,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<!-- Title bar --> <!-- Title bar -->
<ui:TitleBar Grid.Row="0" <ui:TitleBar Grid.Row="0"
Title="Farbe aussuche" Title="Farbe auswählen"
ShowMaximize="False" ShowMaximize="False"
ShowMinimize="False" ShowMinimize="False"
Icon="/logo.png" /> Icon="/logo.png" />
@@ -176,14 +176,14 @@ Height="20"
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ui:Button Content="Lass ma" <ui:Button Content="Abbrechen"
Height="44" Height="44"
Margin="0,0,8,0" Margin="0,0,8,0"
Click="CancelButton_Click" Click="CancelButton_Click"
Appearance="Secondary"/> Appearance="Secondary"/>
<ui:Button Grid.Column="1" <ui:Button Grid.Column="1"
Content="Kopieren &amp; Tschüss" Content="Kopieren &amp; Schließen"
Height="44" Height="44"
Padding="24,0" Padding="24,0"
Click="OkButton_Click" Click="OkButton_Click"

View File

@@ -58,7 +58,7 @@
TextWrapping="Wrap" TextWrapping="Wrap"
FontSize="12" FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,2,0,0"><Run Language="de-de" Text="H"/><Run Text="otkey zum Farben schlürfen"/></TextBlock> Margin="0,2,0,0">Hotkey zum Farben aufnehmen</TextBlock>
</StackPanel> </StackPanel>
</Grid> </Grid>
@@ -99,6 +99,37 @@ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
</StackPanel> </StackPanel>
</ui:Card> </ui:Card>
<!-- Autostart Card -->
<ui:Card Margin="0,0,0,16" Padding="20">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ui:SymbolIcon Symbol="Power24"
FontSize="24"
VerticalAlignment="Center"
Margin="0,0,12,0"/>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="Autostart"
FontSize="16"
FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"/>
<TextBlock Text="Beim Systemstart minimiert starten"
FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,2,0,0"/>
</StackPanel>
<CheckBox Grid.Column="2"
IsChecked="{Binding IsAutostart}"
VerticalAlignment="Center"/>
</Grid>
</ui:Card>
<!-- About Card --> <!-- About Card -->
<ui:Card Padding="20"> <ui:Card Padding="20">
<StackPanel> <StackPanel>
@@ -121,7 +152,7 @@ FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"/> Foreground="{DynamicResource TextFillColorPrimaryBrush}"/>
</Grid> </Grid>
<TextBlock Text="DER ColorPicker für Max" <TextBlock Text="Der Farbwähler für Max"
TextWrapping="Wrap" TextWrapping="Wrap"
FontSize="13" FontSize="13"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Foreground="{DynamicResource TextFillColorSecondaryBrush}"
@@ -129,7 +160,7 @@ TextWrapping="Wrap"
<TextBlock TextWrapping="Wrap" <TextBlock TextWrapping="Wrap"
FontSize="13" FontSize="13"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"> Foreground="{DynamicResource TextFillColorSecondaryBrush}">
<Run Text="Gemacht mit "/> <Run Text="Erstellt mit "/>
<Run Text="♥" Foreground="Red" FontSize="14"/> <Run Text="♥" Foreground="Red" FontSize="14"/>
<Run Text=" von Mathias"/> <Run Text=" von Mathias"/>
</TextBlock> </TextBlock>
@@ -151,13 +182,13 @@ BorderThickness="0,1,0,0"
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="Änderungen werden direkt jespeichert" <TextBlock Text="Änderungen werden automatisch gespeichert"
VerticalAlignment="Center" VerticalAlignment="Center"
FontSize="12" FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"/> Foreground="{DynamicResource TextFillColorSecondaryBrush}"/>
<ui:Button Grid.Column="1" <ui:Button Grid.Column="1"
Content="Zumachen" Content="Schließen"
Height="36" Height="36"
Padding="24,0" Padding="24,0"
Click="Close_Click" Click="Close_Click"

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@@ -7,6 +7,7 @@ using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using MaxSlurper.Models; using MaxSlurper.Models;
using MaxSlurper.Services; using MaxSlurper.Services;
using Microsoft.Win32;
using Wpf.Ui.Controls; using Wpf.Ui.Controls;
namespace MaxSlurper.Controls namespace MaxSlurper.Controls
@@ -31,6 +32,35 @@ public event PropertyChangedEventHandler? PropertyChanged;
} }
} }
private const string RegistryRunKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
private const string AppName = "MaxSlurper";
public bool IsAutostart
{
get
{
using var key = Registry.CurrentUser.OpenSubKey(RegistryRunKey, false);
return key?.GetValue(AppName) != null;
}
set
{
using var key = Registry.CurrentUser.OpenSubKey(RegistryRunKey, true);
if (key == null) return;
if (value)
{
var exePath = Environment.ProcessPath ?? System.Reflection.Assembly.GetEntryAssembly()!.Location;
key.SetValue(AppName, $"\"{exePath}\" --minimized");
}
else
{
key.DeleteValue(AppName, false);
}
OnPropertyChanged();
}
}
public SettingsWindow(AppSettings settings, ISettingsService settingsService, Action<AppSettings> onSettingsChanged) public SettingsWindow(AppSettings settings, ISettingsService settingsService, Action<AppSettings> onSettingsChanged)
{ {
InitializeComponent(); InitializeComponent();
@@ -54,7 +84,7 @@ public event PropertyChangedEventHandler? PropertyChanged;
return; return;
_isCapturingHotkey = true; _isCapturingHotkey = true;
CurrentHotkey = "Drück deine Tasten..."; CurrentHotkey = "Tastenkombination eingeben...";
var captureWindow = new HotkeyCapture(); var captureWindow = new HotkeyCapture();
captureWindow.Owner = this; captureWindow.Owner = this;
@@ -131,7 +161,7 @@ ExtendsContentIntoTitleBar = true;
var infoText = new System.Windows.Controls.TextBlock var infoText = new System.Windows.Controls.TextBlock
{ {
Text = "Drück die Tastenkombination, die de haben willst", Text = "Drücken Sie die gewünschte Tastenkombination",
FontSize = 14, FontSize = 14,
TextAlignment = TextAlignment.Center, TextAlignment = TextAlignment.Center,
Foreground = (System.Windows.Media.Brush)FindResource("TextFillColorSecondaryBrush"), Foreground = (System.Windows.Media.Brush)FindResource("TextFillColorSecondaryBrush"),
@@ -142,7 +172,7 @@ ExtendsContentIntoTitleBar = true;
var keyDisplay = new System.Windows.Controls.TextBlock var keyDisplay = new System.Windows.Controls.TextBlock
{ {
Text = "Warte uff Eingabe...", Text = "Warte auf Eingabe...",
FontSize = 18, FontSize = 18,
FontWeight = FontWeights.SemiBold, FontWeight = FontWeights.SemiBold,
TextAlignment = TextAlignment.Center, TextAlignment = TextAlignment.Center,
@@ -204,7 +234,7 @@ key == Key.LWin || key == Key.RWin)
// Require at least one modifier // Require at least one modifier
if (modifiers == ModifierKeys.None) if (modifiers == ModifierKeys.None)
{ {
keyDisplay.Text = "Mindestens ein Modifier (Strg, Alt, Shift, Win) musste drücken!"; keyDisplay.Text = "Mindestens eine Zusatztaste (Strg, Alt, Shift, Win) erforderlich!";
okButton.IsEnabled = false; okButton.IsEnabled = false;
return; return;
} }

View File

@@ -55,7 +55,7 @@
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}" BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
BorderThickness="1" BorderThickness="1"
Cursor="Hand" Cursor="Hand"
ToolTip="Drück ma druff, dann kannste dir 'ne Farbe raussuche"> ToolTip="Klicken, um eine Farbe auszuwählen">
<Border.Effect> <Border.Effect>
<DropShadowEffect BlurRadius="8" <DropShadowEffect BlurRadius="8"
ShadowDepth="2" ShadowDepth="2"
@@ -72,7 +72,7 @@
<StackPanel Orientation="Vertical" <StackPanel Orientation="Vertical"
Margin="16,0,16,0" Margin="16,0,16,0"
VerticalAlignment="Center"> VerticalAlignment="Center">
<TextBlock Text="Zuletzt jeklaut" <TextBlock Text="Zuletzt aufgenommen"
Style="{StaticResource SubtleText}" Style="{StaticResource SubtleText}"
Margin="0,0,0,4" /> Margin="0,0,0,4" />
<TextBlock Text="{Binding SelectedHex}" <TextBlock Text="{Binding SelectedHex}"
@@ -87,7 +87,7 @@ Style="{StaticResource SubtleText}" />
<!-- Actions --> <!-- Actions -->
<StackPanel Orientation="Vertical" <StackPanel Orientation="Vertical"
DockPanel.Dock="Right"> DockPanel.Dock="Right">
<ui:Button Content="Farbe schlürfen" <ui:Button Content="Farbe aufnehmen"
Appearance="Primary" Appearance="Primary"
Icon="{ui:SymbolIcon Eyedropper24}" Icon="{ui:SymbolIcon Eyedropper24}"
Command="{Binding PickColorCommand}" Command="{Binding PickColorCommand}"
@@ -113,9 +113,9 @@ Padding="16,8"
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="0,0,0,12"> <StackPanel Grid.Row="0" Margin="0,0,0,12">
<TextBlock Text="Wat ick schon so jeklaut hab" <TextBlock Text="Farbverlauf"
Style="{StaticResource HeaderText}" /> Style="{StaticResource HeaderText}" />
<TextBlock Text="Druff klicken und ab dafuer, wa" <TextBlock Text="Klicken zum Kopieren"
Style="{StaticResource SubtleText}" Style="{StaticResource SubtleText}"
Margin="0,4,0,0" /> Margin="0,4,0,0" />
</StackPanel> </StackPanel>

View File

@@ -77,14 +77,14 @@ namespace MaxSlurper
_notifyIcon.Text = "MaxSlurper"; _notifyIcon.Text = "MaxSlurper";
var contextMenu = new ContextMenuStrip(); var contextMenu = new ContextMenuStrip();
var pickItem = new ToolStripMenuItem("Farbe schlürfen"); var pickItem = new ToolStripMenuItem("Farbe aufnehmen");
// Use BeginInvoke to avoid synchronous invocation while windows may be closing // Use BeginInvoke to avoid synchronous invocation while windows may be closing
pickItem.Click += (s, e) => { Dispatcher.BeginInvoke(new Action(() => _vm.PickColorCommand.Execute(null))); }; pickItem.Click += (s, e) => { Dispatcher.BeginInvoke(new Action(() => _vm.PickColorCommand.Execute(null))); };
var openItem = new ToolStripMenuItem("Fenster uffmachen"); var openItem = new ToolStripMenuItem("Fenster öffnen");
openItem.Click += (s, e) => { Dispatcher.BeginInvoke(new Action(() => { Show(); WindowState = WindowState.Normal; Activate(); })); }; openItem.Click += (s, e) => { Dispatcher.BeginInvoke(new Action(() => { Show(); WindowState = WindowState.Normal; Activate(); })); };
var settingsItem = new ToolStripMenuItem("Einstellungen"); var settingsItem = new ToolStripMenuItem("Einstellungen");
settingsItem.Click += (s, e) => { Dispatcher.BeginInvoke(new Action(() => { Show(); WindowState = WindowState.Normal; Activate(); _vm.OpenSettingsCommand.Execute(null); })); }; settingsItem.Click += (s, e) => { Dispatcher.BeginInvoke(new Action(() => { Show(); WindowState = WindowState.Normal; Activate(); _vm.OpenSettingsCommand.Execute(null); })); };
var exitItem = new ToolStripMenuItem("Tschüss"); var exitItem = new ToolStripMenuItem("Beenden");
exitItem.Click += (s, e) => { _notifyIcon.Visible = false; System.Windows.Application.Current.Shutdown(); }; exitItem.Click += (s, e) => { _notifyIcon.Visible = false; System.Windows.Application.Current.Shutdown(); };
contextMenu.Items.Add(pickItem); contextMenu.Items.Add(pickItem);
contextMenu.Items.Add(openItem); contextMenu.Items.Add(openItem);

View File

@@ -13,7 +13,7 @@
<Authors>Mathias Wagner</Authors> <Authors>Mathias Wagner</Authors>
<Company>MaxSlurper</Company> <Company>MaxSlurper</Company>
<Product>MaxSlurper</Product> <Product>MaxSlurper</Product>
<Description>Weil Max danach gefragt hat</Description> <Description>Farbwähler-Anwendung</Description>
<Copyright>Copyright © 2025</Copyright> <Copyright>Copyright © 2025</Copyright>
<ApplicationIcon>logo.ico</ApplicationIcon> <ApplicationIcon>logo.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>