コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public void SetSelectedModuleType(ModuleType moduleType, ModuleInitializeMethod initialize)
        {
            if (SelectedModuleType == moduleType)
            {
                return;
            }
            var old = SelectedModuleType;

            this.selectedModuleType = moduleType;
            OnSelectedModuleTypeChanged(old, initialize);
        }
コード例 #3
0
 public void SelectModule(ModuleType moduleType, ModuleInitializeMethod initialize)
 {
     SetSelectedModuleType(moduleType, initialize);
 }