-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
976cd37
commit 65bd3ed
Showing
3 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<vsui:DialogWindow x:Class="SonarLint.VisualStudio.Integration.Muting.MuteWindowDialog" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:SonarLint.VisualStudio.Integration.Muting" | ||
xmlns:vsui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0" | ||
mc:Ignorable="d" | ||
SizeToContent="WidthAndHeight"> | ||
<Grid Height="350" Width="500"> | ||
<Border BorderBrush="Black" Name="BorderWontFix" BorderThickness="1" HorizontalAlignment="Left" Height="75" Margin="25,25,0,0" VerticalAlignment="Top" Width="450" Visibility="{Binding WontFixVisibility}"> | ||
<Grid> | ||
<RadioButton Name="rbWontFix" GroupName="Transitions" Content="Won't Fix" VerticalAlignment="Top" Margin="10,16,-10,0" FontWeight="Bold" Grid.ColumnSpan="2" Checked="RadioButton_Checked"/> | ||
<Label Content="The issue is valid but does not need fixing. It represents accepted technical debt." HorizontalAlignment="Left" Margin="10,36,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> | ||
</Grid> | ||
</Border> | ||
|
||
<Border BorderBrush="Black" Name="BorderAccept" BorderThickness="1" HorizontalAlignment="Left" Height="75" Margin="25,25,0,0" VerticalAlignment="Top" Width="450" Visibility="{Binding AcceptVisibility}"> | ||
<Grid> | ||
<RadioButton Name="rbAccept" GroupName="Transitions" Content="Accept" VerticalAlignment="Top" Margin="10,16,-10,0" FontWeight="Bold" Grid.ColumnSpan="2" Checked="RadioButton_Checked"/> | ||
<Label Content="The issue is valid but does not need fixing. It represents accepted technical debt." HorizontalAlignment="Left" Margin="10,36,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> | ||
</Grid> | ||
</Border> | ||
|
||
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="75" Margin="25 | ||
,115,0,0" VerticalAlignment="Top" Width="450"> | ||
<Grid> | ||
<RadioButton x:Name="rbFalsePositive" GroupName="Transitions" Content="False Positive" VerticalAlignment="Top" Margin="10,16,-10,0" FontWeight="Bold" Grid.ColumnSpan="2" Checked="RadioButton_Checked"/> | ||
<Label Content="The issue is raised unxpectedly on code that should not trigger an issue." HorizontalAlignment="Left" Margin="10,36,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> | ||
</Grid> | ||
</Border> | ||
<Label Content="Add a comment (optional):" HorizontalAlignment="Left" Margin="25,200,0,0" VerticalAlignment="Top"/> | ||
<TextBox Name="txtComment" HorizontalAlignment="Center" Height="60" Margin="0,225,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="450"/> | ||
<Button Name="Cancel" Content="Cancel" Padding="5,1" HorizontalAlignment="Left" Margin="300,300,0,0" VerticalAlignment="Top" Click="Cancel_Click"/> | ||
<Button Name="Submit" Content="Mark Issue as..." Padding="5,1" HorizontalAlignment="Left" Margin="360,300,0,0" VerticalAlignment="Top" Click="Submit_Click"> | ||
<Button.Style> | ||
<Style TargetType="Button"> | ||
|
||
<Setter Property="IsEnabled" Value="False"/> | ||
|
||
<Style.Triggers> | ||
|
||
<DataTrigger Binding="{Binding Path=IsChecked, ElementName=rbWontFix}" Value="True"> | ||
<Setter Property="IsEnabled" Value="True"/> | ||
</DataTrigger> | ||
|
||
<DataTrigger Binding="{Binding Path=IsChecked, ElementName=rbAccept}" Value="True"> | ||
<Setter Property="IsEnabled" Value="True"/> | ||
</DataTrigger> | ||
|
||
<DataTrigger Binding="{Binding Path=IsChecked, ElementName=rbFalsePositive}" Value="True"> | ||
<Setter Property="IsEnabled" Value="True"/> | ||
</DataTrigger> | ||
|
||
</Style.Triggers> | ||
</Style> | ||
</Button.Style> | ||
</Button> | ||
</Grid> | ||
</vsui:DialogWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* SonarLint for Visual Studio | ||
* Copyright (C) 2016-2023 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
using System.Windows; | ||
using System.Windows.Markup; | ||
using Microsoft.VisualStudio.PlatformUI; | ||
using SonarQube.Client.Models; | ||
|
||
namespace SonarLint.VisualStudio.Integration.Muting | ||
{ | ||
/// <summary> | ||
/// Interaction logic for UserControl1.xaml | ||
/// </summary> | ||
[ContentProperty(nameof(MuteWindowDialog))] | ||
public partial class MuteWindowDialog : DialogWindow | ||
{ | ||
public MuteWindowDialog(bool showAccept) | ||
{ | ||
InitializeComponent(); | ||
|
||
NewMethod(showAccept); | ||
} | ||
|
||
private void NewMethod(bool showAccept) | ||
{ | ||
BorderWontFix.Visibility = showAccept ? Visibility.Hidden : Visibility.Visible; | ||
BorderAccept.Visibility = showAccept ? Visibility.Visible : Visibility.Hidden; | ||
} | ||
|
||
private void Cancel_Click(object sender, RoutedEventArgs e) | ||
{ | ||
this.DialogResult = false; | ||
} | ||
|
||
private void Submit_Click(object sender, RoutedEventArgs e) | ||
{ | ||
this.DialogResult = true; | ||
} | ||
|
||
public SonarQubeIssueTransition SelectedIssueTransition { get; private set; } | ||
|
||
public string Comment => txtComment.Text; | ||
|
||
private void RadioButton_Checked(object sender, RoutedEventArgs e) | ||
{ | ||
switch (sender) | ||
{ | ||
case var value when value == rbWontFix: | ||
SelectedIssueTransition = SonarQubeIssueTransition.WontFix; | ||
break; | ||
|
||
case var value when value == rbAccept: | ||
SelectedIssueTransition = SonarQubeIssueTransition.Accept; | ||
break; | ||
|
||
case var value when value == rbFalsePositive: | ||
SelectedIssueTransition = SonarQubeIssueTransition.FalsePositive; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
} | ||
} | ||
} |