예제 #1
0
        public VSCommandRouting(IAnkhServiceProvider 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);
            }
        }
예제 #2
0
        public void OnContainerCreated(Ankh.UI.VSContainerForm form)
        {
            VSCommandRouting routing = VSCommandRouting.FromForm(form);

            if (routing != null)
            {
                routing.OnHandleCreated();
            }
        }
예제 #3
0
        public void OnContainerCreated(Ankh.UI.VSContainerForm form)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            VSCommandRouting routing = VSCommandRouting.FromForm(form);

            if (routing != null)
            {
                routing.OnHandleCreated();
            }
        }
예제 #4
0
        public void AddCommandTarget(Ankh.UI.VSContainerForm form, IOleCommandTarget commandTarget)
        {
            VSCommandRouting routing = VSCommandRouting.FromForm(form);

            if (routing != null)
            {
                routing.AddCommandTarget(commandTarget);
            }
            else
            {
                throw new InvalidOperationException("Command routing not initialized yet");
            }
        }
예제 #5
0
        public void AddWindowPane(Ankh.UI.VSContainerForm form, IVsWindowPane pane)
        {
            VSCommandRouting routing = VSCommandRouting.FromForm(form);

            if (routing != null)
            {
                routing.AddWindowPane(pane);
            }
            else
            {
                throw new InvalidOperationException("Command routing not initialized yet");
            }
        }
예제 #6
0
 public IDisposable InstallFormRouting(Ankh.UI.VSContainerForm container, EventArgs eventArgs)
 {
     return(new VSCommandRouting(Context, container));
 }
예제 #7
0
        public static VSCommandRouting FromForm(VSContainerForm form)
        {
            VSCommandRouting vr;

            if (_map.TryGetValue(form, out vr))
                return vr;

            return null;
        }