MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / handle

Method handle

src/main/controller.ts:108–182  ·  view source on GitHub ↗
(identifier: Identifier, param: any = null)

Source from the content-addressed store, hash-verified

106 }
107
108 handle(identifier: Identifier, param: any = null): boolean {
109 switch (identifier) {
110 case "newConfigSnapshot":
111 if (param == null) {
112 this.promptForName();
113 } else {
114 this.config.newSnapshot(param as string);
115 }
116 break;
117 case "delConfigSnapshot":
118 this.config.delSnapshot(param as string);
119 break;
120 case "configSnapshot":
121 this.config.resumeSnapshot(param as string);
122 break;
123 case "exit":
124 this.handle("closeWindow", null);
125 this.onExit();
126 break;
127 case "settings":
128 this.win.showSettings(param);
129 break;
130 case "enumerateLayouts":
131 this.enumerateLayouts(true);
132 break;
133 case "restoreMultiDefault":
134 this.restoreMultiDefault(param);
135 break;
136 case "restoreDefault":
137 if (param == null) {
138 this.resotreDefaultSetting();
139 } else {
140 this.config.reset(param as Identifier); //带参时仅重置特定项
141 }
142 break;
143 case "checkUpdate":
144 this.updater.check();
145 break;
146 case "homepage":
147 shell.openExternal(constants.homepage);
148 break;
149 case "changelog":
150 shell.openExternal(constants.changelogs);
151 break;
152 case "userManual":
153 shell.openExternal(constants.wiki);
154 break;
155 case "hideWindow":
156 this.win.mainWindow.hide();
157 break;
158 case "close":
159 this.win.closeByName(param as RouteActionType);
160 break;
161 case "closeWindow":
162 this.win.closeByName("contrast");
163 break;
164 case "showWindow":
165 this.win.showWindow();

Callers 2

promptForNameMethod · 0.95
bindFunction · 0.45

Calls 14

promptForNameMethod · 0.95
onExitMethod · 0.95
enumerateLayoutsMethod · 0.95
restoreMultiDefaultMethod · 0.95
resotreDefaultSettingMethod · 0.95
newSnapshotMethod · 0.80
delSnapshotMethod · 0.80
resumeSnapshotMethod · 0.80
showSettingsMethod · 0.80
resetMethod · 0.80
checkMethod · 0.80
closeByNameMethod · 0.80

Tested by

no test coverage detected