コード例 #1
0
ファイル: SharpTreeView.cs プロジェクト: NS2CDT/PerfAnalyzer
        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;
        }
コード例 #2
0
        static void HandleExecuted_Delete(object sender, ExecutedRoutedEventArgs e)
        {
            SharpTreeView treeView = (SharpTreeView)sender;

            foreach (SharpTreeNode node in treeView.GetTopLevelSelection().ToArray())
            {
                node.Delete();
            }
        }
コード例 #3
0
ファイル: ContextMenuEntry.cs プロジェクト: KAW0/Alter-Native
		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
			};
		}
コード例 #4
0
ファイル: SharpTreeView.cs プロジェクト: NS2CDT/PerfAnalyzer
        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);
            }
        }
コード例 #5
0
ファイル: ContextMenuEntry.cs プロジェクト: JamesLinus/ILSpy
		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
			};
		}
コード例 #6
0
ファイル: SharpTreeView.cs プロジェクト: yuryleb/ILSpy
        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));
            }
        }
コード例 #7
0
ファイル: SharpTreeView.cs プロジェクト: yuryleb/ILSpy
        static void HandleCanExecute_Delete(object sender, CanExecuteRoutedEventArgs e)
        {
            SharpTreeView treeView = (SharpTreeView)sender;

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