public VSCommandRouting(IVisualGitServiceProvider context, VSContainerForm form) : base(context) { if (form == null) throw new ArgumentNullException("form"); _form = form; _vsForm = form; if (_routers.Count > 0) _routers.Peek().Enabled = false; Application.AddMessageFilter(this); _routers.Push(this); _installed = true; _vsWpf = !VSVersion.VS2008OrOlder; _map.Add(form, this); _rPct = GetService<IVsRegisterPriorityCommandTarget>(typeof(SVsRegisterPriorityCommandTarget)); if(_rPct != null) { Marshal.ThrowExceptionForHR(_rPct.RegisterPriorityCommandTarget(0, this, out _csCookie)); } ISelectionContextEx sel = GetService<ISelectionContextEx>(typeof(ISelectionContext)); if (sel != null) { _activeStack = sel.PushPopupContext(form); } }
public static VSCommandRouting FromForm(VSContainerForm form) { VSCommandRouting vr; if (_map.TryGetValue(form, out vr)) return vr; return null; }