Message 1 of 1
Order of resetting MdiActiveDocument and calling CloseAndSave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Forum,
I use the following order of code (AutoCAD 2019, .NET, C#), which works fine, so I am hesitant to change anything:
docOriginal = DocumentManager.MdiActiveDocument;
...
using (Document docNew = DocumentCollectionExtension.Open(Application.DocumentManager, ..., false))
...
DocumentManager.MdiActiveDocument = docNew;
...
using (DocumentLock dlWorking = docNew.LockDocument())
{
// Do stuff.
{
...
docNew.CloseAndSave(...);
...
DocumentManager.MdiActiveDocument = docOriginal;
But would it make more sense to set "MdiActiveDocument " back to "docOriginal" BEFORE calling "docNew.CloseAndSave()"?
If anyone could explain a bit why this would be better (or not), or maybe does not matter at all, that would be great.
Thanks,