コード例 #1
0
ファイル: SettingsViewModel.cs プロジェクト: Xustis/Sidekick
        private bool NativeKeyboard_OnKeyDown(string input)
        {
            if (string.IsNullOrEmpty(CurrentKey))
            {
                return(false);
            }

            if (input == "Escape")
            {
                CurrentKey = null;
                return(true);
            }

            if (!IsKeybindUsed(input, CurrentKey))
            {
                var currentKeybind = Keybinds.ToCollection().FirstOrDefault(x => x.Key == CurrentKey);
                currentKeybind.Value = input;
            }

            CurrentKey = null;
            return(true);
        }
コード例 #2
0
ファイル: SettingsViewModel.cs プロジェクト: Xustis/Sidekick
 public void Clear(string key)
 {
     Keybinds.ToCollection().FirstOrDefault(x => x.Key == key).Value = string.Empty;
 }
コード例 #3
0
ファイル: SettingsViewModel.cs プロジェクト: Xustis/Sidekick
 public bool IsKeybindUsed(string keybind, string ignoreKey = null)
 {
     return(Keybinds.ToCollection().Any(x => x.Value == keybind && x.Key != ignoreKey));
 }