private void PanelsOnShow(object sender, ShowPanelEventArgs e) { // only do something if its actually for our panel if (e.PanelId == BlockManagerPanel.PanelId) { // get instance of our panel var panel = Panels.GetPanel <BlockManagerPanel>(e.Document); // check if already initialized with view-model if (panel.IsModelInitialized) { return; } // initialize new view-model panel.SetBlockTreeModel(new SearchableBlockTreeModel(new BlockTreeModel(new BlockWatcher(e.Document)))); } if (e.PanelId == typeof(BlockManager).GUID) { // Initialize structure InstanceDefinitionStructure = new InstanceDefinitionStructure(e.Document.InstanceDefinitions); } }
/// <summary> /// Handles everything we need to do when changing documents /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnActiveDocChanged(object sender, DocumentEventArgs e) { InstanceDefinitionStructure = new InstanceDefinitionStructure(e.Document.InstanceDefinitions); }