private void Document_CommandWillStart(object sender, CommandEventArgs e) { if (e.GlobalCommandName == "CLOSE" || e.GlobalCommandName == "QUIT" || e.GlobalCommandName == "QSAVE" || e.GlobalCommandName == "SAVEAS") { _documents[sender as Document].TechProcessList.ForEach(p => p.DeleteProcessing()); TechProcessLoader.SaveTechProsess(_documents[sender as Document]); _camPaletteSet.ClearCommands(); Acad.DeleteAll(); } }
public void SetActiveDocument(Document document) { if (document != null && !_documents.ContainsKey(document)) { document.CommandWillStart += Document_CommandWillStart; document.BeginDocumentClose += Document_BeginDocumentClose; document.ImpliedSelectionChanged += ImpliedSelectionChanged; _documents[document] = new CamDocument(_techProcessFactory); TechProcessLoader.LoadTechProsess(_documents[document]); } Acad.ClearHighlighted(); _camPaletteSet.SetCamDocument(document != null ? _documents[document] : null); }