9 changed files with 231 additions and 245 deletions
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
<UserControl x:Class="ICSharpCode.SharpDevelop.Gui.OptionPanels.TreatErrorsAndWarnings" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> |
||||
|
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="Auto"></ColumnDefinition> |
||||
<ColumnDefinition Width="*"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<optionpanels:StorageLocationPicker Grid.Row="1" Location="{Binding TreatWarningsAsErrors.Location}"> |
||||
</optionpanels:StorageLocationPicker> |
||||
|
||||
<RadioButton x:Name="noneRadioButton" Grid.Column="1" VerticalAlignment="Center" Margin="3,0,3,0" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.None}"></RadioButton> |
||||
|
||||
<RadioButton x:Name="specificWarningsRadioButton" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="3,0,3,0" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.Specific}"></RadioButton> |
||||
|
||||
<TextBox x:Name="specificWarningsTextBox" Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" |
||||
Margin="3,0,3,0" |
||||
IsEnabled="{Binding ElementName=specificWarningsRadioButton, Path=IsChecked}" |
||||
Text="{Binding WarningsAsErrors.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> |
||||
|
||||
<RadioButton x:Name="allRadioButton" Grid.Row="2" Grid.Column="1" |
||||
Margin="3,0,3,0" |
||||
VerticalAlignment="Center" |
||||
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.All}"></RadioButton> |
||||
</Grid> |
||||
</UserControl> |
||||
@ -0,0 +1,102 @@
@@ -0,0 +1,102 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 20.09.2012 |
||||
* Time: 19:38 |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for ErrorsAndWarnings.xaml
|
||||
/// </summary>
|
||||
|
||||
|
||||
public partial class TreatErrorsAndWarnings : UserControl |
||||
{ |
||||
private ProjectOptionPanel projectOptions; |
||||
|
||||
public TreatErrorsAndWarnings() |
||||
{ |
||||
InitializeComponent(); |
||||
this.DataContext = this; |
||||
} |
||||
|
||||
#region properties
|
||||
|
||||
|
||||
public ProjectOptionPanel.ProjectProperty<bool> TreatWarningsAsErrors { |
||||
get {return projectOptions.GetProperty("TreatWarningsAsErrors", false); } |
||||
} |
||||
|
||||
|
||||
public ProjectOptionPanel.ProjectProperty<string> WarningsAsErrors { |
||||
get {return projectOptions.GetProperty("WarningsAsErrors","",TextBoxEditMode.EditRawProperty ); } |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public void SetProjectOptions (ProjectOptionPanel projectOptions) |
||||
{ |
||||
if (projectOptions == null) { |
||||
throw new ArgumentNullException("projectOptions"); |
||||
} |
||||
this.projectOptions = projectOptions; |
||||
SetTreatWarningAsErrorRadioButtons(); |
||||
} |
||||
|
||||
|
||||
private void SetTreatWarningAsErrorRadioButtons() |
||||
{ |
||||
if (this.TreatWarningsAsErrors.Value) { |
||||
this.allRadioButton.IsChecked = true; |
||||
} else { |
||||
if (WarningsAsErrors.Value.Length > 0) { |
||||
this.specificWarningsRadioButton.IsChecked = true; |
||||
} else { |
||||
this.noneRadioButton.IsChecked = true; |
||||
} |
||||
} |
||||
this.noneRadioButton.Checked += ErrorButton_Checked; |
||||
this.allRadioButton.Checked += ErrorButton_Checked; |
||||
this.specificWarningsRadioButton.Checked += ErrorButton_Checked; |
||||
} |
||||
|
||||
|
||||
public void SaveTreatWarningAsErrorRadioButtons() |
||||
{ |
||||
if ((bool)this.noneRadioButton.IsChecked){ |
||||
this.specificWarningsTextBox.Text = string.Empty; |
||||
} |
||||
|
||||
if ((bool)this.allRadioButton.IsChecked) { |
||||
this.TreatWarningsAsErrors.Value = true; |
||||
} else { |
||||
this.TreatWarningsAsErrors.Value = false; |
||||
} |
||||
this.noneRadioButton.Checked -= ErrorButton_Checked; |
||||
this.allRadioButton.Checked -= ErrorButton_Checked; |
||||
this.specificWarningsRadioButton.Checked -= ErrorButton_Checked; |
||||
} |
||||
|
||||
|
||||
void ErrorButton_Checked(object sender, System.Windows.RoutedEventArgs e) |
||||
{ |
||||
projectOptions.IsDirty = true; |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue