using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.RecipeFramework.Services;

namespace Microsoft.Practices.RecipeFramework.Extensions.Actions.GAX
{
    /// <summary/>
    public class EnableGuidancePackageAction : ConfigurableAction
    {
        #region Input Properties
        private string packageName;

        /// <summary>
        /// Gets or sets the name of the package.
        /// </summary>
        /// <value>The name of the package.</value>
        [Input(Required=true)]
        public string PackageName
        {
            get { return packageName; }
            set { packageName = value; }
        }

        #endregion

        #region ConfigurableAction Implementation

        /// <summary>
        /// Executes this instance.
        /// </summary>
        public override void Execute()
        {
            IRecipeManagerService manager = GetService<IRecipeManagerService>();

            try
            {
                manager.EnablePackage(this.packageName);
            }
            catch
            {
                //Do nothing if the package is not loaded
            }
        }

        /// <summary>
        /// Undoes this instance.
        /// </summary>
        public override void Undo()
        {
            //Not Implemented
        }
        #endregion
    }
}
