internal void LoadWrapper() { try { using (DocumentLock dl = AcDoc?.LockDocument()) { using (Transaction tr = AcCurDb.TransactionManager.StartTransaction()) { Managers.Clear(); var mgrObjList = LoadBinary <List <object> >("Managers", _managerTypes); foreach (IDrawingObjectManager drawingObjectManager in mgrObjList) { drawingObjectManager.SetDependencies(AcDoc, _log, _settings); drawingObjectManager.ActivateObjects(); Managers.Add(drawingObjectManager); } Load(); PopulateLayers(); tr.Commit(); } } } catch (Exception e) { _log.LogError(e, "Unkown error loading"); } }
private void PopulateLayers() { var layers = GetLayers(); if (layers.Count == 0) { return; } using (AcDoc.LockDocument()) { using (var trans = AcCurDb.TransactionManager.StartTransaction()) { foreach (object layerObj in layers) { if (layerObj is LayerAttribute layer) { _layerManager.CreateLayer(AcCurDb, layer.Name); } } trans.Commit(); } } }
internal void SaveWrapper() { try { using (DocumentLock dl = AcDoc?.LockDocument()) { using (Transaction tr = AcCurDb.TransactionManager.StartTransaction()) { var mgrObjList = new List <object>(); Managers.ForEach(mgr => mgrObjList.Add(mgr)); SaveBinary("Managers", mgrObjList, _managerTypes); Save(); tr.Commit(); } } } catch (Exception e) { _log.LogError(e, "Unkown error saving"); } }