Example #1
0
        /// <summary>
        /// Notifies all of our event listeners that an item in the hierarchy has changed.
        /// </summary>
        /// <param name="node">The <see cref="Node"/> that has changed.</param>
        /// <param name="propertyId">The property that has changed.</param>
        public void OnPropertyChanged(Node node, __VSHPROPID propertyId)
        {
            Tracer.VerifyNonNullArgument(node, "node");

            object newValue;

            node.GetProperty(propertyId, out newValue);

            // There are some cases where the collection is changed while we're iterating it.
            // To be safe, we'll create a copy of the collection and iterate over that.
            // We just want a shallow copy, though, and not a deep (Clone) copy.
            ArrayList clone = new ArrayList(this.Values);

            for (int i = 0; i < clone.Count; i++)
            {
                IVsHierarchyEvents eventItem = (IVsHierarchyEvents)clone[i];
                Tracer.WriteLineVerbose(classType, "OnPropertyChanged", "Notifying event listener {0} that '{1}' has changed its {2} property to '{3}'.", this.CookieOf(i), node.Caption, propertyId, newValue);
                try
                {
                    eventItem.OnPropertyChanged(node.HierarchyId, (int)propertyId, 0);
                }
                catch (Exception e)
                {
                    Tracer.WriteLineWarning(classType, "OnPropertyChanged", "There was an exception in the event listener {0} event handling code: {1}", this.CookieOf(i), e.ToString());
                }
            }
        }
        int IVsSolutionEvents.OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
        {
            _vsHierarchyEvents = new VsHierarchyEvents(pHierarchy, _xrmToolingConnection);
            pHierarchy.AdviseHierarchyEvents(_vsHierarchyEvents, out _cookie);

            return(VSConstants.S_OK);
        }
        int IVsSolutionEvents.OnBeforeCloseProject(IVsHierarchy pHierarchy, int fRemoved)
        {
            _vsHierarchyEvents = new VsHierarchyEvents(pHierarchy, _xrmToolingConnection);
            pHierarchy.UnadviseHierarchyEvents(_cookie);

            return(VSConstants.S_OK);
        }
 public int OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
 {
     m_myVsHierarchyEvents = new MyVsHierarchyEvents();
     pHierarchy.AdviseHierarchyEvents(m_myVsHierarchyEvents, out m_cookie);
     // do other things here ...
     return(VSConstants.S_OK);
 }
Example #5
0
        public void AdviseHierarchyEvents(IVsHierarchyEvents hierarchyEvents)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            if (_eventCookie != 0)
            {
                Logger.Error($"{nameof(AdviseHierarchyEvents)}: event cookie not 0 ({_eventCookie})");
            }

            _eventCookie = Hierarchy?.AdviseHierarchyEvents(hierarchyEvents) ?? 0;
        }
        public override int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
        {
            var hr = base.AdviseHierarchyEvents(pEventSink, out pdwCookie);

            if (hr == VSConstants.S_OK)
            {
                _hierEventSinks.Add(pdwCookie, pEventSink);
            }

            return(hr);
        }
 public virtual int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     return(InnerHierarchy.AdviseHierarchyEvents(pEventSink, out pdwCookie));
 }
Example #8
0
 //==========================================================================================
 // IVsHierarchy Members
 //==========================================================================================
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     return ((IVsUIHierarchy)this).AdviseHierarchyEvents(pEventSink, out pdwCookie);
 }
Example #9
0
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     return(_data.AdviseHierarchyEvents(pEventSink, out pdwCookie));
 }
Example #10
0
 /// <summary>
 /// Override event hierarchy notifications.
 /// </summary>
 protected override sealed uint AdviseHierarchyEvents(IVsHierarchyEvents listener)
 {
     return hierarchyListeners.AdviseHierarchyEvents(listener);
 }
Example #11
0
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie) {
   pdwCookie = _eventSinks.Add(pEventSink);
   return 0;
 }
 public virtual int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie) {
     pdwCookie = _eventCounter;
     _events[_eventCounter++] = pEventSink;
     return VSConstants.S_OK;
 }
Example #13
0
 /// <include file='doc\Hierarchy.uex' path='docs/doc[@for="HierarchyNode.AdviseHierarchyEvents"]/*' />
 public virtual int AdviseHierarchyEvents(IVsHierarchyEvents sink, out uint cookie){
   cookie = this.hierarchyEventSinks.Add(sink);
   return 0;
 }
Example #14
0
 /// <summary>
 /// Override event hierarchy notifications.
 /// </summary>
 protected sealed override uint AdviseHierarchyEvents(IVsHierarchyEvents listener)
 {
     return(hierarchyListeners.AdviseHierarchyEvents(listener));
 }
Example #15
0
 int IVsUIHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     return(((IVsHierarchy)this).AdviseHierarchyEvents(pEventSink, out pdwCookie));
 }
Example #16
0
    int IVsUIHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
    {
      pdwCookie = 100;
      while (_events.ContainsKey(pdwCookie))
        pdwCookie++;

      _events[pdwCookie] = pEventSink;

      return VSConstants.S_OK;
    }
Example #17
0
 public virtual void AdviseHierarchyEvents(IVsHierarchyEvents sink, out uint cookie) {
   CCITracing.TraceCall();
   cookie = this.hierarchyEventSinks.Add(sink);      
 }
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     return(_hierarchy.AdviseHierarchyEvents(pEventSink, out pdwCookie));
 }
Example #19
0
 /// <summary>
 /// Override event hierarchy notifications.
 /// </summary>
 internal uint AdviseHierarchyEvents(IVsHierarchyEvents eventSink)
 {
     return(eventSinkCollection.Add(eventSink) + 1);
 }
Example #20
0
 int IVsHierarchy.AdviseHierarchyEvents( IVsHierarchyEvents pEventSink, out uint pdwCookie )
 {
     return m_innerIVsHierarchy.AdviseHierarchyEvents( pEventSink, out pdwCookie );
 }
Example #21
0
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     pdwCookie             = (uint)Interlocked.Increment(ref this.sinkCookies);
     this.sinks[pdwCookie] = pEventSink;
     return(VSConstants.S_OK);
 }
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, [ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSCOOKIE")]out uint pdwCookie)
 {
     // We never change.
     pdwCookie = 42;
     return VSConstants.E_NOTIMPL;
 }
Example #23
0
 int IVsSolutionEvents.OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
 {
     _vsHierarchyEvents = new VsHierarchyEvents(pHierarchy, _webResouceList);
     pHierarchy.AdviseHierarchyEvents(_vsHierarchyEvents, out _cookie);
     return(VSConstants.S_OK);
 }
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     throw new System.NotImplementedException();
 }
Example #26
0
        //==========================================================================================
        // Methods
        //==========================================================================================

        public uint Add(IVsHierarchyEvents listener)
        {
            return(base.Add(listener));
        }
Example #27
0
 public virtual int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     pdwCookie = _eventCounter;
     _events[_eventCounter++] = pEventSink;
     return(VSConstants.S_OK);
 }
 int IVsSolutionEvents.OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
 {
     _vsHierarchyEvents = new VsHierarchyEvents(pHierarchy, _reportList);
     pHierarchy.AdviseHierarchyEvents(_vsHierarchyEvents, out _cookie);
     return VSConstants.S_OK;
 }
Example #29
0
 public abstract void AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie);
Example #30
0
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     throw new NotImplementedException();
 }
Example #31
0
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     pdwCookie = 0;
     return(VSConstants.E_NOTIMPL);
 }
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, [ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSCOOKIE")] out uint pdwCookie)
 {
     // We never change.
     pdwCookie = 42;
     return(VSConstants.E_NOTIMPL);
 }
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     pdwCookie = (uint)Interlocked.Increment(ref this.sinkCookies);
     this.sinks[pdwCookie] = pEventSink;
     return VSConstants.S_OK;
 }
Example #34
0
 internal abstract int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie);
Example #35
0
        /// <include file='doc\Hierarchy.uex' path='docs/doc[@for="HierarchyNode.AdviseHierarchyEvents"]/*' />
        public virtual int AdviseHierarchyEvents(IVsHierarchyEvents sink, out uint cookie) {
            cookie = this.hierarchyEventSinks.Add(sink)+1;
			return NativeMethods.S_OK;
        }
Example #36
0
 /// <summary>
 /// Override event hierarchy notifications.
 /// </summary>
 internal uint AdviseHierarchyEvents(IVsHierarchyEvents eventSink)
 {
     return eventSinkCollection.Add(eventSink) + 1;
 }
 //==========================================================================================
 // Methods
 //==========================================================================================
 public uint Add(IVsHierarchyEvents listener)
 {
     return base.Add(listener);
 }
Example #38
0
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Example #39
0
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     pdwCookie = _eventSinks.Add(pEventSink);
     return(0);
 }
Example #40
0
 //==========================================================================================
 // IVsUIHierarchy Members
 //==========================================================================================
 int IVsUIHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     pdwCookie = this.eventListeners.Add(pEventSink);
     return NativeMethods.S_OK;
 }
Example #41
0
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     throw new NotImplementedException();
 }
Example #42
0
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents eventSink, out uint cookie)
 {
     throw new NotImplementedException();
 }
Example #43
0
 public int AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     pdwCookie = 0;
     return VSConstants.E_NOTIMPL;
 }
Example #44
0
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents eventSink, out uint cookie)
 {
     throw new NotImplementedException();
 }
 /// <inheritdoc/>
 int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
 {
     pdwCookie = ++lastEventSinkCookie;
     this.cookieSinkMap[pdwCookie] = pEventSink;
     return(VSConstants.S_OK);
 }