public IReadOnlyList <string> GetReadableKeyCombinationsFor(GlobalAction globalAction) { List <string> combinations = new List <string>(); realm.Run(context => { foreach (var action in context.All <RealmKeyBinding>().Where(b => string.IsNullOrEmpty(b.RulesetName) && (GlobalAction)b.ActionInt == globalAction)) { string str = keyCombinationProvider.GetReadableString(action.KeyCombination); // even if found, the readable string may be empty for an unbound action. if (str.Length > 0) { combinations.Add(str); } } }); return(combinations); }
public IReadOnlyList <string> GetReadableKeyCombinationsFor(GlobalAction globalAction) { List <string> combinations = new List <string>(); using (var context = realmFactory.CreateContext()) { foreach (var action in context.All <RealmKeyBinding>().Where(b => b.RulesetID == null && (GlobalAction)b.ActionInt == globalAction)) { string str = keyCombinationProvider.GetReadableString(action.KeyCombination); // even if found, the readable string may be empty for an unbound action. if (str.Length > 0) { combinations.Add(str); } } } return(combinations); }
public void TestKeyCombinationDisplayOrder(KeyCombination keyCombination, string expectedRepresentation) => Assert.That(readable_key_combination_provider.GetReadableString(keyCombination), Is.EqualTo(expectedRepresentation));