public static void CreateAndEditDrawing() { //create the drawings Drawing d = Plugin.CreateDefaultDrawingWithFileName(); if (d == null) return; DrawingsDataContext dc = DBCommon.NewDC; dc.Drawings.InsertOnSubmit(d); //chuck it in the database dc.SubmitChanges(); //bring up the window to edit changes ViewDrawingWindow atv = new ViewDrawingWindow(d, null, true); atv.ShowDialog(); }
/// <summary> /// Show the ViewDrawingWindow for the current drawing /// </summary> public void ShowViewDrawingWindow(bool enableEditByDefault) { try { using (Transaction tr = _db.TransactionManager.StartTransaction()) { DrawingsDataContext ddc = DBCommon.NewDC; IEnumerable<BlockReference> blocks = GetLayoutBlocks(tr, OpenMode.ForRead); Drawing d = null; foreach (BlockReference block in blocks) { if (d != null) return; d = GetDrawingFromBlock(ddc, block, tr); } if (d == null) return; var w = new ViewDrawingWindow(d, null, enableEditByDefault); w.ShowDialog(); } } catch (Exception ex) { _ed.WriteMessage(ex.ToString()); } }