|
|
@@ -102,7 +102,7 @@ namespace Perspex.Controls
|
|
|
PlatformImpl.Input = HandleInput;
|
|
|
PlatformImpl.Resized = HandleResized;
|
|
|
|
|
|
- Size clientSize = ClientSize = PlatformImpl.ClientSize;
|
|
|
+ var clientSize = ClientSize = PlatformImpl.ClientSize;
|
|
|
|
|
|
if (LayoutManager != null)
|
|
|
{
|
|
|
@@ -111,16 +111,8 @@ namespace Perspex.Controls
|
|
|
LayoutManager.LayoutCompleted.Subscribe(_ => HandleLayoutCompleted());
|
|
|
}
|
|
|
|
|
|
- if (_keyboardNavigationHandler != null)
|
|
|
- {
|
|
|
- _keyboardNavigationHandler.SetOwner(this);
|
|
|
- }
|
|
|
-
|
|
|
- if (_accessKeyHandler != null)
|
|
|
- {
|
|
|
- _accessKeyHandler.SetOwner(this);
|
|
|
- }
|
|
|
-
|
|
|
+ _keyboardNavigationHandler?.SetOwner(this);
|
|
|
+ _accessKeyHandler?.SetOwner(this);
|
|
|
styler?.ApplyStyles(this);
|
|
|
|
|
|
GetObservable(ClientSizeProperty).Skip(1).Subscribe(x => PlatformImpl.ClientSize = x);
|
|
|
@@ -306,12 +298,9 @@ namespace Perspex.Controls
|
|
|
{
|
|
|
var result = resolver.GetService<T>();
|
|
|
|
|
|
- if (result == null)
|
|
|
- {
|
|
|
- System.Diagnostics.Debug.WriteLineIf(
|
|
|
- result == null,
|
|
|
- $"Could not create {typeof(T).Name} : maybe Application.RegisterServices() wasn't called?");
|
|
|
- }
|
|
|
+ System.Diagnostics.Debug.WriteLineIf(
|
|
|
+ result == null,
|
|
|
+ $"Could not create {typeof(T).Name} : maybe Application.RegisterServices() wasn't called?");
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
@@ -321,10 +310,7 @@ namespace Perspex.Controls
|
|
|
/// </summary>
|
|
|
private void HandleActivated()
|
|
|
{
|
|
|
- if (Activated != null)
|
|
|
- {
|
|
|
- Activated(this, EventArgs.Empty);
|
|
|
- }
|
|
|
+ Activated?.Invoke(this, EventArgs.Empty);
|
|
|
|
|
|
var scope = this as IFocusScope;
|
|
|
|
|
|
@@ -341,10 +327,7 @@ namespace Perspex.Controls
|
|
|
/// </summary>
|
|
|
private void HandleClosed()
|
|
|
{
|
|
|
- if (Closed != null)
|
|
|
- {
|
|
|
- Closed(this, EventArgs.Empty);
|
|
|
- }
|
|
|
+ Closed?.Invoke(this, EventArgs.Empty);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -354,10 +337,7 @@ namespace Perspex.Controls
|
|
|
{
|
|
|
IsActive = false;
|
|
|
|
|
|
- if (Deactivated != null)
|
|
|
- {
|
|
|
- Deactivated(this, EventArgs.Empty);
|
|
|
- }
|
|
|
+ Deactivated?.Invoke(this, EventArgs.Empty);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|