} //コマンドオプション関係 public MenuManager() { MC = new MenuCmds(); SetDefCtxmData(); SetDefGestureCmdList(); }
private void ResetInputBindgsTo(UIElement iTrg, List<ICommand> cmdList, MenuCmds.GestureTrg spc) { if (iTrg == null) return; cmdList.ForEach(icmd => { var delList = iTrg.InputBindings.OfType<InputBinding>().Where(bind => bind.Command == icmd).ToList(); delList.ForEach(item => iTrg.InputBindings.Remove(item)); MenuCmds.CmdData cmdData; if (mm.MC.WorkCmdOptions.TryGetValue(icmd, out cmdData)) { if ((cmdData.GesTrg & spc) == spc || cmdData.GesTrg == MenuCmds.GestureTrg.None) { iTrg.InputBindings.AddRange(GetInputBinding(icmd)); } } else { iTrg.InputBindings.AddRange(GetInputBinding(icmd)); } }); }
private Dictionary<CtxmCode, List<ICommand>> WorkGestureCmdList; //各ビューのショートカット管理用のコマンドリスト #endregion Fields #region Constructors public MenuManager() { MC = new MenuCmds(); SetDefCtxmData(); SetDefGestureCmdList(); }
private void ResetInputBindgsTo(UIElement iTrg, List<ICommand> cmdList, MenuCmds.GestureTrg spc) { if (iTrg == null) return; cmdList.ForEach(icmd => { var delList = iTrg.InputBindings.OfType<InputBinding>().Where(bind => bind.Command == icmd).ToList(); delList.ForEach(item => iTrg.InputBindings.Remove(item)); MenuCmds.CmdData cmdData; if (mm.MC.WorkCmdOptions.TryGetValue(icmd, out cmdData)) { if ((cmdData.GesTrg & spc) == spc || cmdData.GesTrg == MenuCmds.GestureTrg.None) { iTrg.InputBindings.AddRange(GetInputBinding(icmd)); } } else { iTrg.InputBindings.AddRange(GetInputBinding(icmd)); } }); //残っている無効なジェスチャを削除。誤って追加されたりしたものがあれば、それも削除される。 var delBinds = new List<InputBinding>(); foreach (var item in iTrg.InputBindings.OfType<InputBinding>()) { if (mm.IsGestureDisableOnView(item.Command, View) == true) { delBinds.Add(item); } } delBinds.ForEach(item => iTrg.InputBindings.Remove(item)); }