Skip to content
Merged
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
5 changes: 4 additions & 1 deletion Dashboard/Controls/PlanViewerControl.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<UserControl x:Class="PerformanceMonitorDashboard.Controls.PlanViewerControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="{DynamicResource BackgroundBrush}">
Background="{DynamicResource BackgroundBrush}"
Focusable="True"
PreviewMouseDown="PlanViewerControl_PreviewMouseDown"
PreviewKeyDown="PlanViewerControl_PreviewKeyDown">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
Expand Down
32 changes: 32 additions & 0 deletions Dashboard/Controls/PlanViewerControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,38 @@ private void PlanScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventAr
}
}

private void PlanViewerControl_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
Focus();
}

private void PlanViewerControl_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.V && Keyboard.Modifiers == ModifierKeys.Control
&& e.OriginalSource is not TextBox)
{
var text = Clipboard.GetText();
if (!string.IsNullOrWhiteSpace(text))
{
e.Handled = true;
try
{
System.Xml.Linq.XDocument.Parse(text);
}
catch (System.Xml.XmlException ex)
{
MessageBox.Show(
$"The plan XML is not valid:\n\n{ex.Message}",
"Invalid Plan XML",
MessageBoxButton.OK,
MessageBoxImage.Warning);
return;
}
LoadPlan(text, "Pasted Plan");
}
}
}

#endregion

#region Save & Statement Selection
Expand Down
8 changes: 6 additions & 2 deletions Dashboard/Controls/QueryPerformanceContent.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@
<MenuItem.Icon><TextBlock Text="📊"/></MenuItem.Icon>
</MenuItem>
<Separator/>
<MenuItem Header="View Plan" Click="ViewEstimatedPlan_Click"/>
<MenuItem Header="Get Actual Plan" Click="GetActualPlan_Click"/>
<MenuItem Header="View Plan" Click="ViewEstimatedPlan_Click">
<MenuItem.Icon><TextBlock Text="🔍"/></MenuItem.Icon>
</MenuItem>
<MenuItem Header="Get Actual Plan" Click="GetActualPlan_Click">
<MenuItem.Icon><TextBlock Text="▶"/></MenuItem.Icon>
</MenuItem>
</ContextMenu>

<Style x:Key="DefaultRowStyle" TargetType="DataGridRow">
Expand Down
10 changes: 10 additions & 0 deletions Dashboard/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@
</Border>
</Grid>
</Button>
<Button x:Name="OpenPlanViewerButton"
Click="OpenPlanViewer_Click"
Height="32"
Margin="0,0,0,8"
ToolTip="Open or paste an execution plan (independent of any server)">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#x1F50D;" FontSize="12" VerticalAlignment="Center" Margin="0,0,6,0"/>
<TextBlock Text="Open Plan Viewer" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<Separator Margin="0,0,0,8"/>
<Button x:Name="RefreshAllButton"
Content="&#x21BB; Refresh All Status"
Expand Down
Loading
Loading