|
|
|
@ -13,6 +13,7 @@ using Avalonia.Platform; |
|
|
|
using Avalonia.Rendering; |
|
|
|
using Avalonia.Styling; |
|
|
|
using Avalonia.Threading; |
|
|
|
#nullable enable |
|
|
|
|
|
|
|
namespace Avalonia |
|
|
|
{ |
|
|
|
@ -35,27 +36,27 @@ namespace Avalonia |
|
|
|
/// <summary>
|
|
|
|
/// The application-global data templates.
|
|
|
|
/// </summary>
|
|
|
|
private DataTemplates _dataTemplates; |
|
|
|
private DataTemplates? _dataTemplates; |
|
|
|
|
|
|
|
private readonly Lazy<IClipboard> _clipboard = |
|
|
|
new Lazy<IClipboard>(() => (IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard))); |
|
|
|
private readonly Styler _styler = new Styler(); |
|
|
|
private Styles _styles; |
|
|
|
private IResourceDictionary _resources; |
|
|
|
private Styles? _styles; |
|
|
|
private IResourceDictionary? _resources; |
|
|
|
private bool _notifyingResourcesChanged; |
|
|
|
private Action<IReadOnlyList<IStyle>> _stylesAdded; |
|
|
|
private Action<IReadOnlyList<IStyle>> _stylesRemoved; |
|
|
|
private Action<IReadOnlyList<IStyle>>? _stylesAdded; |
|
|
|
private Action<IReadOnlyList<IStyle>>? _stylesRemoved; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Defines the <see cref="DataContext"/> property.
|
|
|
|
/// </summary>
|
|
|
|
public static readonly StyledProperty<object> DataContextProperty = |
|
|
|
public static readonly StyledProperty<object?> DataContextProperty = |
|
|
|
StyledElement.DataContextProperty.AddOwner<Application>(); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public event EventHandler<ResourcesChangedEventArgs> ResourcesChanged; |
|
|
|
public event EventHandler<ResourcesChangedEventArgs>? ResourcesChanged; |
|
|
|
|
|
|
|
public event EventHandler<UrlOpenedEventArgs> UrlsOpened; |
|
|
|
public event EventHandler<UrlOpenedEventArgs>? UrlsOpened; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates an instance of the <see cref="Application"/> class.
|
|
|
|
@ -72,7 +73,7 @@ namespace Avalonia |
|
|
|
/// The data context property specifies the default object that will
|
|
|
|
/// be used for data binding.
|
|
|
|
/// </remarks>
|
|
|
|
public object DataContext |
|
|
|
public object? DataContext |
|
|
|
{ |
|
|
|
get { return GetValue(DataContextProperty); } |
|
|
|
set { SetValue(DataContextProperty, value); } |
|
|
|
@ -162,7 +163,7 @@ namespace Avalonia |
|
|
|
/// <summary>
|
|
|
|
/// Gets the styling parent of the application, which is null.
|
|
|
|
/// </summary>
|
|
|
|
IStyleHost IStyleHost.StylingParent => null; |
|
|
|
IStyleHost? IStyleHost.StylingParent => null; |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
bool IStyleHost.IsStylesInitialized => _styles != null; |
|
|
|
@ -194,7 +195,7 @@ namespace Avalonia |
|
|
|
public virtual void Initialize() { } |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
bool IResourceNode.TryGetResource(object key, out object value) |
|
|
|
bool IResourceNode.TryGetResource(object key, out object? value) |
|
|
|
{ |
|
|
|
value = null; |
|
|
|
return (_resources?.TryGetResource(key, out value) ?? false) || |
|
|
|
@ -279,17 +280,17 @@ namespace Avalonia |
|
|
|
NotifyResourcesChanged(e); |
|
|
|
} |
|
|
|
|
|
|
|
private string _name; |
|
|
|
private string? _name; |
|
|
|
/// <summary>
|
|
|
|
/// Defines Name property
|
|
|
|
/// </summary>
|
|
|
|
public static readonly DirectProperty<Application, string> NameProperty = |
|
|
|
AvaloniaProperty.RegisterDirect<Application, string>("Name", o => o.Name, (o, v) => o.Name = v); |
|
|
|
public static readonly DirectProperty<Application, string?> NameProperty = |
|
|
|
AvaloniaProperty.RegisterDirect<Application, string?>("Name", o => o.Name, (o, v) => o.Name = v); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Application name to be used for various platform-specific purposes
|
|
|
|
/// </summary>
|
|
|
|
public string Name |
|
|
|
public string? Name |
|
|
|
{ |
|
|
|
get => _name; |
|
|
|
set => SetAndRaise(NameProperty, ref _name, value); |
|
|
|
|