Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy file path and show in file explorer implemented #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions DependenciesGui/DependencyWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
<RoutedUICommand x:Key="DoExpandAllNodes" Text="Expand All" />
<RoutedUICommand x:Key="DoCollapseAllNodes" Text="Collapse All" />
<RoutedUICommand x:Key="DoFindModuleInList" Text="Highlight Matching Module In List" />
<RoutedUICommand x:Key="CopyFilePath" Text="Copy File Path" />
<RoutedUICommand x:Key="OpenInExplorer" Text="Open in File Explorer" />

<ContextMenu x:Key="TreeItemContextMenu">
<MenuItem Header="Highlight Matching Module In List"
Expand All @@ -59,10 +61,14 @@
IsEnabled="True" />
<Separator Height="3" Margin="-1,0,0,0"/>
<MenuItem Header="Copy File Path"
Command="{Binding Path=DataContext.MoreInfo, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}}"
Command="{StaticResource CopyFilePath}"
Background="WhiteSmoke"
InputGestureText="Ctrl+C"
IsEnabled="False" />
IsEnabled="True" />
<MenuItem Header="Open in File Explorer"
Command="{StaticResource OpenInExplorer}"
Background="WhiteSmoke"
IsEnabled="True" />
<Separator Height="3" Margin="-1,0,0,0"/>
<MenuItem Header="Expand All"
Command="{StaticResource DoExpandAllNodes}"
Expand Down Expand Up @@ -171,6 +177,8 @@
<CommandBinding Command="{StaticResource DoExpandAllNodes}" Executed="ExpandAllNodes_Executed"/>
<CommandBinding Command="{StaticResource DoCollapseAllNodes}" Executed="CollapseAllNodes_Executed"/>
<CommandBinding Command="{StaticResource DoFindModuleInList}" Executed="DoFindModuleInList_Executed"/>
<CommandBinding Command="{StaticResource CopyFilePath}" Executed="CopyFilePath_Executed"/>
<CommandBinding Command="{StaticResource OpenInExplorer}" Executed="OpenInExplorer_Executed"/>
</TreeView.CommandBindings>
</TreeView>

Expand Down
22 changes: 22 additions & 0 deletions DependenciesGui/DependencyWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,28 @@ private void DoFindModuleInList_Executed(object sender, ExecutedRoutedEventArgs
}
}

private void CopyFilePath_Executed(object sender, ExecutedRoutedEventArgs e)
{
ModuleTreeViewItem Source = e.Source as ModuleTreeViewItem;
String SelectedModuleName = Source.GetTreeNodeHeaderName(Dependencies.Properties.Settings.Default.FullPath);
if (Source == null)
return;

Clipboard.SetText(SelectedModuleName);
}

private void OpenInExplorer_Executed(object sender, ExecutedRoutedEventArgs e)
{
ModuleTreeViewItem Source = e.Source as ModuleTreeViewItem;
if (Source == null)
return;

String SelectedModuleName = Source.GetTreeNodeHeaderName(Dependencies.Properties.Settings.Default.FullPath);
String commandParameter = "/select,\"" + SelectedModuleName + "\"";

Process.Start("explorer.exe", commandParameter);
}

private void ExpandAllParentNode(ModuleTreeViewItem Item)
{
if (Item != null)
Expand Down