예제 #1
0
        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);
            mainMenu                = this.FindControl <Menu>("mainMenu");
            toolBar                 = this.FindControl <ItemsControl>("toolBar");
            languageComboBox        = this.FindControl <DropDown>("languageComboBox");
            languageVersionComboBox = this.FindControl <DropDown>("languageVersionComboBox");
            statusBar               = this.FindControl <Border>("statusBar");
            StatusLabel             = this.FindControl <TextBlock>("StatusLabel");
            mainGrid                = this.FindControl <Grid>("mainGrid");
            leftColumn              = mainGrid.ColumnDefinitions[0];
            rightColumn             = mainGrid.ColumnDefinitions[2];

            treeView = this.FindControl <SharpTreeView>("treeView");

            rightPane     = this.FindControl <Grid>("rightPane");
            topPaneRow    = rightPane.RowDefinitions[1];
            textViewRow   = rightPane.RowDefinitions[3];
            bottomPaneRow = rightPane.RowDefinitions[5];

            updatePanel                 = this.FindControl <Border>("updatePanel");
            updatePanelMessage          = this.FindControl <TextBlock>("updatePanelMessage");
            downloadOrCheckUpdateButton = this.FindControl <Button>("downloadOrCheckUpdateButton");
            topPane    = this.FindControl <DockedPane>("topPane");
            mainPane   = this.FindControl <ContentPresenter>("mainPane");
            bottomPane = this.FindControl <DockedPane>("bottomPane");

            CommandBindings.Add(new RoutedCommandBinding(ApplicationCommands.Open, OpenCommandExecuted));
            CommandBindings.Add(new RoutedCommandBinding(ApplicationCommands.Refresh, RefreshCommandExecuted));
            CommandBindings.Add(new RoutedCommandBinding(ApplicationCommands.Save, SaveCommandExecuted));
            CommandBindings.Add(new RoutedCommandBinding(NavigationCommands.BrowseBack, BackCommandExecuted, BackCommandCanExecute));
            CommandBindings.Add(new RoutedCommandBinding(NavigationCommands.BrowseForward, ForwardCommandExecuted, ForwardCommandCanExecute));
            CommandBindings.Add(new RoutedCommandBinding(NavigationCommands.Search, SearchCommandExecuted));
        }
예제 #2
0
        /// <summary>
        /// Enables extensible context menu support for the specified tree view.
        /// </summary>
        public static void Add(SharpTreeView treeView)
        {
            var provider = new ContextMenuProvider(treeView);

            treeView.ContextMenuOpening += provider.treeView_ContextMenuOpening;
            treeView.ContextMenuClosing -= provider.treeView_ContextMenuClosing;
        }
예제 #3
0
        public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null, ListBox listBox = null)
        {
            ReferenceSegment reference;

            if (textView != null)
            {
                reference = textView.GetReferenceSegmentAtMousePosition();
            }
            else if (listBox?.SelectedItem is SearchResult result)
            {
                reference = new ReferenceSegment {
                    Reference = result.Member
                }
            }
            ;
            else
            {
                reference = null;
            }
            var position = textView != null?textView.GetPositionFromMousePosition() : null;

            var selectedTreeNodes = treeView != null?treeView.GetTopLevelSelection().ToArray() : null;

            return(new TextViewContext {
                TreeView = treeView,
                SelectedTreeNodes = selectedTreeNodes,
                TextView = textView,
                Reference = reference,
                Position = position
            });
        }
예제 #4
0
 public static void FillTree(SharpTreeView tree, IEnumerable <NodeBase> rootNodes)
 {
     tree.Root = new SharpTreeNode();
     if (rootNodes != null)
     {
         CreateItems(rootNodes, tree.Root);
     }
 }
예제 #5
0
        /// <summary>
        /// Enables extensible context menu support for the specified tree view.
        /// </summary>
        public static void Add(SharpTreeView treeView)
        {
            var provider = new ContextMenuProvider(treeView);

            treeView.ContextMenuOpening += provider.treeView_ContextMenuOpening;
            // Context menu is shown only when the ContextMenu property is not null before the
            // ContextMenuOpening event handler is called.
            treeView.ContextMenu = new ContextMenu();
        }
예제 #6
0
        public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null)
        {
            var reference = textView != null?textView.GetReferenceSegmentAtMousePosition() : null;

            var selectedTreeNodes = treeView != null?treeView.GetTopLevelSelection().ToArray() : null;

            return(new TextViewContext {
                TreeView = treeView,
                SelectedTreeNodes = selectedTreeNodes,
                TextView = textView,
                Reference = reference
            });
        }
예제 #7
0
        public LocalVarPad()
        {
            var res = new CommonResources();

            res.InitializeComponent();

            tree                    = new SharpTreeView();
            tree.Root               = new SharpTreeNode();
            tree.ShowRoot           = false;
            tree.View               = (GridView)res["variableGridView"];
            tree.ItemContainerStyle = (Style)res["itemContainerStyle"];
            tree.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "50%;25%;25%");

            WindowsDebugger.RefreshingPads += RefreshPad;
            RefreshPad();
        }
예제 #8
0
        /// <summary>
        /// Enables extensible context menu support for the specified tree view.
        /// </summary>
        public static void Add(SharpTreeView treeView, DecompilerTextView textView = null)
        {
            var provider = new ContextMenuProvider(treeView, textView);

            treeView.PointerReleased += provider.treeView_ContextMenuOpening;
            // Context menu is shown only when the ContextMenu property is not null before the
            // ContextMenuOpening event handler is called.
            treeView.ContextMenu = new ContextMenu();
            if (textView != null)
            {
                textView.PointerReleased += provider.textView_ContextMenuOpening;
                // Context menu is shown only when the ContextMenu property is not null before the
                // ContextMenuOpening event handler is called.
                textView.ContextMenu = new ContextMenu();
            }
        }
예제 #9
0
        public static void FillTree(SharpTreeView tree, AssemblyNode module)
        {
            var root = CreateTreeItem(module);

            tree.Root     = root;
            tree.ShowRoot = false;

            var sortedNameSpaces = new List <NamespaceNode>();

            sortedNameSpaces.AddRange(module.Namespaces);
            sortedNameSpaces.Sort((a, b) => String.Compare(a.Name, b.Name));

            foreach (var ns in sortedNameSpaces)
//			foreach (var ns in module.Namespaces)
            {
                var namespaceNode = CreateTreeItem(ns);
                tree.Root.Children.Add(namespaceNode);

                var sortedTypes = new List <TypeNode>();
                sortedTypes.AddRange(ns.Types);
                sortedTypes.Sort((a, b) => String.Compare(a.Name, b.Name));
                foreach (var type in sortedTypes)
                {
                    var typeNode = CreateTreeItem(type);
                    namespaceNode.Children.Add(typeNode);

                    var sortedMethods = new List <MethodNode>();
                    sortedMethods.AddRange(type.Methods);
                    sortedMethods.Sort((a, b) => String.Compare(a.Name, b.Name));
                    foreach (var method in sortedMethods)
                    {
                        var methodName = CreateTreeItem(method);
                        typeNode.Children.Add(methodName);
                    }


                    var sortedFields = new List <FieldNode>();
                    sortedFields.AddRange(type.Fields);
                    sortedFields.Sort((a, b) => String.Compare(a.Name, b.Name));
                    foreach (var field in sortedFields)
                    {
                        var fieldNode = CreateTreeItem(field);
                        typeNode.Children.Add(fieldNode);
                    }
                }
            }
        }
예제 #10
0
        ///// <summary>
        ///// Returns the reference the mouse cursor is currently hovering above.
        ///// Returns null, if there was no reference found.
        ///// </summary>
        //public ReferenceSegment Reference { get; private set; }

        ///// <summary>
        ///// Returns the position in TextView the mouse cursor is currently hovering above.
        ///// Returns null, if TextView returns null;
        ///// </summary>
        //public TextViewPosition? Position { get; private set; }

        public static TextViewContext Create(SharpTreeView treeView = null, ListBox listBox = null)
        {
            //ReferenceSegment reference;
            //if (textView != null)
            //    reference = textView.GetReferenceSegmentAtMousePosition();
            //else if (listBox != null)
            //    reference = new ReferenceSegment { Reference = ((SearchResult)listBox.SelectedItem).Member };
            //else
            //    reference = null;
            //var position = textView != null ? textView.GetPositionFromMousePosition() : null;
            var selectedTreeNodes = treeView != null?treeView.GetTopLevelSelection().ToArray() : null;

            return(new TextViewContext
            {
                TreeView = treeView,
                SelectedTreeNodes = selectedTreeNodes,
                //TextView = textView,
                //Reference = reference,
                //Position = position
            });
        }
예제 #11
0
        public TreeViewImpl(ITreeViewServiceImpl treeViewService, IThemeService themeService, IClassificationFormatMapService classificationFormatMapService, Guid guid, TreeViewOptions options)
        {
            Guid = guid;
            this.treeViewService    = treeViewService;
            treeViewListener        = options.TreeViewListener;
            classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);
            classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
            foregroundBrushResourceKey = options.ForegroundBrushResourceKey ?? "TreeViewForeground";
            sharpTreeView = new SharpTreeView();
            sharpTreeView.SelectionChanged += SharpTreeView_SelectionChanged;
            sharpTreeView.CanDragAndDrop    = options.CanDragAndDrop;
            sharpTreeView.AllowDrop         = options.AllowDrop;
            sharpTreeView.AllowDropOrder    = options.AllowDrop;
            VirtualizingPanel.SetIsVirtualizing(sharpTreeView, options.IsVirtualizing);
            VirtualizingPanel.SetVirtualizationMode(sharpTreeView, options.VirtualizationMode);
            AutomationPeerMemoryLeakWorkaround.SetInitialize(sharpTreeView, true);
            sharpTreeView.SelectionMode   = options.SelectionMode;
            sharpTreeView.BorderThickness = new Thickness(0);
            sharpTreeView.ShowRoot        = false;
            sharpTreeView.ShowLines       = false;

            if (options.IsGridView)
            {
                sharpTreeView.SetResourceReference(ItemsControl.ItemContainerStyleProperty, SharpGridView.ItemContainerStyleKey);
                sharpTreeView.SetResourceReference(FrameworkElement.StyleProperty, "SharpTreeViewGridViewStyle");
            }
            else
            {
                // Clear the value set by the constructor. This is required or our style won't be used.
                sharpTreeView.ClearValue(ItemsControl.ItemContainerStyleProperty);
                sharpTreeView.SetResourceReference(FrameworkElement.StyleProperty, typeof(SharpTreeView));
            }

            sharpTreeView.GetPreviewInsideTextBackground = () => themeService.Theme.GetColor(ColorType.SystemColorsHighlight).Background;
            sharpTreeView.GetPreviewInsideForeground     = () => themeService.Theme.GetColor(ColorType.SystemColorsHighlightText).Foreground;

            // Add the root at the end since Create() requires some stuff to have been initialized
            root = Create(options.RootNode ?? new TreeNodeDataImpl(new Guid(DocumentTreeViewConstants.ROOT_NODE_GUID)));
            sharpTreeView.Root = root.Node;
        }
예제 #12
0
        public WatchPad()
        {
            var res = new CommonResources();

            res.InitializeComponent();

            panel = new Grid();

            toolBar = ToolBarService.CreateToolBar(toolBar, this, "/SharpDevelop/Pads/WatchPad/ToolBar");
            panel.Children.Add(toolBar);

            tree          = new SharpTreeView();
            tree.Root     = new WatchRootNode();
            tree.ShowRoot = false;
            tree.View     = (GridView)res["variableGridView"];
            tree.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "50%;25%;25%");
            tree.MouseDoubleClick += delegate(object sender, MouseButtonEventArgs e) {
                if (this.tree.SelectedItem == null)
                {
                    AddWatch(focus: true);
                }
            };
            panel.Children.Add(tree);

            panel.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            panel.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });

            Grid.SetRow(tree, 1);

//			ProjectService.SolutionLoaded  += delegate { LoadNodes(); };
//			SD.ProjectService.CurrentSolution.PreferencesSaving += delegate { SaveNodes(); };
//			LoadNodes();

            WindowsDebugger.RefreshingPads += RefreshPad;
            RefreshPad();
        }
예제 #13
0
        public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null, ListBox listBox = null, TabControl tabControl = null, HexBox hexBox = null, bool openedFromKeyboard = false)
        {
            TextViewPosition?position = null;

            if (textView != null)
            {
                position = openedFromKeyboard ? textView.TextEditor.TextArea.Caret.Position : textView.GetPositionFromMousePosition();
            }
            ReferenceSegment reference;

            if (textView != null)
            {
                reference = textView.GetReferenceSegmentAt(position);
            }
            else if (listBox != null && listBox.SelectedItem is SearchResult)
            {
                reference = new ReferenceSegment {
                    Reference = ((SearchResult)listBox.SelectedItem).MDTokenProvider
                }
            }
            ;
            else
            {
                reference = null;
            }
            var selectedTreeNodes = treeView != null?treeView.GetTopLevelSelection().ToArray() : null;

            return(new TextViewContext {
                TreeView = treeView,
                SelectedTreeNodes = selectedTreeNodes,
                TextView = textView,
                TabControl = tabControl,
                HexBox = hexBox,
                ListBox = listBox,
                Reference = reference,
                Position = position,
                OpenedFromKeyboard = openedFromKeyboard,
            });
        }
예제 #14
0
        public TreeViewImpl(ITreeViewManager treeViewManager, IThemeManager themeManager, IImageManager imageManager, Guid guid, TreeViewOptions options)
        {
            this.Guid             = guid;
            this.treeViewManager  = treeViewManager;
            this.imageManager     = imageManager;
            this.treeViewListener = options.TreeViewListener;
            this.sharpTreeView    = new SharpTreeView();
            this.sharpTreeView.SelectionChanged += SharpTreeView_SelectionChanged;
            this.sharpTreeView.CanDragAndDrop    = options.CanDragAndDrop;
            this.sharpTreeView.AllowDrop         = options.AllowDrop;
            this.sharpTreeView.AllowDropOrder    = options.AllowDrop;
            VirtualizingStackPanel.SetIsVirtualizing(this.sharpTreeView, options.IsVirtualizing);
            VirtualizingStackPanel.SetVirtualizationMode(this.sharpTreeView, options.VirtualizationMode);
            this.sharpTreeView.SelectionMode   = options.SelectionMode;
            this.sharpTreeView.BorderThickness = new Thickness(0);
            this.sharpTreeView.ShowRoot        = false;
            this.sharpTreeView.ShowLines       = false;

            if (options.IsGridView)
            {
                this.sharpTreeView.ItemContainerStyle = (Style)Application.Current.FindResource(SharpGridView.ItemContainerStyleKey);
                this.sharpTreeView.Style = (Style)Application.Current.FindResource("SharpTreeViewGridViewStyle");
            }
            else
            {
                // Clear the value set by the constructor. This is required or our style won't be used.
                this.sharpTreeView.ClearValue(ItemsControl.ItemContainerStyleProperty);
                this.sharpTreeView.Style = (Style)Application.Current.FindResource(typeof(SharpTreeView));
            }

            this.sharpTreeView.GetPreviewInsideTextBackground = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlight).Background;
            this.sharpTreeView.GetPreviewInsideForeground     = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlightText).Foreground;

            // Add the root at the end since Create() requires some stuff to have been initialized
            this.root = Create(options.RootNode ?? new TreeNodeDataImpl(new Guid(FileTVConstants.ROOT_NODE_GUID)));
            this.sharpTreeView.Root = this.root.Node;
        }
예제 #15
0
 /// <summary>
 /// TreeView助手
 /// </summary>
 /// <param name="TreeView"></param>
 public TreeViewHelper(SharpTreeView TreeView)
 {
     _TreeView = TreeView;
 }
예제 #16
0
 public UpdateLock(SharpTreeView instance)
 {
     this.instance = instance;
     this.instance.updatesLocked = true;
 }
예제 #17
0
 private ContextMenuProvider(SharpTreeView treeView)
 {
     this.treeView = treeView;
     App.CompositionContainer.ComposeParts(this);
 }
예제 #18
0
 ContextMenuProvider(SharpTreeView treeView)
 {
     this.treeView = treeView;
     this.textView = null;
 }
예제 #19
0
 static void InitializeTreeView(SharpTreeView treeView)
 {
     treeView.GetPreviewInsideTextBackground = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlight).Background;
     treeView.GetPreviewInsideForeground     = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlightText).Foreground;
 }
예제 #20
0
        public static void ClearSort(this SharpTreeView treeView)
        {
            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(treeView.ItemsSource);

            view.SortDescriptions.Clear();
        }
예제 #21
0
 ContextMenuProvider(DecompilerTextView textView)
 {
     this.treeView = null;
     this.textView = textView;
 }
예제 #22
0
 ContextMenuProvider(SharpTreeView treeView, DecompilerTextView textView = null)
 {
     this.treeView = treeView;
     this.textView = textView;
     App.CompositionContainer.ComposeParts(this);
 }
예제 #23
0
 ContextMenuProvider(SharpTreeView treeView)
     : this()
 {
     this.treeView = treeView ?? throw new ArgumentNullException(nameof(treeView));
 }
예제 #24
0
        public static void AddSort(this SharpTreeView treeView, SortDescription item)
        {
            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(treeView.ItemsSource);

            view.SortDescriptions.Add(item);
        }
예제 #25
0
 ContextMenuProvider(SharpTreeView treeView, DecompilerTextView textView = null) : this()
 {
     this.treeView = treeView;
     this.textView = textView;
 }
예제 #26
0
        public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null, ListBox listBox = null, DataGrid dataGrid = null)
        {
            ReferenceSegment reference;

            if (textView != null)
            {
                reference = textView.GetReferenceSegmentAtMousePosition();
            }
            else if (listBox?.SelectedItem is SearchResult result)
            {
                reference = new ReferenceSegment {
                    Reference = result.Reference
                }
            }
            ;
            else if (listBox?.SelectedItem is TreeNodes.IMemberTreeNode provider)
            {
                reference = new ReferenceSegment {
                    Reference = provider.Member
                }
            }
            ;
            else if (listBox?.SelectedItem != null)
            {
                reference = new ReferenceSegment {
                    Reference = listBox.SelectedItem
                }
            }
            ;
            else if (dataGrid?.SelectedItem is TreeNodes.IMemberTreeNode provider2)
            {
                reference = new ReferenceSegment {
                    Reference = provider2.Member
                }
            }
            ;
            else if (dataGrid?.SelectedItem != null)
            {
                reference = new ReferenceSegment {
                    Reference = dataGrid.SelectedItem
                }
            }
            ;
            else
            {
                reference = null;
            }
            var position = textView != null?textView.GetPositionFromMousePosition() : null;

            var selectedTreeNodes = treeView != null?treeView.GetTopLevelSelection().ToArray() : null;

            return(new TextViewContext {
                ListBox = listBox,
                DataGrid = dataGrid,
                TreeView = treeView,
                SelectedTreeNodes = selectedTreeNodes,
                TextView = textView,
                Reference = reference,
                Position = position,
                MousePosition = ((Visual)textView ?? treeView ?? (Visual)listBox ?? dataGrid).PointToScreen(Mouse.GetPosition((IInputElement)textView ?? treeView ?? (IInputElement)listBox ?? dataGrid))
            });
        }
예제 #27
0
        public Project()
        {
            //List<ClassA> listOfClassA = new List<ClassA>();
            //ClassA classA1 = new ClassA();
            //classA1.Label = "Class A-1";
            //classA1.ToolTip = "This is Class A-1";
            //ClassB classB11 = new ClassB();
            //classB11.Label = "Class B-1-1";
            //classB11.ToolTip = "This is Class B-1-1";
            //classA1.ListOfClassB.Add(classB11);
            //ClassB classB12 = new ClassB();
            //classB12.Label = "Class B-1-2";
            //classB12.ToolTip = "This is Class B-1-2";
            //classA1.ListOfClassB.Add(classB12);
            //ClassC classC11 = new ClassC();
            //classC11.Label = "Class C-1-1";
            //classC11.ToolTip = "This is Class C-1-1";
            //classA1.ListOfClassC.Add(classC11);
            //ClassC classC12 = new ClassC();
            //classC12.Label = "Class C-1-2";
            //classC12.ToolTip = "This is Class C-1-2";
            //Item item121 = new Item();
            //item121.Label = "Rocky Road";
            //item121.ToolTip = "Rocky Road";
            //classC12.IceCream.Add(item121);
            //Item item122 = new Item();
            //item122.Label = "Chocolate";
            //item122.ToolTip = "Chocolate";
            //classC12.IceCream.Add(item122);
            //classA1.ListOfClassC.Add(classC12);
            //listOfClassA.Add(classA1);

            List <Bridge> bridge = new List <Bridge>();
            Bridge        b      = new Bridge()
            {
                BridgeName = "Bridge No.1"
            };

            bridge.Add(b);
            //Bridge b2 = new Bridge() { BridgeName = "Bridge No.2" };
            //bridge.Add(b2);

            _myTreeViewViewModel = new MyTreeViewViewModel
            {
                ItemsSource = bridge
            };

            //var firstNode = new ProjectItem { Name = "Bridge No.1", Color = Brushes.Red};
            //var first1 = new ProjectItem { Name = "Bridge No.1", Color = Brushes.Red, ItemType = ItemType.Folder };
            //var first2 = new ProjectItem { Name = "element2 (Drop Allowed)",
            //    AllowDrop = true, ItemType = ItemType.Note };
            //var first11 = new ProjectItem { Name = "Properties", ItemType = ItemType.Properties, AllowDrag = true };
            //var first12 = new ProjectItem { Name = "References", AllowDrag = true };
            //var first13 = new ProjectItem { Name = "General", AllowInsert = true, ItemType = ItemType.Folder};

            //firstNode.Children.Add(first1);
            //firstNode.Children.Add(first2);
            //first1.Children.Add(first11);
            //first1.Children.Add(first12);
            //first1.Children.Add(first13);

            DataContext = MyTreeViewViewModel;
            InitializeComponent();
            this.TreeView = Tree;

            BridgeProject.Items.Bridge br = new BridgeProject.Items.Bridge();

            ICSharpCode.TreeView.SharpTreeView Tree2 = new SharpTreeView();

            //BridgeListNode n = new BridgeListNode();
            //BridgeNode n1 = new BridgeNode(br) { Text = "B1"};
            //BridgeNode n2 = new BridgeNode(br) { Text = "Abutment2" };
            //BridgeNode n3 = new BridgeNode(br) { Text = "Abutment2" };

            //n2.Children.Add(n3);
            //n.Children.Add(n1);
            //n.Children.Add(n2);
            //Tree2.Root = n;
            //this.Content = Tree2;
        }