Component not removed when trying to hide ads

Jan 19, 2014 at 2:49 AM
So I have the following methods to show or hide the ads.
        public static void ShowAd()
        {
            //Hide ads before reminder is shown
            if (Constants.ShowAdsAfterUsage(4))
            {
                Debug.WriteLine("Ads is shown");

                if (Screen.gameSettings.IsAdsVisibleSetting)
                {
                    if (!game.Components.Contains(Game1.myXNAComponent))
                    {
                         game.Components.Add(Game1.myXNAComponent);
                         Game1.myXNAComponent.Visible = true;          
                    }                                   
                }
            }
            else
            {
                Debug.WriteLine("Ads not shown");
            }
        }


        public static void HideAd()
        {
            if (game.Components.Contains(Game1.myXNAComponent))
            {
                Game1.myXNAComponent.Visible = false;
                game.Components.Remove(Game1.myXNAComponent);
                Debug.WriteLine("Ads is hidden");
            }
        }
The problem is the line below does not actually do anything.
game.Components.Remove(Game1.myXNAComponent);
So I have to set the Visible property to false. But still when I tap the area where the ad used to appear, the tap is still registered.

In the Game1 class, I've declared a static field
public static AdRotatorXNAComponent myXNAComponent;
Then in the constructor I have the following
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
  
            AdRotatorXNAComponent.Initialize(this);
          
            //Optionally specify the slide (popup) direction for the Ad
            AdRotatorXNAComponent.Current.SlidingAdDirection = SlideDirection.None;

            //Optionally Set the local configuration file used to set the default Ad Locations
            AdRotatorXNAComponent.Current.DefaultSettingsFileUri = "defaultAdSettings.xml";

            //Specify where you want the Ad to display (based on the top left corner of the Ad)
            AdRotatorXNAComponent.Current.AdPosition = new Vector2(0, 720);

            myXNAComponent = AdRotatorXNAComponent.Current;
            Components.Add(myXNAComponent);

            Content.RootDirectory = "Content";

            // Set backbuffer size and orientation
            graphics.PreferredBackBufferWidth = 480;
            graphics.PreferredBackBufferHeight = 800;

            // Extend battery life under lock.
            InactiveSleepTime = TimeSpan.FromSeconds(1);
        }

What am I missing?

I am developing for Windows Phone 7 on VS2012. Actually porting my current game created using MonoGame to XNA.
Coordinator
Jan 20, 2014 at 8:06 AM
The simple reason is because you have not disabled AdRotator before removing it from the xan component collection.

AdRototator gets no indication if it has been removed or not and we use that same collection for the ads.
So you have removed AdRotator but the ad is still in the collection.

Alternatively, if you are not using any other components you should be able to do "Components.Clear()" or "Components.RemoveAll()" (not got the syntax to hand)

Let me know if this helps.