Fixed NumericType/NumericValue.

This commit is contained in:
GoldenCrystal
2014-11-05 23:10:22 +01:00
parent 85ba8f9c68
commit 083c992dff
5 changed files with 24 additions and 5 deletions
@@ -52,6 +52,8 @@ namespace UnicodeCharacterInspector
NotifyPropertyChanged("CodePoint");
NotifyPropertyChanged("Name");
NotifyPropertyChanged("OldName");
NotifyPropertyChanged("NumericType");
NotifyPropertyChanged("NumericValue");
NotifyPropertyChanged("Category");
NotifyPropertyChanged("ContributoryProperties");
}
@@ -78,6 +80,16 @@ namespace UnicodeCharacterInspector
get { return character != null ? characterData != null ? characterData.Category : UnicodeCategory.OtherNotAssigned : null as UnicodeCategory?; }
}
public UnicodeNumericType? NumericType
{
get { return character != null ? characterData != null ? characterData.NumericType : UnicodeNumericType.None : null as UnicodeNumericType?; }
}
public UnicodeRationalNumber? NumericValue
{
get { return character != null && characterData != null && characterData.NumericType != UnicodeNumericType.None ? characterData.NumericValue : null as UnicodeRationalNumber?; }
}
public ContributoryProperties? ContributoryProperties
{
get { return character != null ? characterData != null ? characterData.ContributoryProperties : 0 : null as ContributoryProperties?; }
+10 -4
View File
@@ -55,18 +55,24 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Code point" />
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding SelectedCharacterInfo.CodePoint, StringFormat=U+{0:X4}, TargetNullValue={x:Static System:String.Empty}}" VerticalAlignment="Center" />
<Label Grid.Row="0" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.CodePoint, Converter={StaticResource NullToVisibilityConverter}}" Content="Code Point" />
<TextBlock Grid.Row="0" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.CodePoint, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.CodePoint, StringFormat=U+{0:X4}, TargetNullValue={x:Static System:String.Empty}}" VerticalAlignment="Center" />
<Label Grid.Row="1" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.Name, Converter={StaticResource NullToVisibilityConverter}}" Content="Name" />
<TextBlock Grid.Row="1" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.Name, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.Name}" VerticalAlignment="Center" />
<Label Grid.Row="2" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.OldName, Converter={StaticResource NullToVisibilityConverter}}" Content="Old Name" />
<TextBlock Grid.Row="2" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.OldName, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.OldName}" VerticalAlignment="Center" />
<Label Grid.Row="3" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.Category, Converter={StaticResource NullToVisibilityConverter}}" Content="Category" />
<TextBlock Grid.Row="3" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.Category, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.Category}" VerticalAlignment="Center" />
<Label Grid.Row="4" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.ContributoryProperties, Converter={StaticResource NullToVisibilityConverter}}" Content="Contributory Properties" />
<TextBlock Grid.Row="4" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.ContributoryProperties, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.ContributoryProperties}" VerticalAlignment="Center" />
<Label Grid.Row="4" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.NumericType, Converter={StaticResource NullToVisibilityConverter}}" Content="Numeric Type" />
<TextBlock Grid.Row="4" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.NumericType, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.NumericType}" VerticalAlignment="Center" />
<Label Grid.Row="5" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.NumericValue, Converter={StaticResource NullToVisibilityConverter}}" Content="Numeric Value" />
<TextBlock Grid.Row="5" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.NumericValue, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.NumericValue}" VerticalAlignment="Center" />
<Label Grid.Row="6" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.ContributoryProperties, Converter={StaticResource NullToVisibilityConverter}}" Content="Contributory Properties" />
<TextBlock Grid.Row="6" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.ContributoryProperties, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.ContributoryProperties}" VerticalAlignment="Center" />
</Grid>
</ScrollViewer>
</Grid>
@@ -123,6 +123,7 @@ namespace System.Unicode.Builder
{
throw new InvalidDataException("Invalid value for field 6 of code point " + characterData.CodePointRange.ToString() + ".");
}
characterData.NumericType = UnicodeNumericType.Decimal;
}
else
{
+1 -1
View File
@@ -37,7 +37,7 @@ namespace System.Unicode
public override string ToString()
{
return !IsDefaultValue ? Numerator.ToString() + "/" + Denominator.ToString() : string.Empty;
return !IsDefaultValue ? Denominator != 1 ? Numerator.ToString() + "/" + Denominator.ToString() : Numerator.ToString() : string.Empty;
}
public bool Equals(UnicodeRationalNumber other)
Binary file not shown.