mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-12 20:55:38 +08:00
fix: 插件管理无法弹出对话框
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="国铁信息显示模拟">
|
||||
Title="国铁信息显示模拟"
|
||||
Activated="Window_Activated">
|
||||
|
||||
<Window.SystemBackdrop>
|
||||
<MicaBackdrop />
|
||||
|
||||
@@ -43,5 +43,11 @@ public sealed partial class MainWindow : Window
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Activated(object sender, WindowActivatedEventArgs args)
|
||||
{
|
||||
var dialogService = App.AppHost.Services.GetService<IDialogService>()!;
|
||||
(dialogService as DialogService)?.SetXamlRoot(this.Content.XamlRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,10 +55,6 @@ public partial class PluginManagementPageViewModel : ObservableObject
|
||||
await _dialogService.ShowTextAsync("安装失败", $"{ex}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await _dialogService.ShowMessageAsync("未选择文件", "请先选择一个插件包文件。");
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
public void UninstallPlugin()
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
xmlns:winui="using:CommunityToolkit.WinUI"
|
||||
xmlns:viewmodels="using:CRSim.ViewModels"
|
||||
xmlns:models="using:CRSim.Models"
|
||||
xmlns:coremodels="using:CRSim.Core.Models"
|
||||
Loaded="Page_Loaded"
|
||||
xmlns:coremodels="using:CRSim.Core.Models"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodels:StationManagementPageViewModel}">
|
||||
<Page.Resources>
|
||||
|
||||
@@ -9,9 +9,4 @@ public sealed partial class StationManagementPage : Page
|
||||
InitializeComponent();
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dialogService = App.AppHost.Services.GetService<IDialogService>()!;
|
||||
(dialogService as DialogService)?.SetXamlRoot(XamlRoot);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user