Exemplo n.º 1
0
        /// <summary>
        /// Uninstalls the specified initializers.
        /// </summary>
        /// <param name="initializers">The initializers.</param>
        public static void Uninstall(IEnumerable <IInitializer> initializers)
        {
            FrontendModuleUninstaller.Uninitialize(initializers);

            var featherWidgetTypes = new List <string>();
            var configManager      = ConfigManager.GetManager();
            var toolboxesConfig    = configManager.GetSection <ToolboxesConfig>();

            foreach (var toolbox in toolboxesConfig.Toolboxes.Values)
            {
                ICollection <ToolboxSection> emptySections = new List <ToolboxSection>();
                foreach (var section in toolbox.Sections)
                {
                    var featherWidgets = ((ICollection <ToolboxItem>)section.Tools)
                                         .Where(i =>
                                                i.ControlType.StartsWith("Telerik.Sitefinity.Frontend", StringComparison.Ordinal) ||
                                                (!i.ControllerType.IsNullOrEmpty() && i.ControllerType.StartsWith("Telerik.Sitefinity.Frontend", StringComparison.Ordinal)));
                    featherWidgetTypes.AddRange(featherWidgets.Select(t => t.ControllerType));

                    var mvcToolsToDelete = featherWidgets.Select(i => i.GetKey());
                    foreach (var key in mvcToolsToDelete)
                    {
                        section.Tools.Remove(section.Tools.Elements.SingleOrDefault(e => e.GetKey() == key));
                    }

                    if (section.Tools.Count == 0)
                    {
                        emptySections.Add(section);
                    }
                }

                foreach (var emptySection in emptySections)
                {
                    toolbox.Sections.Remove(emptySection);
                }
            }

            configManager.SaveSection(toolboxesConfig);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Uninstall the module from Sitefinity system. Deletes the module artifacts added with Install method.
 /// </summary>
 /// <param name="initializer">The site initializer instance.</param>
 public override void Uninstall(SiteInitializer initializer)
 {
     this.Uninitialize();
     FrontendModuleUninstaller.Uninstall(this.initializers.Value);
     base.Uninstall(initializer);
 }
Exemplo n.º 3
0
 /// <summary>
 /// This method is invoked during the unload process of an active module from Sitefinity, e.g. when a module is deactivated. For instance this method is also invoked for every active module during a restart of the application.
 /// Typically you will use this method to unsubscribe the module from all events to which it has subscription.
 /// </summary>
 public override void Unload()
 {
     this.Uninitialize();
     FrontendModuleUninstaller.Unload(this.initializers.Value);
     base.Unload();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Unloads the specified initializers.
 /// </summary>
 /// <param name="initializers">The initializers.</param>
 public static void Unload(IEnumerable <IInitializer> initializers)
 {
     FrontendModuleUninstaller.Uninitialize(initializers);
 }