增加PU(清理)命令

pull/491/MERGE
ChenX 5 years ago
parent e978094ced
commit 4abdc50424

@ -0,0 +1,29 @@
import { app } from "../ApplicationServices/Application";
import { arrayRemoveIf } from "../Common/ArrayExt";
import { HotCMD } from "../Hot/HotCommand";
@HotCMD
export class Command_Purge
{
async exec()
{
let keyRes = await app.Editor.GetKeyWords({
Msg: "执行后,历史记录将被清空,是否确认执行?",
KeyWordList: [
{ key: "Y", msg: "是" },
{ key: "N", msg: "否" },
],
Default: "N"
});
if (keyRes.StringResult !== "Y")
return;
app.Database.hm.Clear();
arrayRemoveIf(app.Database.ModelSpace.Entitys, e => e.IsErase);
arrayRemoveIf(app.Database.TemplateTable.Objects, e => e.IsErase);
app.Editor.Prompt("清理成功!");
}
}

@ -134,9 +134,13 @@ import { CommandServer } from '../DatabaseServices/CommandServer';
import { AutoTempateSizeAction } from '../DatabaseServices/Template/TemplateTest';
import { ICommand } from '../UI/Components/CommandPanel/CommandList';
import { commandMachine } from './CommandMachine';
import { Command_Purge } from "../Add-on/Purge";
export function registerCommand()
{
commandMachine.RegisterCommand("pu", new Command_Purge());
commandMachine.RegisterCommand("end", new Command_EndTempEditor());
commandMachine.RegisterCommand("RestoreColor", new Command_RestoreColor());

Loading…
Cancel
Save