Add autostart and update translations
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:MaxSlurper"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
>
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Wpf.Ui.Appearance;
|
||||
|
||||
namespace MaxSlurper
|
||||
@@ -12,8 +11,23 @@ namespace MaxSlurper
|
||||
protected override void OnStartup(System.Windows.StartupEventArgs 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="Farbe aussuche"
|
||||
Height="500"
|
||||
Title="Farbe auswählen"
|
||||
Height="500"
|
||||
Width="400"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
@@ -26,8 +26,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
|
||||
<!-- Title bar -->
|
||||
<ui:TitleBar Grid.Row="0"
|
||||
Title="Farbe aussuche"
|
||||
ShowMaximize="False"
|
||||
Title="Farbe auswählen"
|
||||
ShowMaximize="False"
|
||||
ShowMinimize="False"
|
||||
Icon="/logo.png" />
|
||||
|
||||
@@ -176,14 +176,14 @@ Height="20"
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ui:Button Content="Lass ma"
|
||||
<ui:Button Content="Abbrechen"
|
||||
Height="44"
|
||||
Margin="0,0,8,0"
|
||||
Click="CancelButton_Click"
|
||||
Appearance="Secondary"/>
|
||||
|
||||
<ui:Button Grid.Column="1"
|
||||
Content="Kopieren & Tschüss"
|
||||
Content="Kopieren & Schließen"
|
||||
Height="44"
|
||||
Padding="24,0"
|
||||
Click="OkButton_Click"
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
TextWrapping="Wrap"
|
||||
FontSize="12"
|
||||
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>
|
||||
</Grid>
|
||||
|
||||
@@ -99,6 +99,37 @@ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
</StackPanel>
|
||||
</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 -->
|
||||
<ui:Card Padding="20">
|
||||
<StackPanel>
|
||||
@@ -121,7 +152,7 @@ FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"/>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Text="DER ColorPicker für Max"
|
||||
<TextBlock Text="Der Farbwähler für Max"
|
||||
TextWrapping="Wrap"
|
||||
FontSize="13"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
@@ -129,7 +160,7 @@ TextWrapping="Wrap"
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
FontSize="13"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}">
|
||||
<Run Text="Gemacht mit "/>
|
||||
<Run Text="Erstellt mit "/>
|
||||
<Run Text="♥" Foreground="Red" FontSize="14"/>
|
||||
<Run Text=" von Mathias"/>
|
||||
</TextBlock>
|
||||
@@ -151,13 +182,13 @@ BorderThickness="0,1,0,0"
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="Änderungen werden direkt jespeichert"
|
||||
<TextBlock Text="Änderungen werden automatisch gespeichert"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"/>
|
||||
|
||||
<ui:Button Grid.Column="1"
|
||||
Content="Zumachen"
|
||||
Content="Schließen"
|
||||
Height="36"
|
||||
Padding="24,0"
|
||||
Click="Close_Click"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -7,6 +7,7 @@ using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using MaxSlurper.Models;
|
||||
using MaxSlurper.Services;
|
||||
using Microsoft.Win32;
|
||||
using Wpf.Ui.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)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -54,7 +84,7 @@ public event PropertyChangedEventHandler? PropertyChanged;
|
||||
return;
|
||||
|
||||
_isCapturingHotkey = true;
|
||||
CurrentHotkey = "Drück deine Tasten...";
|
||||
CurrentHotkey = "Tastenkombination eingeben...";
|
||||
|
||||
var captureWindow = new HotkeyCapture();
|
||||
captureWindow.Owner = this;
|
||||
@@ -131,7 +161,7 @@ ExtendsContentIntoTitleBar = true;
|
||||
|
||||
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,
|
||||
TextAlignment = TextAlignment.Center,
|
||||
Foreground = (System.Windows.Media.Brush)FindResource("TextFillColorSecondaryBrush"),
|
||||
@@ -142,7 +172,7 @@ ExtendsContentIntoTitleBar = true;
|
||||
|
||||
var keyDisplay = new System.Windows.Controls.TextBlock
|
||||
{
|
||||
Text = "Warte uff Eingabe...",
|
||||
Text = "Warte auf Eingabe...",
|
||||
FontSize = 18,
|
||||
FontWeight = FontWeights.SemiBold,
|
||||
TextAlignment = TextAlignment.Center,
|
||||
@@ -204,7 +234,7 @@ key == Key.LWin || key == Key.RWin)
|
||||
// Require at least one modifier
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
Cursor="Hand"
|
||||
ToolTip="Drück ma druff, dann kannste dir 'ne Farbe raussuche">
|
||||
ToolTip="Klicken, um eine Farbe auszuwählen">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="8"
|
||||
ShadowDepth="2"
|
||||
@@ -72,7 +72,7 @@
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="16,0,16,0"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="Zuletzt jeklaut"
|
||||
<TextBlock Text="Zuletzt aufgenommen"
|
||||
Style="{StaticResource SubtleText}"
|
||||
Margin="0,0,0,4" />
|
||||
<TextBlock Text="{Binding SelectedHex}"
|
||||
@@ -87,7 +87,7 @@ Style="{StaticResource SubtleText}" />
|
||||
<!-- Actions -->
|
||||
<StackPanel Orientation="Vertical"
|
||||
DockPanel.Dock="Right">
|
||||
<ui:Button Content="Farbe schlürfen"
|
||||
<ui:Button Content="Farbe aufnehmen"
|
||||
Appearance="Primary"
|
||||
Icon="{ui:SymbolIcon Eyedropper24}"
|
||||
Command="{Binding PickColorCommand}"
|
||||
@@ -113,9 +113,9 @@ Padding="16,8"
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Margin="0,0,0,12">
|
||||
<TextBlock Text="Wat ick schon so jeklaut hab"
|
||||
<TextBlock Text="Farbverlauf"
|
||||
Style="{StaticResource HeaderText}" />
|
||||
<TextBlock Text="Druff klicken und ab dafuer, wa"
|
||||
<TextBlock Text="Klicken zum Kopieren"
|
||||
Style="{StaticResource SubtleText}"
|
||||
Margin="0,4,0,0" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -77,14 +77,14 @@ namespace MaxSlurper
|
||||
_notifyIcon.Text = "MaxSlurper";
|
||||
|
||||
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
|
||||
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(); })); };
|
||||
var settingsItem = new ToolStripMenuItem("Einstellungen");
|
||||
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(); };
|
||||
contextMenu.Items.Add(pickItem);
|
||||
contextMenu.Items.Add(openItem);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<Authors>Mathias Wagner</Authors>
|
||||
<Company>MaxSlurper</Company>
|
||||
<Product>MaxSlurper</Product>
|
||||
<Description>Weil Max danach gefragt hat</Description>
|
||||
<Description>Farbwähler-Anwendung</Description>
|
||||
<Copyright>Copyright © 2025</Copyright>
|
||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user