更新整理
This commit is contained in:
@@ -6,20 +6,20 @@ using WPFluent.Markup;
|
||||
namespace WPFluent;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a UI application.
|
||||
/// 表示 UI 应用程序。
|
||||
/// </summary>
|
||||
public class UiApplication
|
||||
{
|
||||
private static UiApplication? _uiApplication;
|
||||
|
||||
private readonly Application? _application;
|
||||
private readonly Application? application;
|
||||
|
||||
private Window? _mainWindow;
|
||||
|
||||
private ResourceDictionary? _resources;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UiApplication"/> class.
|
||||
/// 初始化 <see cref="UiApplication"/> 实例.
|
||||
/// </summary>
|
||||
public UiApplication(Application application)
|
||||
{
|
||||
@@ -33,10 +33,10 @@ public class UiApplication
|
||||
return;
|
||||
}
|
||||
|
||||
_application = application;
|
||||
this.application = application;
|
||||
|
||||
System.Diagnostics.Debug
|
||||
.WriteLine($"INFO | {typeof(UiApplication)} application is {_application}", "WPFluent");
|
||||
.WriteLine($"INFO | {typeof(UiApplication)} application is {this.application}", "WPFluent");
|
||||
}
|
||||
|
||||
private static bool ApplicationHasResources(Application application)
|
||||
@@ -51,9 +51,9 @@ public class UiApplication
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turns the application's into shutdown mode.
|
||||
/// 将应用程序的 变为 shutdown 模式。
|
||||
/// </summary>
|
||||
public void Shutdown() { _application?.Shutdown(); }
|
||||
public void Shutdown() { application?.Shutdown(); }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the application's main window.
|
||||
@@ -61,7 +61,7 @@ public class UiApplication
|
||||
public object TryFindResource(object resourceKey) { return Resources[resourceKey]; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current application.
|
||||
/// 获取当前应用程序。
|
||||
/// </summary>
|
||||
public static UiApplication Current
|
||||
{
|
||||
@@ -76,19 +76,19 @@ public class UiApplication
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the application is running outside of the desktop app context.
|
||||
/// </summary>
|
||||
public bool IsApplication => _application is not null;
|
||||
public bool IsApplication => application is not null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the application's main window.
|
||||
/// </summary>
|
||||
public Window? MainWindow
|
||||
{
|
||||
get => _application?.MainWindow ?? _mainWindow;
|
||||
get => application?.MainWindow ?? _mainWindow;
|
||||
set
|
||||
{
|
||||
if (_application != null)
|
||||
if (application != null)
|
||||
{
|
||||
_application.MainWindow = value;
|
||||
application.MainWindow = value;
|
||||
}
|
||||
|
||||
_mainWindow = value;
|
||||
@@ -108,7 +108,6 @@ public class UiApplication
|
||||
|
||||
try
|
||||
{
|
||||
ApplicationAccentColorManager.ApplySystemAccent();
|
||||
var themesDictionary = new ThemesDictionary();
|
||||
var controlsDictionary = new ControlsDictionary();
|
||||
_resources.MergedDictionaries.Add(themesDictionary);
|
||||
@@ -119,13 +118,13 @@ public class UiApplication
|
||||
}
|
||||
}
|
||||
|
||||
return _application?.Resources ?? _resources;
|
||||
return application?.Resources ?? _resources;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_application is not null)
|
||||
if (application is not null)
|
||||
{
|
||||
_application.Resources = value;
|
||||
application.Resources = value;
|
||||
}
|
||||
|
||||
_resources = value;
|
||||
|
||||
Reference in New Issue
Block a user