public bool SetModule(IProjectController projectController) { try { Log.Here().Activity("Module set to [{0}]. Starting...", projectController.ModuleData.ModuleName); CurrentModule = projectController; CurrentModule.Initialize(Data); FileCommands.Load.LoadAll(CurrentModule.ModuleData); CurrentModule.Start(); Data.CurrentModuleData = CurrentModule.ModuleData; Data.ModuleIsLoaded = true; if (Data.AppSettings.LastModule != CurrentModule.ModuleData.ModuleName) { Data.AppSettings.LastModule = CurrentModule.ModuleData.ModuleName; SaveAppSettings(); } OnModuleSet?.Invoke(this, EventArgs.Empty); RegisterMenuShortcuts(); if (CurrentModule.ModuleData != null) { CurrentModule.ModuleData.OnSettingsReverted += OnSettingsReverted; if (mainWindow.IsLoaded) { OnAppLoaded(); } } mainWindow.OnModuleSet(CurrentModule); Data.MergeKeyLists(); Data.WindowTitle = "Source Control Generator - " + CurrentModule.ModuleData.ModuleName; return(true); } catch (Exception ex) { Log.Here().Error($"Error loading module: {ex.ToString()}"); return(false); } }