void OnViewActivated(object sender, ViewActivatedEventArgs e) { try { View vPrevious = e.PreviousActiveView; View vCurrent = e.CurrentActiveView; //TaskDialog.Show("test", (sender as UIApplication).ActiveUIDocument.Document.Title); //_window.Close(); _window = new Lab5Window((sender as UIApplication).ActiveUIDocument); //PopulateList(); } catch (Exception ex) { throw ex; } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { //commandData.Application.ActiveUIDocument.RefreshActiveView(); UIDocument uidoc = commandData.Application.ActiveUIDocument; Document doc = uidoc.Document; commandData.Application.ViewActivated += new EventHandler <ViewActivatedEventArgs>(OnViewActivated); using (Transaction trans = new Transaction(doc, "Display selected elements category")) { trans.Start(); try { _window = new Lab5Window(uidoc); PopulateList(); _window.Show(); trans.Commit(); } catch (Exception e) { TaskDialog.Show("Exception", e.Message); trans.RollBack(); } return(Result.Succeeded); } }