Author SHA1 Message Date
Stone_Red cf4e2adced Merge branch 'develop'
# Conflicts:
#	installer/InvLock-Installer.exe
#	src/InvLock/DataContexts/MainWindowDataContext.cs
#	src/InvLock/InvLock.csproj
2025-12-29 14:17:34 +01:00
Stone_Red 81c8d9e315 Update version 2025-12-29 14:03:07 +01:00
Stone_Red d5e00c29ef Fix startup behavior and properly focus blur windows 2025-12-29 14:02:59 +01:00
Stone_Red 1d02db6bba Fixed Installer.iss 2025-12-29 14:02:24 +01:00
Stone_Red ceb55ad49f Fix ToggleSwitch style 2025-12-29 01:20:55 +01:00
Stone_Red 5e8d5afe1b Fix window not minimizing on startup 2025-12-29 01:20:37 +01:00
Stone_Red 99715ded8b Make sure blur windows are on top 2025-03-11 15:35:51 +01:00
Stone_Red 0f62873c3d Update version 2025-03-11 15:35:30 +01:00
9 changed files with 179 additions and 17 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#expr Exec('cmd.exe /C', 'dotnet build -o "' + SourcePath + '\publish" -c Release ' + SourcePath + '..\src\InvLock\')
#expr Exec('cmd.exe', '/C dotnet build -o "' + SourcePath + '\publish" -c Release ' + SourcePath + '..\src\InvLock\')
#define MyAppName "InvLock"
#define MyAppVersion GetVersionNumbersString("/publish/InvLock.exe")
#define MyAppVersion GetStringFileInfo("/publish/InvLock.exe","ProductVersion")
#define MyAppPublisher "Stone_Red"
#define MyAppExeName "InvLock.exe"
+130
View File
@@ -9,6 +9,136 @@
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=System.Runtime">
<system:Double x:Key="ToggleButtonWidth">40</system:Double>
<system:Double x:Key="ToggleButtonHeight">20</system:Double>
<Thickness x:Key="ToggleSwitchBorderThemeThickness">1</Thickness>
<Thickness x:Key="ToggleSwitchContentLeftMargin">0,0,8,0</Thickness>
<Style x:Key="ToggleSwitchContentLeftStyle" TargetType="{x:Type ui:ToggleSwitch}">
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOn}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleSwitchContentForeground}" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="{StaticResource ToggleSwitchBorderThemeThickness}" />
<Setter Property="Padding" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ui:ToggleSwitch}">
<Grid Margin="{TemplateBinding Padding}" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter
x:Name="ContentPresenter"
Grid.Column="0"
Margin="{StaticResource ToggleSwitchContentLeftMargin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
RecognizesAccessKey="True"
TextElement.Foreground="{TemplateBinding Foreground}" />
<Grid
Grid.Column="1"
Width="{StaticResource ToggleButtonWidth}"
Height="{StaticResource ToggleButtonHeight}">
<Rectangle
x:Name="ToggleRectangle"
Width="{StaticResource ToggleButtonWidth}"
Height="{StaticResource ToggleButtonHeight}"
Fill="{DynamicResource ToggleSwitchFillOff}"
RadiusX="10" RadiusY="10"
Stroke="{DynamicResource ToggleSwitchStrokeOff}"
StrokeThickness="1" />
<Rectangle
x:Name="ActiveToggleRectangle"
Width="{StaticResource ToggleButtonWidth}"
Height="{StaticResource ToggleButtonHeight}"
Fill="{TemplateBinding Background}"
Opacity="0.0"
RadiusX="10" RadiusY="10" />
<Rectangle
x:Name="ToggleEllipse"
Width="12" Height="12"
Fill="{DynamicResource ToggleSwitchKnobFillOff}"
RadiusX="7" RadiusY="7">
<Rectangle.RenderTransform>
<TranslateTransform X="-9" />
</Rectangle.RenderTransform>
</Rectangle>
<Rectangle
x:Name="ActiveToggleEllipse"
Width="12" Height="12"
Fill="{DynamicResource ToggleSwitchKnobFillOn}"
Opacity="0.0"
RadiusX="7" RadiusY="7">
<Rectangle.RenderTransform>
<TranslateTransform X="-9" />
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Trigger.EnterActions>
<BeginStoryboard Name="SlideRight">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ToggleRectangle" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0:0:0.16" />
<DoubleAnimation Storyboard.TargetName="ActiveToggleRectangle" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.16" />
<DoubleAnimation Storyboard.TargetName="ToggleEllipse" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0:0:0.16" />
<DoubleAnimation Storyboard.TargetName="ActiveToggleEllipse" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.16" />
<DoubleAnimation Storyboard.TargetName="ActiveToggleEllipse" Storyboard.TargetProperty="(Rectangle.RenderTransform).(TranslateTransform.X)" To="9" Duration="0:0:0.167" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ToggleRectangle" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.16" />
<DoubleAnimation Storyboard.TargetName="ActiveToggleRectangle" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0:0:0.16" />
<DoubleAnimation Storyboard.TargetName="ToggleEllipse" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.16" />
<DoubleAnimation Storyboard.TargetName="ActiveToggleEllipse" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0:0:0.16" />
<DoubleAnimation Storyboard.TargetName="ActiveToggleEllipse" Storyboard.TargetProperty="(Rectangle.RenderTransform).(TranslateTransform.X)" To="-9" Duration="0:0:0.167" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Content" Value="{x:Null}" />
<Condition Property="IsChecked" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="ContentPresenter" Property="Content" Value="{Binding OnContent, RelativeSource={RelativeSource TemplatedParent}}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Content" Value="{x:Null}" />
<Condition Property="IsChecked" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="ContentPresenter" Property="Content" Value="{Binding OffContent, RelativeSource={RelativeSource TemplatedParent}}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
@@ -5,6 +5,7 @@ using InvLock.Utilities;
using SharpHook.Native;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
@@ -22,7 +23,15 @@ internal partial class MainWindowDataContext(Func<LockWindow?> lockWindowAccesso
public string AppName => App.AppName;
public string AppVersion => Assembly.GetEntryAssembly()?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
public string AppVersion
{
get
{
Assembly assembly = Assembly.GetExecutingAssembly();
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
return fileVersionInfo.ProductVersion ?? "Unknown";
}
}
public Settings Settings { get; } = Settings.Load();
+3 -3
View File
@@ -8,9 +8,9 @@
<UseWPF>true</UseWPF>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationIcon>Assets\logo.ico</ApplicationIcon>
<Version>1.1.0.0</Version>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<Version>1.1.0.20251229</Version>
<AssemblyVersion>1.1.0.1229</AssemblyVersion>
<FileVersion>1.1.0.20251229</FileVersion>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
+4 -1
View File
@@ -122,7 +122,7 @@ public partial class LockWindow : Window
MinimizeWindows();
}
Dispatcher.Invoke(() =>
_ = Dispatcher.Invoke(async () =>
{
lastMousePosition = WpfScreenHelper.MouseHelper.MousePosition;
@@ -136,10 +136,13 @@ public partial class LockWindow : Window
Height = bounds.Height,
Left = bounds.Left,
Top = bounds.Top,
Topmost = true
};
blurWindows.Add(blurWindow);
blurWindow.Show();
blurWindow.Topmost = false;
}
_ = WindowsApi.SetCursorPosition(new Point(100000, 100000));
+4 -5
View File
@@ -18,7 +18,6 @@
WindowBackdropType="Mica"
WindowCornerPreference="Round"
WindowStartupLocation="CenterScreen"
WindowState="Minimized"
Loaded="Window_Loaded"
Closing="FluentWindow_Closing"
Closed="FluentWindow_Closed"
@@ -90,28 +89,28 @@
<ui:TextBlock Grid.Row="1" Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}" FontSize="12" Text="Start InvLock when you sign in to Windows" />
</Grid>
</ui:CardControl.Header>
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding IsAutoStartEnabled}" OffContent="Off" OnContent="On" />
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding IsAutoStartEnabled}" Style="{StaticResource ToggleSwitchContentLeftStyle}" OffContent="Off" OnContent="On" />
</ui:CardControl>
<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon Symbol=Window24}" Height="75">
<ui:CardControl.Header>
<ui:TextBlock Grid.Row="0" FontTypography="Body" Text="Show desktop while locked" />
</ui:CardControl.Header>
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding Settings.HideWindows}" OffContent="Off" OnContent="On" />
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding Settings.HideWindows}" Style="{StaticResource ToggleSwitchContentLeftStyle}" OffContent="Off" OnContent="On" />
</ui:CardControl>
<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon Symbol=Blur24}" Height="75">
<ui:CardControl.Header>
<ui:TextBlock Grid.Row="0" FontTypography="Body" Text="Blur screen while locked" />
</ui:CardControl.Header>
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding Settings.BlurScreen}" OffContent="Off" OnContent="On" />
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding Settings.BlurScreen}" Style="{StaticResource ToggleSwitchContentLeftStyle}" OffContent="Off" OnContent="On" />
</ui:CardControl>
<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon Symbol=WindowShield24}" Height="75">
<ui:CardControl.Header>
<ui:TextBlock Grid.Row="0" FontTypography="Body" Text="Use windows lock screen to unlock" />
</ui:CardControl.Header>
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding Settings.UseWindowsLockScreen}" OffContent="Off" OnContent="On" />
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding Settings.UseWindowsLockScreen}" Style="{StaticResource ToggleSwitchContentLeftStyle}" OffContent="Off" OnContent="On" />
</ui:CardControl>
<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon Symbol=LockClosed24}" Height="75">
+14 -4
View File
@@ -18,12 +18,12 @@ public partial class MainWindow : FluentWindow
public MainWindow()
{
SystemThemeWatcher.Watch(this);
mainWindowDataContext = new MainWindowDataContext(() => lockWindow);
DataContext = mainWindowDataContext;
InitializeComponent();
SystemThemeWatcher.Watch(this);
}
internal void RestoreWindow()
@@ -51,10 +51,20 @@ public partial class MainWindow : FluentWindow
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Close();
lockWindow = new LockWindow(mainWindowDataContext.Settings);
lockWindow.Show();
if (mainWindowDataContext.Settings.FirstRun)
{
mainWindowDataContext.Settings.FirstRun = false;
RestoreWindow();
}
else
{
ShowInTaskbar = false;
WindowState = WindowState.Minimized;
Visibility = Visibility.Collapsed;
}
}
private void NotifyIcon_LeftClick(Wpf.Ui.Tray.Controls.NotifyIcon sender, RoutedEventArgs e)
+11
View File
@@ -20,6 +20,7 @@ public class Settings : INotifyPropertyChanged
private bool blurScreen = false;
private string lockText = "Lock Screen Active";
private string theme = "Windows default";
private bool firstRun = true;
private HashSet<KeyCode> lockShortcut = [KeyCode.VcLeftControl, KeyCode.VcLeftShift, KeyCode.VcL];
private HashSet<KeyCode> unlockShortcut = [KeyCode.VcLeftControl, KeyCode.VcLeftShift, KeyCode.VcL];
@@ -76,6 +77,16 @@ public class Settings : INotifyPropertyChanged
}
}
public bool FirstRun
{
get => firstRun;
set
{
firstRun = value;
OnPropertyChanged();
}
}
[JsonIgnore]
public string LockShortcutText => string.Join(" + ", LockShortcut.Select(key => key.ToString()[2..]));
+1 -1
View File
@@ -9,7 +9,7 @@
<Identity
Name="StoneRed.9985F47BE4F2"
Publisher="CN=6D1FD759-1951-428A-9B03-964461C7DBF5"
Version="1.0.0.0" />
Version="1.1.0.0" />
<Properties>
<DisplayName>InvLock</DisplayName>