Beispiel #1
0
 /// <summary>
 /// Creates the new registry locator
 /// </summary>
 public override void Execute()
 {
     try
     {
         IVsdDeployable       deployable    = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset plugins       = deployable.GetPlugIns();
         IVsdLocatorPlugIn    locatorPlugin = plugins.Item("Locator") as IVsdLocatorPlugIn;
         if (locatorPlugin != null)
         {
             vsdLocator =
                 (IVsdRegistryKeyLocator)DteHelper.CoCreateInstance(
                     this.Site,
                     typeof(VsdRegistryKeyLocatorClass),
                     typeof(IVsdRegistryKeyLocator));
             vsdLocator.Name     = this.LocatorName;
             vsdLocator.Property = this.Property;
             vsdLocator.RegKey   = this.RegistryKey;
             vsdLocator.Root     = vsdRegistryRoot.vsdrrHKLM;
             vsdLocator.Value    = this.Value;
             locatorPlugin.Items.Add(vsdLocator);
         }
     }
     catch (Exception)
     {
         vsdLocator = null;
         throw;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Removes the locator that was recently created
 /// </summary>
 public override void Undo()
 {
     if (vsdLocator != null)
     {
         IVsdDeployable       deployable    = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset plugins       = deployable.GetPlugIns();
         IVsdLocatorPlugIn    locatorPlugin = plugins.Item("Locator") as IVsdLocatorPlugIn;
         if (locatorPlugin != null)
         {
             locatorPlugin.Items.RemoveObject(vsdLocator);
             vsdLocator = null;
         }
     }
 }