diff --git a/WallpapersSlideshower/Commands/ChangeWindowVisibilityCommand.cs b/WallpapersSlideshower/Commands/ChangeWindowVisibilityCommand.cs index 60655e3..31fb10c 100644 --- a/WallpapersSlideshower/Commands/ChangeWindowVisibilityCommand.cs +++ b/WallpapersSlideshower/Commands/ChangeWindowVisibilityCommand.cs @@ -22,6 +22,11 @@ public override void Execute(object? parameter) if (parameter == null) throw new ArgumentNullException(nameof(parameter), "Argument can't be null."); var enableVisibility = (bool)parameter; _mainWindowViewModel.WindowVisibility = enableVisibility; + if (enableVisibility) + { + _mainWindowViewModel.Topmost = true; + _mainWindowViewModel.Topmost = false; + } } } } diff --git a/WallpapersSlideshower/ViewModels/MainWindowViewModel.cs b/WallpapersSlideshower/ViewModels/MainWindowViewModel.cs index 737637f..6146438 100644 --- a/WallpapersSlideshower/ViewModels/MainWindowViewModel.cs +++ b/WallpapersSlideshower/ViewModels/MainWindowViewModel.cs @@ -39,6 +39,9 @@ public class MainWindowViewModel : ViewModelBase public bool AutorunIsEnabled { get => _autorunIsEnabled; set => Set(ref _autorunIsEnabled, value); } private bool _autorunIsEnabled; + public bool Topmost { get => _topmost; set => Set(ref _topmost, value); } + private bool _topmost; + public WindowState WindowStateBeforeHide { get; set; } public ICommand SelectFolderCommand { get; } diff --git a/WallpapersSlideshower/Views/MainWindow.xaml b/WallpapersSlideshower/Views/MainWindow.xaml index 920f6e5..d547d0d 100644 --- a/WallpapersSlideshower/Views/MainWindow.xaml +++ b/WallpapersSlideshower/Views/MainWindow.xaml @@ -14,7 +14,7 @@ Title="Wallpapers Slideshower" Height="500" Width="1048" Icon="/Resources/Icons/wallpaper-svgrepo-com.ico" WindowState="{Binding WindowState, Mode=TwoWay}" - Topmost="True"> + Topmost="{Binding Topmost}"> diff --git a/WallpapersSlideshower/WallpapersSlideshower.csproj b/WallpapersSlideshower/WallpapersSlideshower.csproj index bd4386e..e9e783c 100644 --- a/WallpapersSlideshower/WallpapersSlideshower.csproj +++ b/WallpapersSlideshower/WallpapersSlideshower.csproj @@ -5,7 +5,7 @@ net6.0-windows enable true - 1.4.2 + 1.4.3