diff --git a/installer/Installer.iss b/installer/Installer.iss index 84c6c6a..b380889 100644 --- a/installer/Installer.iss +++ b/installer/Installer.iss @@ -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" diff --git a/src/InvLock/App.xaml b/src/InvLock/App.xaml index 22dc1ea..97fc7d1 100644 --- a/src/InvLock/App.xaml +++ b/src/InvLock/App.xaml @@ -9,6 +9,136 @@ + + + 40 + 20 + 1 + 0,0,8,0 + + + diff --git a/src/InvLock/DataContexts/MainWindowDataContext.cs b/src/InvLock/DataContexts/MainWindowDataContext.cs index 9910baa..cc61b66 100644 --- a/src/InvLock/DataContexts/MainWindowDataContext.cs +++ b/src/InvLock/DataContexts/MainWindowDataContext.cs @@ -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 lockWindowAccesso public string AppName => App.AppName; - public string AppVersion => Assembly.GetEntryAssembly()?.GetCustomAttribute()?.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(); diff --git a/src/InvLock/InvLock.csproj b/src/InvLock/InvLock.csproj index 9f68947..f920827 100644 --- a/src/InvLock/InvLock.csproj +++ b/src/InvLock/InvLock.csproj @@ -8,9 +8,9 @@ true true Assets\logo.ico - 1.1.0.0 - 1.1.0.0 - 1.1.0.0 + 1.1.0.20251229 + 1.1.0.1229 + 1.1.0.20251229 false diff --git a/src/InvLock/LockWindow.xaml.cs b/src/InvLock/LockWindow.xaml.cs index 1677755..133100c 100644 --- a/src/InvLock/LockWindow.xaml.cs +++ b/src/InvLock/LockWindow.xaml.cs @@ -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)); diff --git a/src/InvLock/MainWindow.xaml b/src/InvLock/MainWindow.xaml index b213e80..942d352 100644 --- a/src/InvLock/MainWindow.xaml +++ b/src/InvLock/MainWindow.xaml @@ -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 @@ - + - + - + - + diff --git a/src/InvLock/MainWindow.xaml.cs b/src/InvLock/MainWindow.xaml.cs index a3c4b76..944f798 100644 --- a/src/InvLock/MainWindow.xaml.cs +++ b/src/InvLock/MainWindow.xaml.cs @@ -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) diff --git a/src/InvLock/Settings.cs b/src/InvLock/Settings.cs index 4a057d6..073e939 100644 --- a/src/InvLock/Settings.cs +++ b/src/InvLock/Settings.cs @@ -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 lockShortcut = [KeyCode.VcLeftControl, KeyCode.VcLeftShift, KeyCode.VcL]; private HashSet 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..])); diff --git a/src/MsixPackaging/Package.appxmanifest b/src/MsixPackaging/Package.appxmanifest index ee6e000..948c399 100644 --- a/src/MsixPackaging/Package.appxmanifest +++ b/src/MsixPackaging/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="1.1.0.0" /> InvLock