protected override void Dispose(bool disposing) { base.Dispose(disposing); ActiveForm = null; EnableWindow(MWHBricscad, WasEnabled); if (WasEnabled) { SetActiveWindow(MWHBricscad); } }
public ModalForm() { EnableWindow(MWHBricscad, false); ActiveForm = this; ShowIcon = false; ShowInTaskbar = false; BackColor = System.Drawing.Color.White; Opacity = 0.1; Show(OwnerWindow); }
public void Bake(List <_OdDb.ObjectId> ghDataIds, UI.BakeDialog bakeProperties) { DisableReactors(); var saveDoc = GhDrawingContext.LinkedDocument; GhDrawingContext.LinkedDocument = Document; using (var transaction = Document.Database.TransactionManager.StartTransaction()) { using (var form = new UI.ModalForm()) { foreach (var ghDataId in ghDataIds) { var ghData = transaction.GetObject(ghDataId, _OdDb.OpenMode.ForRead) as GrasshopperData; if (ghData == null) { continue; } var definition = DefinitionManager.Definition(ghData.Definition); if (definition == null) { continue; } foreach (var obj in definition.Objects.OfType <Components.BakeComponent>()) { if (!obj.Locked) { Components.BakeComponent.Expire(obj, bakeProperties); } } GrasshopperPlayer.Run(definition, ghData, Document); } } transaction.Commit(); } GhDrawingContext.LinkedDocument = saveDoc; EnableReactors(); }
public void Proccess() { DisableReactors(); if (NeedHardUpdate) { foreach (var pair in _grasshopperData) { _toUpdate.Add(pair.Key); } } else if (NeedSoftUpdate) { var ghColor = GhDataSettings.Color; using (var transaction = Document.Database.TransactionManager.StartTransaction()) { foreach (var pair in _grasshopperData) { pair.Value.Color = ghColor; pair.Value.ColorSelected = ghColor; if (!_toUpdate.Contains(pair.Key)) { var ghData = transaction.GetObject(pair.Key, _OdDb.OpenMode.ForRead) as GrasshopperData; var hostEnt = transaction.GetObject(ghData.HostEntity, _OdDb.OpenMode.ForWrite) as _OdDb.Entity; hostEnt?.RecordGraphicsModified(true); } } transaction.Commit(); } } if (_toUpdate.Count != 0) { var saveDoc = GhDrawingContext.LinkedDocument; GhDrawingContext.LinkedDocument = Document; //all bc components use it for computation using (var transaction = Document.Database.TransactionManager.StartTransaction()) { using (var form = new UI.ModalForm()) { foreach (var ghDataId in _toUpdate) { var ghData = transaction.GetObject(ghDataId, _OdDb.OpenMode.ForRead) as GrasshopperData; if (ghData == null) { continue; } UpdateDrawable(ghData); var hostEnt = transaction.GetObject(ghData.HostEntity, _OdDb.OpenMode.ForWrite) as _OdDb.Entity; hostEnt?.RecordGraphicsModified(true); } } transaction.Commit(); } GhDrawingContext.LinkedDocument = saveDoc; } _toUpdate.Clear(); NeedHardUpdate = false; NeedSoftUpdate = false; EnableReactors(); }