Browse Source

fix bug in DebugOptions

pull/18/head
Siegfried Pammer 14 years ago
parent
commit
061a11ab76
  1. 45
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml
  2. 7
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs
  3. 48
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/StorageLocationConverter.cs
  4. 2
      src/Main/Base/Project/Src/Project/Behaviors/DotNetStartBehavior.cs

45
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml

@ -5,12 +5,14 @@ @@ -5,12 +5,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels"
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels"
xmlns:projects="clr-namespace:ICSharpCode.SharpDevelop.Project"
>
<optionpanels:ProjectOptionPanel.Resources>
<local:StorageLocationConverter x:Key="converter"/>
<local:StartActionToBooleanConverter x:Key="startActionToBool"/>
</optionpanels:ProjectOptionPanel.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="130"></RowDefinition>
@ -45,40 +47,43 @@ @@ -45,40 +47,43 @@
VerticalAlignment="Center">
<optionpanels:StorageLocationPicker.Location>
<MultiBinding Converter="{StaticResource converter}">
<Binding Path="StartAction.Location"/>
<Binding Path="StartProgram.Location"/>
<Binding Path="StartURL.Location"/>
</MultiBinding>
</optionpanels:StorageLocationPicker.Location>
</optionpanels:StorageLocationPicker>
<RadioButton IsChecked="True"
<RadioButton IsChecked="{Binding StartAction.Value, Converter={StaticResource startActionToBool}, ConverterParameter={x:Static projects:StartAction.Project}}"
Grid.Column="1" VerticalAlignment="Center"
Margin="4,0,0,0" Content="Start Project">
</RadioButton>
<RadioButton x:Name="startexternal"
Grid.Row="1" VerticalAlignment="Center" Grid.Column="1" Margin="4,0,0,0"
Content="Start external program:">
Grid.Row="1" VerticalAlignment="Center" Grid.Column="1" Margin="4,0,0,0"
IsChecked="{Binding StartAction.Value, Converter={StaticResource startActionToBool}, ConverterParameter={x:Static projects:StartAction.Program}}"
Content="Start external program:">
</RadioButton>
<RadioButton x:Name="startUrl"
Grid.Row="2" VerticalAlignment="Center" Grid.Column="1" Margin="4,0,0,0"
Content="Start browser in URL:">
Grid.Row="2" VerticalAlignment="Center" Grid.Column="1" Margin="4,0,0,0"
IsChecked="{Binding StartAction.Value, Converter={StaticResource startActionToBool}, ConverterParameter={x:Static projects:StartAction.StartURL}}"
Content="Start browser in URL:">
</RadioButton>
<TextBox Grid.Row="1" Grid.Column="2" Margin="5"
IsEnabled="{Binding ElementName=startexternal, Path=IsChecked}"
Text="{Binding StartProgram.Value, UpdateSourceTrigger=PropertyChanged}">
IsEnabled="{Binding ElementName=startexternal, Path=IsChecked}"
Text="{Binding StartProgram.Value, UpdateSourceTrigger=PropertyChanged}">
</TextBox>
<Button Grid.Row="1" Grid.Column="3" Margin="5" Content="..."
IsEnabled="{Binding ElementName=startexternal, Path=IsChecked}"
Click="ExternalProgramButton_Click">
</Button>
<TextBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="5"
IsEnabled="{Binding ElementName=startUrl, Path=IsChecked}"
Text="{Binding StartURL.Value, UpdateSourceTrigger=PropertyChanged}" >
IsEnabled="{Binding ElementName=startUrl, Path=IsChecked}"
Text="{Binding StartURL.Value, UpdateSourceTrigger=PropertyChanged}" >
</TextBox>
</Grid>
@ -90,7 +95,7 @@ @@ -90,7 +95,7 @@
Grid.Column="0"
Grid.Row="1"
Grid.ColumnSpan="3"
Margin="0,5,0,0"
Margin="0,5,0,0"
HorizontalAlignment="Stretch">
<Grid>
<Grid.RowDefinitions>
@ -104,7 +109,7 @@ @@ -104,7 +109,7 @@
<ColumnDefinition Width="40"></ColumnDefinition>
</Grid.ColumnDefinitions>
<optionpanels:StorageLocationPicker
Grid.Row="1" Grid.RowSpan="2" VerticalAlignment="Center">
<optionpanels:StorageLocationPicker.Location>
@ -115,10 +120,10 @@ @@ -115,10 +120,10 @@
</optionpanels:StorageLocationPicker.Location>
</optionpanels:StorageLocationPicker>
<Label Content="Command line" Grid.Column="1" VerticalAlignment="Center" Margin="4,0,0,0" ></Label>
<Label Content="Command line" Grid.Column="1" VerticalAlignment="Center" Margin="4,0,0,0" ></Label>
<Label Content="Working directory:" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="4,0,0,0"></Label>
<TextBox Grid.Column="2" Grid.ColumnSpan="2" Margin="5"
Text="{Binding StartArguments.Value, UpdateSourceTrigger=PropertyChanged}">
</TextBox>
@ -126,8 +131,8 @@ @@ -126,8 +131,8 @@
<TextBox Grid.Row="1" Grid.Column="2" Margin="5"
Text="{Binding StartWorkingDirectory.Value, UpdateSourceTrigger=PropertyChanged}">
</TextBox>
<Button Grid.Row="1" Grid.Column="3" Margin="5"
<Button Grid.Row="1" Grid.Column="3" Margin="5"
Click="BrwoseForFolder_Click"
Content="...">
</Button>

7
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs

@ -31,6 +31,13 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -31,6 +31,13 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
InitializeComponent();
}
public ProjectProperty<StartAction> StartAction
{
get
{
return GetProperty<StartAction>("StartAction", Project.StartAction.Project, PropertyStorageLocations.ConfigurationSpecific);
}
}
public ProjectProperty<string> StartProgram
{

48
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/StorageLocationConverter.cs

@ -1,41 +1,39 @@ @@ -1,41 +1,39 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 14.11.2011
* Time: 19:48
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.Core;
using System;
using System.Globalization;
using System.Windows.Data;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
public class StorageLocationConverter:System.Windows.Data.IMultiValueConverter
public class StorageLocationConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
// Console.WriteLine ("Convert");
// foreach (var element in values) {
// Console.WriteLine(element.ToString());
// }
return values[0];
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
var s = Array.ConvertAll<Type, Object>(targetTypes, t => value);
return s;
}
}
public class StartActionToBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (StartAction)value == (StartAction)parameter;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value)
return parameter;
throw new NotSupportedException("this conversion is not supported!");
}
}
}

2
src/Main/Base/Project/Src/Project/Behaviors/DotNetStartBehavior.cs

@ -338,7 +338,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -338,7 +338,7 @@ namespace ICSharpCode.SharpDevelop.Project
get {
try {
return (StartAction)Enum.Parse(typeof(StartAction), ((MSBuildBasedProject)Project).GetEvaluatedProperty("StartAction") ?? "Project");
} catch (ArgumentException) {
} catch (ArgumentException ex) {
return StartAction.Project;
}
}

Loading…
Cancel
Save