diff --git a/src/Add-on/ChangeColorByBoard/ChangeColorByMaterial.tsx b/src/Add-on/ChangeColorByBoard/ChangeColorByMaterial.tsx index 74eee5a4d..62b74ae3c 100644 --- a/src/Add-on/ChangeColorByBoard/ChangeColorByMaterial.tsx +++ b/src/Add-on/ChangeColorByBoard/ChangeColorByMaterial.tsx @@ -13,10 +13,8 @@ import { PromptSsgetResult, PromptStatus } from '../../Editor/PromptResult'; import { SelectSetBase } from '../../Editor/SelectBase'; import { Production } from '../../Production/Product'; import { BoardModalType } from '../../UI/Components/Board/BoardModalType'; -import { IConfigOption } from '../../UI/Components/Board/UserConfigComponent'; +import { DialogUserConfig } from '../../UI/Components/Board/UserConfigComponent'; import { CommonModal } from '../../UI/Components/Modal/ModalContainer'; -import { ChangeColorByBoardMaterialOption } from '../../UI/Store/BoardInterface'; -import { userConfigStore } from '../../UI/Store/UserConfigStore'; import { BoardInfoSelectPanel } from './BoardInfoSelectPanel'; import { ChangeColorByBoardMaterialStore } from './CalcBrThicknessConfigStore'; @@ -28,7 +26,6 @@ export class ChangeColorByMaterial implements Command let brs: Board[] = []; let brRes: PromptSsgetResult; - let needUpdateStore = true; while (true) { @@ -42,7 +39,6 @@ export class ChangeColorByMaterial implements Command return; else if (brRes.Status === PromptStatus.Keyword) { - needUpdateStore = false; app.Editor.ModalManage.RenderModal(BoardInfoSelectPanel, { store }); await app.Editor.ModalManage.Wait(); } @@ -50,21 +46,8 @@ export class ChangeColorByMaterial implements Command break; } - //没有呼出UI时,初始化或更新配置 - if (needUpdateStore) - { - let config = await userConfigStore.GetConfig(BoardModalType.ChangeColorByBoardMaterial) as IConfigOption; - - if (!config) - { - await userConfigStore.SaveConfig(BoardModalType.ChangeColorByBoardMaterial, store, { toaster: false, isInit: true }); - let config = await userConfigStore.GetConfig(BoardModalType.ChangeColorByBoardMaterial) as IConfigOption; - if (config) - store.UpdateOption(config); - } - else - store.UpdateOption(config); - } + let config = new DialogUserConfig(store, BoardModalType.ChangeColorByBoardMaterial); + await config.LoadAndInitConfig();//载入或者初始化 brs = brRes.SelectSet.SelectEntityList as Board[]; let colors = [0, 2, 3, 4, 5, 6, 7, 8, 60, 15, 20, 24, 30, 61, 181, 155, 139, 74, 161, 65, 231, 45, 240, 211, 110, 216, 100, 105, 110, 115, 120, 130, 140, 150, 160, 170, 180, 190, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210];