private void listView1_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (listView1.SelectedItem == null) { return; } var win = new ViewDrawingWindow((MPDrawing)listView1.SelectedItem, listView1.Items.Refresh); win.Show(); //set this to true, otherwise someone else will mess with our popup window... (im looking at you listview) e.Handled = true; }
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()); } }