Browse Source

Add converter to edit assembly versions. Add messagebox appearence when assembly info file was not found.

pull/624/head
olegbevz 11 years ago
parent
commit
eaf5d78a66
  1. 3
      data/resources/StringResources.resx
  2. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  3. 25
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AssemblyInfo/AssemblyInfoPanel.xaml
  4. 48
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AssemblyInfo/VersionToStringConverter.cs

3
data/resources/StringResources.resx

@ -8413,4 +8413,7 @@ Press Esc to cancel this operation.</value>
<data name="Dialog.ProjectOptions.AssemblyInfo.Trademark" xml:space="preserve"> <data name="Dialog.ProjectOptions.AssemblyInfo.Trademark" xml:space="preserve">
<value>Trademark:</value> <value>Trademark:</value>
</data> </data>
<data name="Dialog.ProjectOptions.AssemblyInfo.AssemblyInfoNotFound" xml:space="preserve">
<value>Assembly info file was not found. Please ensure that the project contains assembly info file.</value>
</data>
</root> </root>

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -308,6 +308,7 @@
<DependentUpon>AssemblyInfoPanel.xaml</DependentUpon> <DependentUpon>AssemblyInfoPanel.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\AssemblyInfo\AssemblyInfoProvider.cs" /> <Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\AssemblyInfo\AssemblyInfoProvider.cs" />
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\AssemblyInfo\VersionToStringConverter.cs" />
<Compile Include="Src\Gui\Pads\CompilerMessageView\MessageViewCategoryTextWriter.cs" /> <Compile Include="Src\Gui\Pads\CompilerMessageView\MessageViewCategoryTextWriter.cs" />
<Compile Include="Src\Gui\Pads\TaskList\TaskViewResources.xaml.cs"> <Compile Include="Src\Gui\Pads\TaskList\TaskViewResources.xaml.cs">
<DependentUpon>TaskViewResources.xaml</DependentUpon> <DependentUpon>TaskViewResources.xaml</DependentUpon>

25
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AssemblyInfo/AssemblyInfoPanel.xaml

@ -17,6 +17,7 @@
<Setter Property="Height" Value="20"/> <Setter Property="Height" Value="20"/>
<Setter Property="Margin" Value="4"/> <Setter Property="Margin" Value="4"/>
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
<EventSetter Event="TextChanged" Handler="OnPanelOptionsChanged"/> <EventSetter Event="TextChanged" Handler="OnPanelOptionsChanged"/>
</Style> </Style>
<Style TargetType="{x:Type CheckBox}"> <Style TargetType="{x:Type CheckBox}">
@ -25,6 +26,7 @@
<EventSetter Event="Checked" Handler="OnPanelOptionsChanged"/> <EventSetter Event="Checked" Handler="OnPanelOptionsChanged"/>
<EventSetter Event="Unchecked" Handler="OnPanelOptionsChanged"/> <EventSetter Event="Unchecked" Handler="OnPanelOptionsChanged"/>
</Style> </Style>
<optionPanels:VersionToStringConverter x:Key="VersionToStringConverter"/>
</Grid.Resources> </Grid.Resources>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
@ -44,26 +46,27 @@
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Title}" Grid.Column="0" Grid.Row="0"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Title}" Grid.Column="0" Grid.Row="0"/>
<TextBox Text="{Binding Title}" Grid.Column="1" Grid.Row="0"/> <TextBox Text="{Binding Title, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="0"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Description}" Grid.Column="0" Grid.Row="1"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Description}" Grid.Column="0" Grid.Row="1"/>
<TextBox Text="{Binding Description}" Grid.Column="1" Grid.Row="1"/> <TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="1"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Company}" Grid.Column="0" Grid.Row="2"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Company}" Grid.Column="0" Grid.Row="2"/>
<TextBox Text="{Binding Company}" Grid.Column="1" Grid.Row="2"/> <TextBox Text="{Binding Company, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="2"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Product}" Grid.Column="0" Grid.Row="3"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Product}" Grid.Column="0" Grid.Row="3"/>
<TextBox Text="{Binding Product}" Grid.Column="1" Grid.Row="3"/> <TextBox Text="{Binding Product, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="3"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Copyright}" Grid.Column="0" Grid.Row="4"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Copyright}" Grid.Column="0" Grid.Row="4"/>
<TextBox Text="{Binding Copyright}" Grid.Column="1" Grid.Row="4"/> <TextBox Text="{Binding Copyright, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="4"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Trademark}" Grid.Column="0" Grid.Row="5"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.Trademark}" Grid.Column="0" Grid.Row="5"/>
<TextBox Text="{Binding Trademark}" Grid.Column="1" Grid.Row="5"/> <TextBox Text="{Binding Trademark, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="5"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.AssemblyVersion}" Grid.Column="0" Grid.Row="6"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.AssemblyVersion}" Grid.Column="0" Grid.Row="6"/>
<TextBox Text="{Binding AssemblyVersion}" Grid.Column="1" Grid.Row="6"/> <TextBox Text="{Binding AssemblyVersion, Converter={StaticResource VersionToStringConverter}, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="6"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.FileVersion}" Grid.Column="0" Grid.Row="7"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.FileVersion}" Grid.Column="0" Grid.Row="7"/>
<TextBox Text="{Binding FileVersion}" Grid.Column="1" Grid.Row="7"/> <TextBox Text="{Binding FileVersion, Converter={StaticResource VersionToStringConverter}, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="7"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.GUID}" Grid.Column="0" Grid.Row="8"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.GUID}" Grid.Column="0" Grid.Row="8"/>
<TextBox Text="{Binding Guid}" Grid.Column="1" Grid.Row="8"/> <TextBox Text="{Binding Guid, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="8"/>
<Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.NeutralLanguage}" Grid.Column="0" Grid.Row="9"/> <Label Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.NeutralLanguage}" Grid.Column="0" Grid.Row="9"/>
<TextBox Text="{Binding NeutralLanguage}" Grid.Column="1" Grid.Row="9"/> <TextBox Text="{Binding NeutralLanguage, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="9"/>
<CheckBox Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.MakeAssemblyCOMVisible}" IsChecked="{Binding ComVisible}" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="10"/> <CheckBox Content="{core:Localize Dialog.ProjectOptions.AssemblyInfo.MakeAssemblyCOMVisible}"
IsChecked="{Binding ComVisible}" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="10"/>
</Grid> </Grid>
</ScrollViewer> </ScrollViewer>
</optionPanels:ProjectOptionPanel> </optionPanels:ProjectOptionPanel>

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

@ -0,0 +1,48 @@
using System;
using System.Windows;
using System.Windows.Data;
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
[ValueConversion(typeof(Version), typeof(string))]
public class VersionToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
var version = value as Version;
if (version != null)
return version.ToString();
return DependencyProperty.UnsetValue;
}
catch
{
return DependencyProperty.UnsetValue;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
var versionString = value as string;
if (versionString != null)
{
Version version;
if (Version.TryParse(versionString, out version))
{
return version;
}
}
return DependencyProperty.UnsetValue;
}
catch
{
return DependencyProperty.UnsetValue;
}
}
}
}
Loading…
Cancel
Save