Example #1
0
 /// <summary>Implements the OnDisconnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being unloaded.</summary>
 /// <param term='disconnectMode'>Describes how the Add-in is being unloaded.</param>
 /// <param term='custom'>Array of parameters that are host application specific.</param>
 /// <seealso class='IDTExtensibility2' />
 public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
 {
     if (disconnectMode == ext_DisconnectMode.ext_dm_UserClosed)
     {
         try
         {
             Commands2   commands   = (Commands2)_applicationObject.Commands;
             CommandBars cmdBars    = (CommandBars)(_applicationObject.CommandBars);
             CommandBar  codeWindow = cmdBars["Code Window"];
             var         controls   = codeWindow.GetControls().Where(ctrl => ctrl.Caption.Equals("SvnAddin")).ToList();
             foreach (var ctrl in controls)
             {
                 ctrl.Delete();
             }
         }
         catch (Exception)
         {
         }
     }
 }