private void SiteComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                SiteItem siteItem = this.SiteComboBox.SelectedItem as SiteItem;

                if (siteItem != null)
                {
                    this.m_DestinationSite = new SPSite(siteItem.SiteId);
                    this.WebComboBox.Items.Clear();

                    foreach (SPWeb web in this.m_DestinationSite.AllWebs)
                    {
                        this.WebComboBox.Items.Add(new SiteItem((web.IsRootWeb ? "[Root Web]" : web.Name), web.ID));
                    }
                }
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show(this, "You do not have permission to access the selected site.", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
            }
            catch (Exception ex)
            {
                this.HandleException(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        private void WebComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                SiteItem webItem = this.WebComboBox.SelectedItem as SiteItem;

                this.m_DestinationWeb = this.m_DestinationSite.OpenWeb(webItem.SiteId);

                foreach (SPList list in this.m_DestinationWeb.Lists)
                {
                    this.ListComboBox.Items.Add(new SecurableObjectItem(list.Title, list.ID));
                }
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show(this, "You do not have permission to access the selected site.", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
            }
            catch (Exception ex)
            {
                this.HandleException(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        private void SiteComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                this.ResetObjectTreeView();
                this.EventReceiverTreeView.Nodes.Clear();
                this.EventReceiverPropertyGrid.SelectedObject = null;
                this.AddToolStripButton.Enabled               = false;
                this.DeleteToolStripButton.Enabled            = false;
                this.DeleteAllToolStripButton.Enabled         = false;
                this.RemoveInvalidToolStripButton.Enabled     = false;
                this.RefreshEventHooksToolStripButton.Enabled = false;
                this.VerifyAllToolStripButton.Enabled         = false;
                this.CopyHooksToolStripButton.Enabled         = false;

                SiteItem siteItem = this.SiteComboBox.SelectedItem as SiteItem;

                if (siteItem != null)
                {
                    this.m_Site = new SPSite(siteItem.SiteId);
                    this.WebComboBox.Items.Clear();

                    foreach (SPWeb web in this.m_Site.AllWebs)
                    {
                        this.WebComboBox.Items.Add(new SiteItem((web.IsRootWeb ? "[Root Web]" : web.Name), web.ID));
                    }

                    foreach (SPContentType ct in this.m_Site.RootWeb.ContentTypes)
                    {
                        this.ObjectsTreeView.Nodes[1].Nodes.Add(ct.Id.ToString().ToUpper(), ct.Name, 3, 3);
                    }
                }
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show(this, "You do not have permission to access the selected site.", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
            }
            catch (Exception ex)
            {
                this.HandleException(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        private void WebComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                this.VerifyAllToolStripButton.Enabled = false;
                this.CopyHooksToolStripButton.Enabled = false;
                this.ResetObjectTreeView();
                this.EventReceiverTreeView.Nodes.Clear();
                this.EventReceiverPropertyGrid.SelectedObject = null;
                this.AddToolStripButton.Enabled               = false;
                this.DeleteToolStripButton.Enabled            = false;
                this.DeleteAllToolStripButton.Enabled         = false;
                this.RemoveInvalidToolStripButton.Enabled     = false;
                this.RefreshEventHooksToolStripButton.Enabled = false;

                SiteItem webItem = this.WebComboBox.SelectedItem as SiteItem;

                this.m_Web = this.m_Site.OpenWeb(webItem.SiteId);

                foreach (SPList list in this.m_Web.Lists)
                {
                    if (SPBaseType.DocumentLibrary == list.BaseType)
                    {
                        this.ObjectsTreeView.Nodes[1].Nodes.Add(list.ID.ToString("B").ToUpper(), list.Title, 3, 3);
                    }
                    else
                    {
                        this.ObjectsTreeView.Nodes[0].Nodes.Add(list.ID.ToString("B").ToUpper(), list.Title, 1, 1);
                    }
                }

                foreach (SPWeb childWeb in this.m_Web.Webs)
                {
                    this.ObjectsTreeView.Nodes[2].Nodes.Add(childWeb.ID.ToString("B").ToUpper(), childWeb.Title, 5, 5);
                }

                foreach (SPContentType ct in this.m_Site.RootWeb.ContentTypes)
                {
                    this.ObjectsTreeView.Nodes[3].Nodes.Add(ct.Id.ToString().ToUpper(), ct.Name, 3, 3);
                }

                this.ObjectsTreeView.ExpandAll();

                if (this.ObjectsTreeView.Nodes.Count > 0)
                {
                    this.ObjectsTreeView.SelectedNode = this.ObjectsTreeView.Nodes[0];
                }

                this.VerifyAllToolStripButton.Enabled = true;
                this.CopyHooksToolStripButton.Enabled = true;
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show(this, "You do not have permission to access the selected site.", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
            }
            catch (Exception ex)
            {
                this.HandleException(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }