Пример #1
0
        void _ContextMenu_Opened(object sender, RoutedEventArgs e)
        {
            ContextMenu menu = sender as ContextMenu;

            foreach (MenuItem menuitem in menu.Items)
            {
                menuitem.Visibility = Visibility.Visible;
            }
            InterfaceNode treenode = MainWindow.instance.tree1.SelectedItem as InterfaceNode;

            if (treenode.Module.id == 0)
            {
                foreach (MenuItem menuitem in menu.Items)
                {
                    if (menuitem.Header.ToString().Contains("删除") || menuitem.Header.ToString().Contains("重命名"))
                    {
                        menuitem.Visibility = Visibility.Collapsed;
                    }
                }
            }
            else if (treenode.Module.IsFolder == false)
            {
                foreach (MenuItem menuitem in menu.Items)
                {
                    if (menuitem.Header.ToString().Contains("新建"))
                    {
                        menuitem.Visibility = Visibility.Collapsed;
                    }
                }
            }
        }
Пример #2
0
 public InterfaceItemNode(EJ.InterfaceModule module, InterfaceNode parent)
     : base(parent)
 {
     this.Module             = module;
     this.Name               = module.Name;
     module.PropertyChanged += module_PropertyChanged;
 }