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> /// </summary>
public AbnormalStyle AbnormalStyle { get; set; } public AbnormalStyle AbnormalStyle { get; set; }
/// <summary>
/// Indicates whether to prefer the more verbose "mmol/l" over "mM".
/// </summary>
public bool PreferVerboseMolar { get; set; }
/// <summary> /// <summary>
/// Gets the list of controlling elements. /// Gets the list of controlling elements.
/// </summary> /// </summary>

View File

@ -57,7 +57,8 @@ namespace zaaReloaded2.Formatter
foreach (TimePoint tp in _laboratory.TimePoints.Values) foreach (TimePoint tp in _laboratory.TimePoints.Values)
{ {
_timePointFormatters[tp.TimeStamp] = _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> /// </summary>
public AbnormalStyle AbnormalStyle { get; set; } public AbnormalStyle AbnormalStyle { get; set; }
/// <summary>
/// Indicates whether to prefer the more verbose "mmol/l" over "mM".
/// </summary>
public bool PreferVerboseMolar { get; set; }
/// <summary> /// <summary>
/// Gets or sets a flag that indicates whether this ItemFormatter /// Gets or sets a flag that indicates whether this ItemFormatter
/// has been used, i.e. whether the LabItem was written to a /// 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> /// <param name="labItem">LabItem to wrap in this ItemFormatter.</param>
public ItemFormatter(LabItem labItem, public ItemFormatter(LabItem labItem,
ReferenceStyle referenceStyle, ReferenceStyle referenceStyle,
AbnormalStyle abnormalStyle) AbnormalStyle abnormalStyle,
bool preferVerboseMolar)
{ {
IncludeMaterial = true; IncludeMaterial = true;
LabItem = labItem; LabItem = labItem;
ReferenceStyle = referenceStyle; ReferenceStyle = referenceStyle;
AbnormalStyle = abnormalStyle; AbnormalStyle = abnormalStyle;
PreferVerboseMolar = preferVerboseMolar;
} }
#endregion #endregion
@ -147,7 +154,12 @@ namespace zaaReloaded2.Formatter
if (LabItem.HasUnit) if (LabItem.HasUnit)
{ {
string space = LabItem.Unit.StartsWith("/") ? String.Empty : " "; 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 else
{ {

View File

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

View File

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