public static void Initialize(Sidebar window, Hotkey[] settings) { if (settings == null) { return; } Disable(); _window = window; _index = 0; RegisteredKeys = settings.Select(h => { h.Index = _index; _index++; return h; }).ToArray(); (PresentationSource.FromVisual(window) as HwndSource).AddHook(KeyHook); }
public static void Initialize(Sidebar window, Hotkey[] settings) { if (settings == null || settings.Length == 0) { Dispose(); return; } Disable(); _sidebar = window; _index = 0; RegisteredKeys = settings.Select(h => { h.Index = _index; _index++; return h; }).ToArray(); window.HwndSource.AddHook(KeyHook); IsHooked = true; }