Ejemplo n.º 1
0
        private void DisplayTree_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            var position = e.GetPosition(this.DisplayTree);
            var hitItem  = this.DisplayTree.InputHitTest(position) as DependencyObject;

            if (hitItem != null && hitItem != this.DisplayTree)
            {
                var item = FindAncestor <TreeViewItem>(hitItem);
                // we might have been clicked without having a treeview item selected
                if (item == null)
                {
                    return;
                }
                var structure = item.Header as ModelSystemDisplayStructure;
                this.SelectedModule = structure.Structure;
                if (structure.Structure != null)
                {
                    if (structure.Structure.IsCollection)
                    {
                        ((UMSIContextMenu)this.ContextMenu).SetData(
                            this.RootModule,
                            ModelSystemStructure.GetParent(this.RootModule, structure.Structure),
                            structure.Structure);
                    }
                    else
                    {
                        ((UMSIContextMenu)this.ContextMenu).SetData(
                            ModelSystemStructure.CheckForRootModule(this.RootModule, structure.Structure, ModelSystemStructure.GetRootRequirement(structure.Structure.Type)),
                            ModelSystemStructure.GetParent(this.RootModule, structure.Structure),
                            structure.Structure);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private IModelSystemStructure GetParent(IModelSystemStructure toFind)
 {
     return(ModelSystemStructure.GetParent(this.Root, toFind));
 }