/// <summary>
        /// Handles the NodePropertiesRequested event of the typeDefinition control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.VisualStudio.SharePoint.Explorer.ExplorerNodePropertiesRequestedEventArgs"/> instance containing the event data.</param>
        void typeDefinition_NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e)
        {
            IExplorerNode     listEventReceiverNode = e.Node;
            EventReceiverInfo eventReceiverInfo     = listEventReceiverNode.Annotations.GetValue <EventReceiverInfo>();

            if (eventReceiverInfo != null)
            {
                Dictionary <string, string> listEventReceiverProperties = listEventReceiverNode.Context.SharePointConnection.ExecuteCommand <EventReceiverInfo, Dictionary <string, string> >(ListEventReceiversCommandIds.GetListEventReceiverProperties, eventReceiverInfo);
                object propertySource = listEventReceiverNode.Context.CreatePropertySourceObject(listEventReceiverProperties);
                e.PropertySources.Add(propertySource);
            }
        }
        private Dictionary <string, string> GetListEventReceiverProperties(ISharePointCommandContext context, EventReceiverInfo eventReceiverInfo)
        {
            SPEventReceiverDefinition   eventReceiver           = null;
            Dictionary <string, string> eventReceiverProperties = new Dictionary <string, string>();

            SPList list = context.Web.Lists[eventReceiverInfo.ListId];

            if (eventReceiverInfo.Id != Guid.Empty)
            {
                eventReceiver = list.EventReceivers[eventReceiverInfo.Id];
            }
            else if (!String.IsNullOrEmpty(eventReceiverInfo.Name))
            {
                eventReceiver = (from SPEventReceiverDefinition er in list.EventReceivers
                                 where er.Name.Equals(eventReceiverInfo.Name)
                                 select er).FirstOrDefault();
            }
            else
            {
                eventReceiver = (from SPEventReceiverDefinition er in list.EventReceivers
                                 where er.Assembly == eventReceiverInfo.Assembly &&
                                 er.Class == eventReceiverInfo.Class &&
                                 (int)er.Type == eventReceiverInfo.EventType
                                 select er).FirstOrDefault();
            }

            if (eventReceiver != null)
            {
                eventReceiverProperties = SharePointCommandServices.GetProperties(eventReceiver);
            }

            return(eventReceiverProperties);
        }