1
This commit is contained in:
@@ -32,6 +32,11 @@ namespace BITKit
|
||||
|
||||
public void Release(T newValue)
|
||||
{
|
||||
if (newValue is null)
|
||||
{
|
||||
BIT4Log.Warning<DoubleBuffer<T>>("newValue is null,please check");
|
||||
}
|
||||
|
||||
Current = newValue;
|
||||
OnRelease?.Invoke(newValue);
|
||||
_release.SetValueThenAllow(newValue);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BITKit.UX.Hotkey
|
||||
{
|
||||
@@ -37,6 +38,14 @@ namespace BITKit.UX.Hotkey
|
||||
|
||||
public class HotkeyCollection:IHotkeyCollection
|
||||
{
|
||||
public HotkeyCollection()
|
||||
{
|
||||
|
||||
}
|
||||
public HotkeyCollection(params IHotkeyProvider[] hotkeyProviders)
|
||||
{
|
||||
_hotkeys = hotkeyProviders.ToHashSet();
|
||||
}
|
||||
private readonly HashSet<IHotkeyProvider> _hotkeys = new();
|
||||
public IEnumerable<IHotkeyProvider> Hotkeys => _hotkeys;
|
||||
public void Register(IHotkeyProvider hotkey)
|
||||
|
@@ -139,6 +139,17 @@ namespace BITKit
|
||||
/// </summary>
|
||||
// ReSharper disable once EventNeverInvoked.Global
|
||||
event Action<IRuntimeItem> OnRuntimePropertiesChanged;
|
||||
|
||||
public bool TryGetRuntimeProperty<T>(out T value)
|
||||
{
|
||||
if (RuntimeProperties.TryGetValue(typeof(T), out var o) && o is T t)
|
||||
{
|
||||
value = t;
|
||||
return true;
|
||||
}
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Reference in New Issue
Block a user