Пример #1
0
 private IModelSystemStructure GetRoot(IModelSystemStructure rootFor)
 {
     return(ModelSystemStructure.CheckForRootModule(this.Root, rootFor, ModelSystemStructure.GetRootRequirement(rootFor.Type)));
 }
Пример #2
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);
                    }
                }
            }
        }