Skip to content

Commit

Permalink
Fixes #215 Copy Database Name
Browse files Browse the repository at this point in the history
  • Loading branch information
dgosbell committed Sep 1, 2019
1 parent 039b962 commit b9935c5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/DaxStudio.UI/ViewModels/MetadataPaneViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,20 @@ public string ShowHiddenObjectsLabel
}
}

public void CopyDatabaseName()
{
try
{
Clipboard.SetText(SelectedDatabase.Name);
EventAggregator.PublishOnUIThreadAsync(new OutputMessage(MessageType.Information, $"Copied Database Name '{SelectedDatabase.Name}' to clipboard"));
}
catch (Exception ex)
{
Log.Error(ex, "{Class} {Method} {Message}", "MetadataPaneViewModel", "CopyDatabase", ex.Message);
EventAggregator.PublishOnUIThreadAsync(new OutputMessage(MessageType.Error, $"The following Error occured while copying the database name to the clipboard - {ex.Message} "));
}

}

public void ColumnTooltipOpening(TreeViewColumn column)
{
Expand Down
9 changes: 9 additions & 0 deletions src/DaxStudio.UI/Views/MetadataPaneView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Copy" cal:Message.Attach="[Event Click] = [Action CopyDatabaseName()]">
<MenuItem.Icon>
<Image Source="{StaticResource CopyIcon}"/>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<!-- SelectedValuePath="Name" -->
<!-- Model Dropdown -->
Expand Down

0 comments on commit b9935c5

Please sign in to comment.