Ejemplo n.º 1
0
        /// <summary>
        /// Provides a record-by-record processing functionality for the cmdlet.
        /// </summary>
        protected override void ProcessRecord()
        {
            string tenantName = null;

            if ((this.ParameterSetName != "ThemeObject") && string.IsNullOrEmpty(this.Tenant))
            {
                // Get feature for current tenant if tenant name not specified
                OrchardTenant tenant = this.GetCurrentTenant();
                tenantName = tenant != null ? tenant.Name : "Default";
            }

            if (!string.IsNullOrEmpty(this.Tenant))
            {
                tenantName = this.Tenant;
            }

            OrchardTheme theme = null;

            if (this.ParameterSetName == "Default")
            {
                theme = this.GetOrchardTheme(tenantName, this.Name);
                if (theme == null)
                {
                    this.WriteError(
                        new ArgumentException("Failed to find theme with name '" + this.Name + "'."),
                        "FailedToFindTheme",
                        ErrorCategory.InvalidArgument);
                }
            }
            else if (this.ParameterSetName == "ThemeObject")
            {
                theme      = this.Theme;
                tenantName = this.Theme.TenantName;
            }

            if (theme != null)
            {
                if (this.ShouldProcess("Theme: " + theme.Name + ", Tenant: " + tenantName, "Enable Theme"))
                {
                    this.modulesAgent.EnableTheme(tenantName, theme.Id);
                }
            }
        }
Ejemplo n.º 2
0
 public ThemeNode(IPowerShellVfs vfs, OrchardTheme theme)
     : base(vfs, theme.Name, theme)
 {
 }