Skip to content

Commit

Permalink
Improvement: now main window is not topmost
Browse files Browse the repository at this point in the history
  • Loading branch information
fomgleb committed Aug 7, 2022
1 parent 0c9fe38 commit be91151
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
3 changes: 3 additions & 0 deletions WallpapersSlideshower/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion WallpapersSlideshower/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
2 changes: 1 addition & 1 deletion WallpapersSlideshower/WallpapersSlideshower.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<Version>1.4.2</Version>
<Version>1.4.3</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit be91151

Please sign in to comment.