感谢@zhoumy,提的建议。使用指定命名规则确实是个好方案!以下直接给出修改后的代码。如需查看前篇点击跳转1、修改后的规则实体 public class KeyboardShortcutsRule { public KeyboardShortcutsRule() ...
感谢@zhoumy,提的建议。使用指定命名规则确实是个好方案!以下直接给出修改后的代码。如需查看前篇点击跳转
1、修改后的规则实体
public class KeyboardShortcutsRule { public KeyboardShortcutsRule() { IsShowInHelp = true; IsShowInMainWindow = false; } public get='_blank'>string Name { get; set; } public string Keys { get; set; } public bool IsShowInHelp { get; set; } public bool IsShowInMainWindow { get; set; } public List<Type> IgnoreWindow { get; set; } public List<Type> Effectivity { get; set; } private IKeyboardShortcutsCommand tmpCommand; public IKeyboardShortcutsCommand Command { get { if (tmpCommand == null) { string typeName = Name + "Command"; var assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); foreach (var item in assemblies) { var type = item.GetTypes().FirstOrDefault(o => o.ToString().EndsWith(typeName)); if (type != null && type.GetInterfaces().Contains(typeof(IKeyboardShortcutsCommand))) { tmpCommand = item.CreateInstance(type.ToString()) as IKeyboardShortcutsCommand; return tmpCommand; } } } return tmpCommand; } } }
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:WPF 快捷键统一管理 改进篇
关键词:wpf
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。