Create rudimentary view models, default settings.
This commit is contained in:
parent
a725246f27
commit
12cd58180f
@ -49,12 +49,34 @@ namespace Tests.Controller
|
||||
Settings s = new Settings();
|
||||
string testName = "test";
|
||||
s.Name = testName;
|
||||
sr.Settings.Add(s);
|
||||
sr.SettingsList.Add(s);
|
||||
sr.Store();
|
||||
sr = null;
|
||||
sr = SettingsRepository.Load();
|
||||
Assert.AreEqual(1, sr.Settings.Count);
|
||||
Assert.AreEqual(testName, sr.Settings[0].Name);
|
||||
Assert.AreEqual(1, sr.SettingsList.Count);
|
||||
Assert.AreEqual(testName, sr.SettingsList[0].Name);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateDefaultSettings()
|
||||
{
|
||||
SettingsRepository sr = new SettingsRepository();
|
||||
sr.SettingsList.Add(new Settings("test1", null));
|
||||
sr.SettingsList.Add(new Settings("test2", null));
|
||||
sr.SettingsList.Add(new Settings("test3", null));
|
||||
sr.ResetDefault();
|
||||
|
||||
// Assert that there are now only the 2 default settings
|
||||
Assert.AreEqual(2, sr.SettingsList.Count);
|
||||
|
||||
Assert.AreEqual(
|
||||
zaaReloaded2.Properties.Settings.Default.SettingsNameWard,
|
||||
sr.SettingsList[0].Name,
|
||||
"Settings for ward expected as #1 (index 0) in list");
|
||||
Assert.AreEqual(
|
||||
zaaReloaded2.Properties.Settings.Default.SettingsNameClinic,
|
||||
sr.SettingsList[1].Name,
|
||||
"Settings for outpatient clinic expected as #2 (index 1) in list");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,10 @@
|
||||
<AssemblyOriginatorKeyFile>zaaReloaded2.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Bovender, Version=0.2.0.0, Culture=neutral, PublicKeyToken=df1c15557d8b6df8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Bovender.0.2.0.0\lib\net40\Bovender.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Word, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
@ -48,10 +52,18 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Expression.Blend.Sdk.1.0.2\lib\net40-client\System.Windows.Interactivity.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
@ -79,6 +91,8 @@
|
||||
<Compile Include="Thesaurus\TestThesaurus.cs" />
|
||||
<Compile Include="Importer\ZaaImporter\TimePointTest.cs" />
|
||||
<Compile Include="TestHelpers.cs" />
|
||||
<Compile Include="ViewModels\SettingsRepositoryViewModel.cs" />
|
||||
<Compile Include="ViewModels\SettingsViewModelTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
36
Tests/ViewModels/SettingsRepositoryViewModel.cs
Executable file
36
Tests/ViewModels/SettingsRepositoryViewModel.cs
Executable file
@ -0,0 +1,36 @@
|
||||
/* SettingsRepositoryViewModel.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using zaaReloaded2.Controller;
|
||||
|
||||
namespace Tests.ViewModels
|
||||
{
|
||||
[TestFixture]
|
||||
class SettingsRepositoryViewModel
|
||||
{
|
||||
[Test]
|
||||
public void CannotDeleteDefaultSettings()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
69
Tests/ViewModels/SettingsViewModelTest.cs
Executable file
69
Tests/ViewModels/SettingsViewModelTest.cs
Executable file
@ -0,0 +1,69 @@
|
||||
/* SettingsViewModelTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using zaaReloaded2.ViewModels;
|
||||
using zaaReloaded2.Controller;
|
||||
|
||||
namespace Tests.ViewModels
|
||||
{
|
||||
[TestFixture]
|
||||
class SettingsViewModelTest
|
||||
{
|
||||
SettingsViewModel _settingsVM;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_settingsVM = new SettingsViewModel();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddElement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddChildElement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CannotAddChildElementToFormatElement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteElement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyElement()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Bovender" version="0.2.0.0" targetFramework="net40" />
|
||||
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net40" />
|
||||
</packages>
|
@ -25,22 +25,16 @@ namespace zaaReloaded2.Controller.Elements
|
||||
/// <summary>
|
||||
/// Controller element that writes arbitrary text to the document.
|
||||
/// </summary>
|
||||
class CustomText : ElementBase
|
||||
class CustomText : FormatElementBase
|
||||
{
|
||||
public override string Label
|
||||
{
|
||||
get { return String.Format("\"{0}\"", Text); }
|
||||
get { return String.Format("\"{0}\"", Content); }
|
||||
}
|
||||
|
||||
public override void Run(Formatter.Formatter formatter)
|
||||
{
|
||||
formatter.Write(Text);
|
||||
formatter.WriteParagraph(Content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the arbitrary text that will be written
|
||||
/// to the document.
|
||||
/// </summary>
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -23,5 +23,24 @@ namespace zaaReloaded2.Controller.Elements
|
||||
/// </summary>
|
||||
public abstract class FormatElementBase : ElementBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the content of this format element.
|
||||
/// </summary>
|
||||
public string Content
|
||||
{
|
||||
get { return _content; }
|
||||
set
|
||||
{
|
||||
_content = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is called whenever the Content is changed.
|
||||
/// </summary>
|
||||
protected virtual void OnContentChanged() {}
|
||||
|
||||
private string _content;
|
||||
}
|
||||
}
|
||||
|
@ -31,17 +31,18 @@ namespace zaaReloaded2.Controller.Elements
|
||||
/// to a Word document.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
class Items : FormatElementBase
|
||||
class Items : CustomText
|
||||
{
|
||||
#region ElementBase implementation
|
||||
|
||||
public override string Label
|
||||
{
|
||||
get { return Line; }
|
||||
get { return Content; }
|
||||
}
|
||||
|
||||
public override void Run(zaaReloaded2.Formatter.Formatter formatter)
|
||||
{
|
||||
ParseLine();
|
||||
if (_items == null || _items.Count == 0) return;
|
||||
|
||||
bool _needComma = false;
|
||||
@ -75,37 +76,14 @@ namespace zaaReloaded2.Controller.Elements
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a text line that contains a comma-separated list of
|
||||
/// parsable laboratory item names. The list may optionally be preceded
|
||||
/// with a caption followed by a colon.
|
||||
/// </summary>
|
||||
public string Line
|
||||
{
|
||||
[DebuggerStepThrough]
|
||||
get
|
||||
{
|
||||
return _line;
|
||||
}
|
||||
set
|
||||
{
|
||||
_line = value;
|
||||
ParseLine();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public Items() : base() { }
|
||||
|
||||
public Items(string line)
|
||||
public Items(string content)
|
||||
: this()
|
||||
{
|
||||
Line = line;
|
||||
Content = content;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -121,7 +99,7 @@ namespace zaaReloaded2.Controller.Elements
|
||||
_items = null;
|
||||
_caption = null;
|
||||
Regex r = new Regex(@"((?<caption>[^:]+):\s*)?((?<items>[^,]+),\s*)*(?<items>[^,]+)");
|
||||
Match m = r.Match(Line);
|
||||
Match m = r.Match(Content);
|
||||
if (m.Success)
|
||||
{
|
||||
if (m.Groups["caption"].Success)
|
||||
@ -203,7 +181,6 @@ namespace zaaReloaded2.Controller.Elements
|
||||
|
||||
#region Fields
|
||||
|
||||
string _line;
|
||||
string _caption;
|
||||
List<string> _items;
|
||||
static Regex _wildcard = new Regex(@"(?<material>[^-]+-)?\*");
|
||||
|
@ -39,5 +39,9 @@ namespace zaaReloaded2.Controller.Elements
|
||||
public SelectEachDay(FormatElementBase formatElement)
|
||||
: base(formatElement)
|
||||
{ }
|
||||
|
||||
public SelectEachDay(IList<FormatElementBase> formatElements)
|
||||
: base(formatElements)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
@ -43,5 +43,9 @@ namespace zaaReloaded2.Controller.Elements
|
||||
public SelectFirstDay(FormatElementBase formatElement)
|
||||
: base(formatElement)
|
||||
{ }
|
||||
|
||||
public SelectFirstDay(IList<FormatElementBase> formatElements)
|
||||
: base(formatElements)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
@ -44,5 +44,9 @@ namespace zaaReloaded2.Controller.Elements
|
||||
public SelectLastDay(FormatElementBase formatElement)
|
||||
: base(formatElement)
|
||||
{ }
|
||||
|
||||
public SelectLastDay(IList<FormatElementBase> formatElements)
|
||||
: base(formatElements)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,43 @@ namespace zaaReloaded2.Controller
|
||||
Elements = new List<ElementBase>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Settings object with an initial
|
||||
/// set of elements.
|
||||
/// </summary>
|
||||
/// <param name="initialElements">Set of ElementBase
|
||||
/// object (or derived ones).</param>
|
||||
public Settings(IList<ElementBase> initialElements)
|
||||
{
|
||||
Elements = initialElements;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Settings object with an initial
|
||||
/// set of elements and a name.
|
||||
/// </summary>
|
||||
/// <param name="initialElements">Set of ElementBase
|
||||
/// object (or derived ones).</param>
|
||||
/// <param name="name">Name of these settings.</param>
|
||||
public Settings(string name, IList<ElementBase> initialElements)
|
||||
: this(initialElements)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public methods
|
||||
|
||||
/// <summary>
|
||||
/// Adds an element to the list of Elements.
|
||||
/// </summary>
|
||||
/// <param name="element">Element to add.</param>
|
||||
public void AddElement(ElementBase element)
|
||||
{
|
||||
Elements.Add(element);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,19 @@ using System.Collections.ObjectModel;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using zaaReloaded2.Controller.Elements;
|
||||
|
||||
namespace zaaReloaded2.Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// A repository for zaaReloaded2.Controller.Settings.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class is derived from ApplicationSettingsBase to be able
|
||||
/// to simply store it in the assembly's properties. However, this
|
||||
/// causes some confusion because .NET's ApplicationSettings are
|
||||
/// different from zaaReloaded's Settings.
|
||||
/// </remarks>
|
||||
[Serializable]
|
||||
public class SettingsRepository : ApplicationSettingsBase
|
||||
{
|
||||
@ -48,7 +58,7 @@ namespace zaaReloaded2.Controller
|
||||
|
||||
[UserScopedSetting()]
|
||||
[SettingsSerializeAs(SettingsSerializeAs.Xml)]
|
||||
public IList<Settings> Settings { get; private set; }
|
||||
public IList<Settings> SettingsList { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -56,7 +66,63 @@ namespace zaaReloaded2.Controller
|
||||
|
||||
public SettingsRepository()
|
||||
{
|
||||
Settings = new List<Settings>();
|
||||
SettingsList = new List<Settings>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public methods
|
||||
|
||||
/// <summary>
|
||||
/// Resets the Settings contained in this SettingsRepository
|
||||
/// to the default set of settings.
|
||||
/// </summary>
|
||||
public void ResetDefault()
|
||||
{
|
||||
SettingsList.Clear();
|
||||
|
||||
// Shortcut to assembly properties
|
||||
zaaReloaded2.Properties.Settings def = zaaReloaded2.Properties.Settings.Default;
|
||||
|
||||
// TODO: May want to create deep copies of this list below
|
||||
List<FormatElementBase> defaultItems = new List<FormatElementBase>()
|
||||
{
|
||||
new Items(def.DefaultItemsClinicalChem),
|
||||
new Items(def.DefaultItemsInflammation),
|
||||
new Items(def.DefaultItemsCardio),
|
||||
new Items(def.DefaultItemsKidney),
|
||||
new Items(def.DefaultItemsLiver),
|
||||
new Items(def.DefaultItemsLipids),
|
||||
new Items(def.DefaultItemsHematology),
|
||||
new Items(def.DefaultItemsCoagulation),
|
||||
new Items(def.DefaultItemsDrugs),
|
||||
new Items(def.DefaultItemsCollectedUrine),
|
||||
new Items(def.DefaultItemsSpotUrine),
|
||||
new Items(def.DefaultItemsOther),
|
||||
};
|
||||
|
||||
// Configure the settings for the ward
|
||||
SettingsList.Add(
|
||||
new Settings(
|
||||
def.SettingsNameWard,
|
||||
new List<ElementBase>()
|
||||
{
|
||||
new SelectFirstDay(defaultItems),
|
||||
new SelectLastDay(defaultItems)
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
// Configure the settings for the outpatient clinic
|
||||
SettingsList.Add(
|
||||
new Settings(
|
||||
def.SettingsNameClinic,
|
||||
new List<ElementBase>()
|
||||
{
|
||||
new SelectEachDay(defaultItems),
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
126
zaaReloaded2/Properties/Settings.Designer.cs
generated
126
zaaReloaded2/Properties/Settings.Designer.cs
generated
@ -107,5 +107,131 @@ namespace zaaReloaded2.Properties {
|
||||
return ((global::System.Uri)(this["LicenseUrl"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Standard für Station")]
|
||||
public string SettingsNameWard {
|
||||
get {
|
||||
return ((string)(this["SettingsNameWard"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Standard für NepA")]
|
||||
public string SettingsNameClinic {
|
||||
get {
|
||||
return ((string)(this["SettingsNameClinic"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Klinische Chemie: Na, K, Cl, Mg, Pi, Alb, Prot, LDH, Hsre")]
|
||||
public string DefaultItemsClinicalChem {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsClinicalChem"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Hämatologie: Hb, Hkt, Reti, Leu, Thr, Neu, HbA1c")]
|
||||
public string DefaultItemsHematology {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsHematology"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Gerinnung: Quick, INR, PTT, Fibrinogen, ATIII, Anti-Xa")]
|
||||
public string DefaultItemsCoagulation {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsCoagulation"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Spot-Urin: U-*")]
|
||||
public string DefaultItemsSpotUrine {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsSpotUrine"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Sammelurin: SU-*")]
|
||||
public string DefaultItemsCollectedUrine {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsCollectedUrine"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Weitere Werte: *")]
|
||||
public string DefaultItemsOther {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsOther"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Kardiale Marker: CK, CKMB, Trop, NTproBNP")]
|
||||
public string DefaultItemsCardio {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsCardio"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Blutfette: TG, Chol, LDL, HDL, Lp(a)")]
|
||||
public string DefaultItemsLipids {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsLipids"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Leber: GOT, GGT, GPT, AP, Bili, CHE")]
|
||||
public string DefaultItemsLiver {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsLiver"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Niere: Krea, Hst, eGFR")]
|
||||
public string DefaultItemsKidney {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsKidney"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Entzündung/Immunsystem: CRP, Pct, C3, C4")]
|
||||
public string DefaultItemsInflammation {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsInflammation"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Medikamente: TAC, CSA, SIR, Vancomycin, Gentamicin, Tobramicin")]
|
||||
public string DefaultItemsDrugs {
|
||||
get {
|
||||
return ((string)(this["DefaultItemsDrugs"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,5 +29,47 @@
|
||||
<Setting Name="LicenseUrl" Type="System.Uri" Scope="Application">
|
||||
<Value Profile="(Default)">http://www.apache.org/licenses/LICENSE-2.0</Value>
|
||||
</Setting>
|
||||
<Setting Name="SettingsNameWard" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Standard für Station</Value>
|
||||
</Setting>
|
||||
<Setting Name="SettingsNameClinic" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Standard für NepA</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsClinicalChem" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Klinische Chemie: Na, K, Cl, Mg, Pi, Alb, Prot, LDH, Hsre</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsHematology" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Hämatologie: Hb, Hkt, Reti, Leu, Thr, Neu, HbA1c</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsCoagulation" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Gerinnung: Quick, INR, PTT, Fibrinogen, ATIII, Anti-Xa</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsSpotUrine" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Spot-Urin: U-*</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsCollectedUrine" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Sammelurin: SU-*</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsOther" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Weitere Werte: *</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsCardio" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Kardiale Marker: CK, CKMB, Trop, NTproBNP</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsLipids" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Blutfette: TG, Chol, LDL, HDL, Lp(a)</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsLiver" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Leber: GOT, GGT, GPT, AP, Bili, CHE</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsKidney" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Niere: Krea, Hst, eGFR</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsInflammation" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Entzündung/Immunsystem: CRP, Pct, C3, C4</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultItemsDrugs" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Medikamente: TAC, CSA, SIR, Vancomycin, Gentamicin, Tobramicin</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
50
zaaReloaded2/ViewModels/ControlElementViewModel.cs
Executable file
50
zaaReloaded2/ViewModels/ControlElementViewModel.cs
Executable file
@ -0,0 +1,50 @@
|
||||
/* ElementViewModelBase.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Bovender.Mvvm.ViewModels;
|
||||
using zaaReloaded2.Controller.Elements;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace zaaReloaded2.ViewModels
|
||||
{
|
||||
class ControlElementViewModel : ElementViewModel
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public ObservableCollection<ElementViewModel> Elements
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public ControlElementViewModel() : base() { }
|
||||
|
||||
public ControlElementViewModel(ControlElementBase controlElement)
|
||||
: base(controlElement)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
73
zaaReloaded2/ViewModels/ElementViewModel.cs
Executable file
73
zaaReloaded2/ViewModels/ElementViewModel.cs
Executable file
@ -0,0 +1,73 @@
|
||||
/* ElementViewModel.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Bovender.Mvvm.ViewModels;
|
||||
using zaaReloaded2.Controller.Elements;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace zaaReloaded2.ViewModels
|
||||
{
|
||||
abstract class ElementViewModel : ViewModelBase
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the label of the wrapped element.
|
||||
/// </summary>
|
||||
public virtual string Label
|
||||
{
|
||||
[DebuggerStepThrough]
|
||||
get
|
||||
{
|
||||
return Element.Label;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public ElementViewModel() { }
|
||||
|
||||
public ElementViewModel(ElementBase element)
|
||||
{
|
||||
Element = element;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected properties
|
||||
|
||||
protected ElementBase Element { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of ViewModelBase
|
||||
|
||||
public override object RevealModelObject()
|
||||
{
|
||||
return Element;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
56
zaaReloaded2/ViewModels/FormatElementViewModel.cs
Executable file
56
zaaReloaded2/ViewModels/FormatElementViewModel.cs
Executable file
@ -0,0 +1,56 @@
|
||||
/* FormatElementViewModel.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using zaaReloaded2.Controller.Elements;
|
||||
|
||||
namespace zaaReloaded2.ViewModels
|
||||
{
|
||||
class FormatElementViewModel : ElementViewModel
|
||||
{
|
||||
#region Public properties
|
||||
|
||||
public string Content
|
||||
{
|
||||
[DebuggerStepThrough]
|
||||
get { return ((FormatElementBase)Element).Content; }
|
||||
set
|
||||
{
|
||||
((FormatElementBase)Element).Content = value;
|
||||
OnPropertyChanged("Content");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public FormatElementViewModel() : base() { }
|
||||
|
||||
public FormatElementViewModel(FormatElementBase formatElement)
|
||||
: this()
|
||||
{
|
||||
Element = formatElement;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
253
zaaReloaded2/ViewModels/SettingsViewModel.cs
Executable file
253
zaaReloaded2/ViewModels/SettingsViewModel.cs
Executable file
@ -0,0 +1,253 @@
|
||||
/* SettingsViewModel.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Bovender.Mvvm;
|
||||
using Bovender.Mvvm.ViewModels;
|
||||
using zaaReloaded2.Controller;
|
||||
using zaaReloaded2.Controller.Elements;
|
||||
using zaaReloaded2.Formatter;
|
||||
|
||||
namespace zaaReloaded2.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// View model for the zaaReloaded2.Controller.Settings class.
|
||||
/// </summary>
|
||||
class SettingsViewModel : ViewModelBase
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the Settings
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
[DebuggerStepThrough]
|
||||
get
|
||||
{
|
||||
return _settings.Name;
|
||||
}
|
||||
[DebuggerStepThrough]
|
||||
set
|
||||
{
|
||||
_settings.Name = value;
|
||||
OnPropertyChanged("Name");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is true if the settings' name is editable.
|
||||
/// If the settings' name is a default, preconfigured name,
|
||||
/// this will be false.
|
||||
/// </summary>
|
||||
public bool IsNameEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Name != Properties.Settings.Default.SettingsNameClinic) &&
|
||||
(Name != Properties.Settings.Default.SettingsNameWard);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of element view models.
|
||||
/// </summary>
|
||||
public IList<ElementViewModel> Elements
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_elements == null) { _elements = new List<ElementViewModel>(); }
|
||||
return _elements;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected element.
|
||||
/// </summary>
|
||||
public ElementViewModel SelectedElement
|
||||
{
|
||||
get { return _selectedElement; }
|
||||
set
|
||||
{
|
||||
_selectedElement = value;
|
||||
OnPropertyChanged("SelectedElement");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an EnumProvider object for the ReferenceStyle
|
||||
/// </summary>
|
||||
public EnumProvider<ReferenceStyle> ReferenceStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_referenceStyle == null)
|
||||
{
|
||||
_referenceStyle = new EnumProvider<ReferenceStyle>(_settings.ReferenceStyle);
|
||||
}
|
||||
return _referenceStyle;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public SettingsViewModel()
|
||||
: this(new Settings())
|
||||
{ }
|
||||
|
||||
public SettingsViewModel(Settings settings)
|
||||
: base()
|
||||
{
|
||||
_settings = settings;
|
||||
_elements = new List<ElementViewModel>();
|
||||
foreach (ElementBase element in settings.Elements)
|
||||
{
|
||||
ElementViewModel vm;
|
||||
if (element is FormatElementBase)
|
||||
{
|
||||
vm = new FormatElementViewModel(element as FormatElementBase);
|
||||
}
|
||||
else if (element is ControlElementBase)
|
||||
{
|
||||
vm = new ControlElementViewModel(element as ControlElementBase);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Cannot create ViewModel for " + element.GetType().ToString());
|
||||
}
|
||||
AddElementViewModel(vm);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Messages
|
||||
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
|
||||
public DelegatingCommand AddElementCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_addElementCommand == null)
|
||||
{
|
||||
_addElementCommand = new DelegatingCommand(
|
||||
param => DoAddElement());
|
||||
}
|
||||
return _addElementCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public DelegatingCommand DeleteElementCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_deleteElementCommand == null)
|
||||
{
|
||||
_deleteElementCommand = new DelegatingCommand(
|
||||
param => DoDeleteElement(),
|
||||
param => CanDeleteElement());
|
||||
}
|
||||
return _deleteElementCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public DelegatingCommand CopyElementCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_copyElementCommand == null)
|
||||
{
|
||||
_copyElementCommand = new DelegatingCommand(
|
||||
param => DoCopyElement(),
|
||||
param => CanCopyElement());
|
||||
}
|
||||
return _copyElementCommand;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
|
||||
void DoAddElement() { }
|
||||
|
||||
void DoDeleteElement() { }
|
||||
|
||||
bool CanDeleteElement() { return _selectedElement != null; }
|
||||
|
||||
void DoCopyElement() { }
|
||||
|
||||
bool CanCopyElement() { return _selectedElement != null; }
|
||||
|
||||
/// <summary>
|
||||
/// Internal function that creates wires the OnProperty changed event
|
||||
/// of an ElementViewModel's wrapped model and adds the view model
|
||||
/// to the Elements collection.
|
||||
/// </summary>
|
||||
void AddElementViewModel(ElementViewModel elementViewModel)
|
||||
{
|
||||
elementViewModel.PropertyChanged += ElementViewModel_PropertyChanged;
|
||||
Elements.Add(elementViewModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets or unsets the SelectedElement property whenever the IsSelected
|
||||
/// property of an ElementViewModel changes.
|
||||
/// </summary>
|
||||
void ElementViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
ElementViewModel vm = sender as ElementViewModel;
|
||||
if (vm != null)
|
||||
{
|
||||
SelectedElement = vm.IsSelected ? vm : null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of ViewModelBase
|
||||
|
||||
public override object RevealModelObject()
|
||||
{
|
||||
return _settings;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
Settings _settings;
|
||||
DelegatingCommand _addElementCommand;
|
||||
DelegatingCommand _deleteElementCommand;
|
||||
DelegatingCommand _copyElementCommand;
|
||||
List<ElementViewModel> _elements;
|
||||
ElementViewModel _selectedElement;
|
||||
EnumProvider<ReferenceStyle> _referenceStyle;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -50,6 +50,48 @@
|
||||
<setting name="LicenseUrl" serializeAs="String">
|
||||
<value>http://www.apache.org/licenses/LICENSE-2.0</value>
|
||||
</setting>
|
||||
<setting name="SettingsNameWard" serializeAs="String">
|
||||
<value>Standard für Station</value>
|
||||
</setting>
|
||||
<setting name="SettingsNameClinic" serializeAs="String">
|
||||
<value>Standard für NepA</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsClinicalChem" serializeAs="String">
|
||||
<value>Klinische Chemie: Na, K, Cl, Mg, Pi, Alb, Prot, LDH, Hsre</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsHematology" serializeAs="String">
|
||||
<value>Hämatologie: Hb, Hkt, Reti, Leu, Thr, Neu, HbA1c</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsCoagulation" serializeAs="String">
|
||||
<value>Gerinnung: Quick, INR, PTT, Fibrinogen, ATIII, Anti-Xa</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsSpotUrine" serializeAs="String">
|
||||
<value>Spot-Urin: U-*</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsCollectedUrine" serializeAs="String">
|
||||
<value>Sammelurin: SU-*</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsOther" serializeAs="String">
|
||||
<value>Weitere Werte: *</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsCardio" serializeAs="String">
|
||||
<value>Kardiale Marker: CK, CKMB, Trop, NTproBNP</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsLipids" serializeAs="String">
|
||||
<value>Blutfette: TG, Chol, LDL, HDL, Lp(a)</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsLiver" serializeAs="String">
|
||||
<value>Leber: GOT, GGT, GPT, AP, Bili, CHE</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsKidney" serializeAs="String">
|
||||
<value>Niere: Krea, Hst, eGFR</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsInflammation" serializeAs="String">
|
||||
<value>Entzündung/Immunsystem: CRP, Pct, C3, C4</value>
|
||||
</setting>
|
||||
<setting name="DefaultItemsDrugs" serializeAs="String">
|
||||
<value>Medikamente: TAC, CSA, SIR, Vancomycin, Gentamicin, Tobramicin</value>
|
||||
</setting>
|
||||
</zaaReloaded2.Properties.Settings>
|
||||
</applicationSettings>
|
||||
<userSettings>
|
||||
|
@ -219,10 +219,14 @@
|
||||
</Compile>
|
||||
<Compile Include="Updater\Updater.cs" />
|
||||
<Compile Include="ViewModels\AboutViewModel.cs" />
|
||||
<Compile Include="ViewModels\ElementViewModel.cs" />
|
||||
<Compile Include="ViewModels\FormatElementViewModel.cs" />
|
||||
<Compile Include="ViewModels\ControlElementViewModel.cs" />
|
||||
<Compile Include="Views\AboutView.xaml.cs">
|
||||
<DependentUpon>AboutView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Updater\Version.cs" />
|
||||
<Compile Include="ViewModels\SettingsViewModel.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
Loading…
Reference in New Issue
Block a user