Enable verbose molar units (mmol/l instead of mM).

- Verbessert: Benutzeroption für die Ausgabe von "mmol/l" anstatt "mM" (einstellbar pro Stil).
This commit is contained in:
daniel 2017-03-03 16:20:15 +01:00
parent 0896f007da
commit c783fdb64d
6 changed files with 43 additions and 8 deletions

View File

@ -108,6 +108,11 @@ namespace zaaReloaded2.Controller
/// </summary>
public AbnormalStyle AbnormalStyle { get; set; }
/// <summary>
/// Indicates whether to prefer the more verbose "mmol/l" over "mM".
/// </summary>
public bool PreferVerboseMolar { get; set; }
/// <summary>
/// Gets the list of controlling elements.
/// </summary>

View File

@ -57,7 +57,8 @@ namespace zaaReloaded2.Formatter
foreach (TimePoint tp in _laboratory.TimePoints.Values)
{
_timePointFormatters[tp.TimeStamp] =
new TimePointFormatter(tp, Settings.ReferenceStyle, Settings.AbnormalStyle);
new TimePointFormatter(tp, Settings.ReferenceStyle,
Settings.AbnormalStyle, Settings.PreferVerboseMolar);
}
}
}

View File

@ -47,6 +47,11 @@ namespace zaaReloaded2.Formatter
/// </summary>
public AbnormalStyle AbnormalStyle { get; set; }
/// <summary>
/// Indicates whether to prefer the more verbose "mmol/l" over "mM".
/// </summary>
public bool PreferVerboseMolar { get; set; }
/// <summary>
/// Gets or sets a flag that indicates whether this ItemFormatter
/// has been used, i.e. whether the LabItem was written to a
@ -86,12 +91,14 @@ namespace zaaReloaded2.Formatter
/// <param name="labItem">LabItem to wrap in this ItemFormatter.</param>
public ItemFormatter(LabItem labItem,
ReferenceStyle referenceStyle,
AbnormalStyle abnormalStyle)
AbnormalStyle abnormalStyle,
bool preferVerboseMolar)
{
IncludeMaterial = true;
LabItem = labItem;
ReferenceStyle = referenceStyle;
AbnormalStyle = abnormalStyle;
PreferVerboseMolar = preferVerboseMolar;
}
#endregion
@ -147,7 +154,12 @@ namespace zaaReloaded2.Formatter
if (LabItem.HasUnit)
{
string space = LabItem.Unit.StartsWith("/") ? String.Empty : " ";
unit = String.Format("{0}{1}", space, LabItem.Unit);
unit = LabItem.Unit;
if (PreferVerboseMolar)
{
unit = LabItem.Unit.Replace("mM", "mmol/l");
}
unit = String.Format("{0}{1}", space, unit);
}
else
{

View File

@ -105,14 +105,15 @@ namespace zaaReloaded2.Formatter
/// used to create ItemFormatter objects.</param>
public TimePointFormatter(TimePoint timePoint,
ReferenceStyle referenceStyle,
AbnormalStyle abnormalStyle)
AbnormalStyle abnormalStyle,
bool preferVerboseMolar)
{
TimeStamp = timePoint.TimeStamp;
ItemFormatters = new ItemFormatterDictionary();
foreach (LabItem item in timePoint.Items.Values)
{
ItemFormatters[item.QualifiedName] = new ItemFormatter(
item, referenceStyle, abnormalStyle);
item, referenceStyle, abnormalStyle, preferVerboseMolar);
}
}

View File

@ -185,6 +185,19 @@ namespace zaaReloaded2.ViewModels
}
}
public bool PreferVerboseMolar
{
get
{
return _settings.PreferVerboseMolar;
}
set
{
_settings.PreferVerboseMolar = value;
OnPropertyChanged("PreferVerboseMolar");
}
}
#endregion
#region Constructors

View File

@ -63,8 +63,8 @@
SelectedItem="{Binding ReferenceStyle.SelectedItem}"
x:Name="ReferenceStyleChooser" HorizontalAlignment="Stretch" />
</DockPanel>
<DockPanel DockPanel.Dock="Top" Margin="0 10 0 0">
<Label DockPanel.Dock="Left" Content="Auszeichnung pathologischer Werte:" Margin="0 0 10 0"
<StackPanel DockPanel.Dock="Top" Margin="0 10 0 0" Orientation="Horizontal">
<Label Content="Auszeichnung pathologischer Werte:" Margin="0 0 10 0"
Target="{Binding ElementName=AbnormalStyleChooser}" />
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<ToggleButton IsChecked="{Binding AbnormalBold}" Height="25" Width="25">
@ -77,7 +77,10 @@
<TextBlock TextDecorations="Underline">U</TextBlock>
</ToggleButton>
</StackPanel>
</DockPanel>
<CheckBox IsChecked="{Binding PreferVerboseMolar}" Margin="20 5 10 0">
mmol/l statt mM
</CheckBox>
</StackPanel>
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Command="{Binding CloseViewCommand}" Content="Schließen" IsDefault="True" IsCancel="True"
Margin="0 10 0 0" />