Check orchard module is enabled/disabled programmatically

Topics: General
Apr 21, 2014 at 8:17 AM
Edited Apr 21, 2014 at 8:18 AM
Hello,

I want to check one of my custom orchard module enabled/disabled programmatically in other module. Can not find any solution for that.
Apr 21, 2014 at 8:48 AM
After searching on Google i have found a solution for checking module is enabled/disabled or other property check on that modules.

We need to use IModuleService referencing Orchard.Modules

From http://stackoverflow.com/questions/13056752/how-do-i-programmatically-disable-an-orchard-module
        var features = _moduleService.GetAvailableFeatures().ToDictionary(m=>m.Descriptor.Id, m=>m);
        if (features.ContainsKey("TinyMce") && features["TinyMce"].IsEnabled) {
            _moduleService.DisableFeatures(new string[] { "TinyMce" });
        }

        if (features.ContainsKey("TinyMceDeluxe") && !features["TinyMceDeluxe"].IsEnabled) {
            _moduleService.EnableFeatures(new string[] { "TinyMceDeluxe" });
        }
Apr 21, 2014 at 8:58 AM
Edited Apr 21, 2014 at 8:59 AM
Crucial feature you found.