protected virtual void OnSelectedModuleTypeChanged(ModuleType oldType, ModuleInitializeMethod newModuleInitialize) { var transitionService = GetService <Services.ITransitionService>(); using (transitionService.EnterTransition((SelectedModuleType != ModuleType.Unknown) && (oldType != ModuleType.Unknown))) { var workspaceService = GetService <Services.IWorkspaceService>(); var resolver = GetService <IModuleTypesResolver>(); if (oldType != ModuleType.Unknown) { workspaceService.SaveWorkspace(resolver.GetName(oldType)); } else { workspaceService.SetupDefaultWorkspace(); } SelectedModule = GetModule(SelectedModuleType); if (SelectedModuleType != ModuleType.Unknown) { workspaceService.RestoreWorkspace(resolver.GetName(SelectedModuleType)); } if (SelectedModule != null && newModuleInitialize != null) { newModuleInitialize(SelectedModule); } } if (ModuleTransitionCompleted != null) { ModuleTransitionCompleted(SelectedModule, EventArgs.Empty); } }
public void SetSelectedModuleType(ModuleType moduleType, ModuleInitializeMethod initialize) { if (SelectedModuleType == moduleType) { return; } var old = SelectedModuleType; this.selectedModuleType = moduleType; OnSelectedModuleTypeChanged(old, initialize); }
public void SelectModule(ModuleType moduleType, ModuleInitializeMethod initialize) { SetSelectedModuleType(moduleType, initialize); }