Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

Commit 8a85044

Browse files
committed
修复设置背景图解析bug;更新预览图
1 parent d5680fa commit 8a85044

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

ExplorerEx/Settings.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,9 @@ public bool IsDarkMode {
289289

290290
public double BackgroundImageOpacity => this[CommonSettings.BackgroundImageOpacity].GetDouble();
291291

292-
private void BackgroundImage_OnChanged(object? o) {
293-
if (o is string path && File.Exists(path)) {
292+
private void BackgroundImage_OnChanged(SettingsItem si) {
293+
var path = si.GetString().Trim(' ').Trim('"').Trim(' ');
294+
if (File.Exists(path)) {
294295
try {
295296
BackgroundImage = new BitmapImage(new Uri(path));
296297
} catch {
@@ -426,7 +427,7 @@ private void RegisterEvents() {
426427
settings[CommonSettings.WindowBackdrop].Changed += _ => ThemeChanged?.Invoke();
427428

428429
settings[CommonSettings.BackgroundImage].Changed += BackgroundImage_OnChanged;
429-
BackgroundImage_OnChanged(settings[CommonSettings.BackgroundImage].Value);
430+
BackgroundImage_OnChanged(settings[CommonSettings.BackgroundImage]);
430431

431432
settings[CommonSettings.BackgroundImageOpacity].Changed += _ => OnPropertyChanged(nameof(BackgroundImageOpacity));
432433
settings[CommonSettings.ColorMode].Changed += _ => ThemeChanged?.Invoke(); // 更改颜色

ExplorerEx/View/MainWindow.xaml.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,14 @@ protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) {
817817
}
818818
}
819819

820+
/// <summary>
821+
/// 是否打开了任何对话框?或者正在添加书签?
822+
/// </summary>
823+
private bool IsAnyDialogShown => RootPanel.Children.Count > 2 || IsAddToBookmarkShow;
824+
820825
protected override void OnKeyDown(KeyEventArgs e) {
821826
var handled = true;
822-
if (RootPanel.Children.Count == 2) { // 没有打开任何对话框
827+
if (!IsAnyDialogShown) {
823828
var mouseOverTab = FileTabControl.MouseOverTabControl?.SelectedTab;
824829
if (mouseOverTab != null) {
825830
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) {
@@ -889,8 +894,7 @@ protected override void OnKeyDown(KeyEventArgs e) {
889894
}
890895

891896
protected override void OnPreviewTextInput(TextCompositionEventArgs e) {
892-
if ((RootPanel.Children.Count == 2 || !IsAddToBookmarkShow) &&
893-
!string.IsNullOrWhiteSpace(e.Text) && e.OriginalSource is not TextBox and not AddressBar) { // 没有打开任何对话框
897+
if (!IsAnyDialogShown && !string.IsNullOrWhiteSpace(e.Text) && e.OriginalSource is not TextBox and not AddressBar) {
894898
var mouseOverTabControl = FileTabControl.MouseOverTabControl;
895899
if (mouseOverTabControl != null) {
896900
var fileListView = mouseOverTabControl.SelectedTab.FileListView;

Images/preview.png

141 KB
Loading

0 commit comments

Comments
 (0)