27 lines
655 B
C#
27 lines
655 B
C#
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StgSharp
|
|
{
|
|
|
|
public static partial class StgSharp
|
|
{
|
|
private static ConcurrentDictionary<int, bool> keyListener = new ConcurrentDictionary<int, bool>();
|
|
|
|
public static KeyStatus CheckKey(KeyboardKey key)
|
|
{
|
|
int keyId = (int)key;
|
|
if (keyListener.ContainsKey((int)keyId))
|
|
{
|
|
return keyListener[(int)keyId]?KeyStatus.PRESS:KeyStatus.RELEASE;
|
|
}
|
|
keyListener.AddOrUpdate
|
|
}
|
|
|
|
}
|
|
}
|