This commit is contained in:
DismissedLight
2023-10-19 20:46:29 +08:00
parent 91b2db886f
commit 026c68229a
14 changed files with 7 additions and 15 deletions

View File

@@ -68,12 +68,16 @@ internal sealed partial class ContentDialogFactory : IContentDialogFactory
where TContentDialog : ContentDialog
{
await taskContext.SwitchToMainThreadAsync();
return serviceProvider.CreateInstance<TContentDialog>(parameters);
TContentDialog contentDialog = serviceProvider.CreateInstance<TContentDialog>(parameters);
contentDialog.XamlRoot = currentWindowReference.Window.Content.XamlRoot;
return contentDialog;
}
public TContentDialog CreateInstance<TContentDialog>(params object[] parameters)
where TContentDialog : ContentDialog
{
return serviceProvider.CreateInstance<TContentDialog>(parameters);
TContentDialog contentDialog = serviceProvider.CreateInstance<TContentDialog>(parameters);
contentDialog.XamlRoot = currentWindowReference.Window.Content.XamlRoot;
return contentDialog;
}
}

View File

@@ -21,7 +21,6 @@ internal sealed partial class AchievementArchiveCreateDialog : ContentDialog
public AchievementArchiveCreateDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
}

View File

@@ -25,7 +25,6 @@ internal sealed partial class AchievementImportDialog : ContentDialog
public AchievementImportDialog(IServiceProvider serviceProvider, UIAF uiaf)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
UIAF = uiaf;

View File

@@ -24,7 +24,6 @@ internal sealed partial class CultivateProjectDialog : ContentDialog
public CultivateProjectDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
}

View File

@@ -14,7 +14,6 @@ internal sealed partial class CultivatePromotionDeltaBatchDialog : ContentDialog
public CultivatePromotionDeltaBatchDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();

View File

@@ -27,7 +27,6 @@ internal sealed partial class CultivatePromotionDeltaDialog : ContentDialog
public CultivatePromotionDeltaDialog(IServiceProvider serviceProvider, CalculableOptions options)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();

View File

@@ -20,7 +20,6 @@ internal sealed partial class DailyNoteNotificationDialog : ContentDialog
public DailyNoteNotificationDialog(IServiceProvider serviceProvider, DailyNoteEntry entry)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
DataContext = entry;
}

View File

@@ -24,7 +24,6 @@ internal sealed partial class GachaLogImportDialog : ContentDialog
public GachaLogImportDialog(IServiceProvider serviceProvider, UIGF uigf)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
UIGF = uigf;

View File

@@ -21,7 +21,6 @@ internal sealed partial class GachaLogRefreshProgressDialog : ContentDialog
public GachaLogRefreshProgressDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
}
/// <summary>

View File

@@ -20,7 +20,6 @@ internal sealed partial class GachaLogUrlDialog : ContentDialog
public GachaLogUrlDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
}

View File

@@ -14,7 +14,7 @@ internal sealed partial class GeetestCustomUrlDialog : ContentDialog
public GeetestCustomUrlDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
Text = serviceProvider.GetRequiredService<AppOptions>().GeetestCustomCompositeUrl;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
}

View File

@@ -21,7 +21,6 @@ internal sealed partial class LaunchGameAccountNameDialog : ContentDialog
public LaunchGameAccountNameDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
}

View File

@@ -21,7 +21,6 @@ internal sealed partial class LaunchGamePackageConvertDialog : ContentDialog
public LaunchGamePackageConvertDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
DataContext = this;
}

View File

@@ -22,7 +22,6 @@ internal sealed partial class UserDialog : ContentDialog
public UserDialog(IServiceProvider serviceProvider)
{
InitializeComponent();
XamlRoot = serviceProvider.GetRequiredService<MainWindow>().Content.XamlRoot;
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
}