Esempio n. 1
0
        static void HandleCanExecute_Delete(object sender, CanExecuteRoutedEventArgs e)
        {
            SharpTreeView treeView = (SharpTreeView)sender;
            var           nodes    = treeView.GetTopLevelSelection().ToArray();

            e.CanExecute = nodes.Length > 0 && nodes[0].CanDelete(nodes);
            e.Handled    = true;
        }
Esempio n. 2
0
        static void HandleExecuted_Delete(object sender, ExecutedRoutedEventArgs e)
        {
            SharpTreeView treeView = (SharpTreeView)sender;

            foreach (SharpTreeNode node in treeView.GetTopLevelSelection().ToArray())
            {
                node.Delete();
            }
        }
Esempio n. 3
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
			};
		}
Esempio n. 4
0
        static void HandleExecuted_Delete(object sender, ExecutedRoutedEventArgs e)
        {
            e.Handled = true;
            SharpTreeView treeView = (SharpTreeView)sender;
            var           nodes    = treeView.GetTopLevelSelection().ToArray();

            if (nodes.Length > 0)
            {
                nodes[0].Delete(nodes);
            }
        }
Esempio n. 5
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 != 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
			};
		}
Esempio n. 6
0
        static void HandleExecuted_Delete(object sender, ExecutedRoutedEventArgs e)
        {
            SharpTreeView treeView = (SharpTreeView)sender;

            treeView.updatesLocked = true;
            int selectedIndex = -1;

            try {
                foreach (SharpTreeNode node in treeView.GetTopLevelSelection().ToArray())
                {
                    if (selectedIndex == -1)
                    {
                        selectedIndex = treeView.flattener.IndexOf(node);
                    }
                    node.Delete();
                }
            } finally {
                treeView.updatesLocked = false;
                treeView.UpdateFocusedNode(null, Math.Max(0, selectedIndex - 1));
            }
        }
Esempio n. 7
0
        static void HandleCanExecute_Delete(object sender, CanExecuteRoutedEventArgs e)
        {
            SharpTreeView treeView = (SharpTreeView)sender;

            e.CanExecute = treeView.GetTopLevelSelection().All(node => node.CanDelete());
        }