Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
2755655e8f | |||
65b2da1071 | |||
b7246ca0ed | |||
a5b4daae7a | |||
40d06b9811 | |||
23e2f3c2ca | |||
1eeaa32336 | |||
091a7e5c97 | |||
cf317ef5f0 | |||
1cfe4c57c5 | |||
9f118757a6 | |||
3267bd9d5a | |||
5a9e7fe444 | |||
f199b2f1bf | |||
eae8cb718b | |||
ae012d42fb | |||
aea6d037c3 | |||
26c0d9e456 | |||
e190e85b89 | |||
ba07293385 | |||
46b4af54c5 | |||
63012281db | |||
812042d4bf | |||
ad34141909 | |||
523e6ac438 | |||
e20b967b44 |
18
HISTORY.md
18
HISTORY.md
@ -1,3 +1,21 @@
|
||||
Version 2.2.6 (2017-02-23)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- Repariert: Stilauswahl wurde immer ganz im Vordergrund dargestellt und verdeckte damit mitunter andere Hinweise.
|
||||
- Verbessert: Diverse technische Verbesserungen.
|
||||
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
|
||||
Version 2.2.5 (2016-10-03)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- Repariert: Word bleibt nicht mehr hängen, wenn man versucht, ein Dokument zu speichern.
|
||||
- Verbessert: Multiple Verbesserungen im Programmcode.
|
||||
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
|
||||
Version 2.2.4 (2016-04-05)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
29
Makefile
Normal file
29
Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
SHELL=/bin/bash
|
||||
.PHONY=all help upload website versioninfo
|
||||
|
||||
help:
|
||||
# Available targets:
|
||||
# website - update website on server
|
||||
# versioninfo - create versioninfo file for the current release
|
||||
# upload - upload release files to server
|
||||
# all - all of the above
|
||||
|
||||
all: versioninfo upload website
|
||||
#
|
||||
# Check repository status!
|
||||
#
|
||||
|
||||
versioninfo:
|
||||
head -n 1 zaaReloaded2/VERSION | tr -d '\r' > www/versioninfo.tmp
|
||||
chmod 644 www/versioninfo.tmp
|
||||
echo 'https://doktorkraus.de/zaareloaded/downloads/zaaReloaded-$$VERSION.exe' >> www/versioninfo.tmp
|
||||
sha256sum deploy/releases/zaaReloaded-$$(head -n 1 zaaReloaded2/VERSION | tr -d '\r').exe >> www/versioninfo.tmp
|
||||
echo '' >> www/versioninfo.tmp
|
||||
todos www/versioninfo.tmp
|
||||
mv www/versioninfo.tmp www/versioninfo.txt
|
||||
|
||||
upload:
|
||||
rsync -ruvz --progress deploy/releases/* bovender.de:/var/www/html/zaareloaded/downloads/
|
||||
|
||||
website:
|
||||
rsync -ruvz www/ bovender.de:/var/www/html/zaareloaded/
|
@ -29,7 +29,7 @@ zaaReloaded2 ist in C# mit VSTO geschrieben, unter Zuhilfenahme von
|
||||
Visual Studio Professional 2013. Der Quellcode liegt in einem öffentlich
|
||||
zugänglichen Git-Repository:
|
||||
|
||||
<http://git.bovender.de>
|
||||
<https://git.bovender.de>
|
||||
|
||||
Clonen:
|
||||
|
||||
@ -212,7 +212,7 @@ dem [MVVM][]-Muster implementiert. Dabei wurde auf das Hilfs-Framework
|
||||
## Updates
|
||||
|
||||
Das Add-in sucht täglich nach einem Update; dabei wird die Datei
|
||||
<http://zaa.nephrowiki.de/versioninfo.txt> heruntergeladen. Updates
|
||||
<https://doktorkraus.de/zaareloaded/versioninfo.txt> heruntergeladen. Updates
|
||||
werden automatisch im Hintergrund geladen und beim Schließen von Word
|
||||
(bzw. der Zentralen Arztbriefablage) installiert und stehen dann beim
|
||||
nächsten Starten der Anwendung zur Verfügung.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* CommentPoolTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ItemCommentTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* CloneTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ItemsTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -44,6 +44,7 @@ namespace Tests.Controller.Elements
|
||||
public void TearDown()
|
||||
{
|
||||
((_Document)_document).Close(WdSaveOptions.wdDoNotSaveChanges);
|
||||
Bovender.ComHelpers.ReleaseComObject(_document);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SettingsRepositoryTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -32,14 +32,14 @@ namespace Tests.Controller
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_savedSettings = zaaReloaded2.Properties.Settings.Default.SettingsRepository;
|
||||
_savedSettings = zaaReloaded2.UserSettings.Default.SettingsRepository;
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
zaaReloaded2.Properties.Settings.Default.SettingsRepository = _savedSettings;
|
||||
zaaReloaded2.Properties.Settings.Default.Save();
|
||||
zaaReloaded2.UserSettings.Default.SettingsRepository = _savedSettings;
|
||||
zaaReloaded2.UserSettings.Default.Save();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SettingsTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* DocumentWriterClass.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* FormatterTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -123,7 +123,7 @@ namespace Tests.Formatter
|
||||
{
|
||||
ZaaImporter importer = new ZaaImporter();
|
||||
importer.Import(
|
||||
"(17.09.2015 10:44:00) Cyclosporin-A vor Gabe: 130 µg/l; CK gesamt: 123 [<= 170] U/l; Cholesterin: 211");
|
||||
"(17.09.2015-201710:44:00) Cyclosporin-A vor Gabe: 130 µg/l; CK gesamt: 123 [<= 170] U/l; Cholesterin: 211");
|
||||
Document document = new Document();
|
||||
f.Formatter formatter = new f.Formatter(document);
|
||||
formatter.Laboratory = importer.Laboratory;
|
||||
@ -131,7 +131,7 @@ namespace Tests.Formatter
|
||||
new List<ElementBase>() { new Items("CsA (C0) \"(Ziel-Talspiegel: <> µg/l)\"") });
|
||||
formatter.Run();
|
||||
Assert.AreEqual(
|
||||
"Laborwerte vom 17.09.2015 10:44:00:\rCsA (C0) 130 µg/l\r\r",
|
||||
"Laborwerte vom 17.09.2015-201710:44:00:\rCsA (C0) 130 µg/l\r\r",
|
||||
document.Range().Text);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* LaurisItemTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -153,7 +153,7 @@ namespace Tests.Importer.ZaaImporter
|
||||
|
||||
[TestCase("Albumin (SU)/die: 149.9 [<= 30] mg/d; ", Material.SU)]
|
||||
[TestCase("Gesamt-Eiweiss/Creatinin (PU): 281 [<= 70] mg/g Crea;", Material.U)]
|
||||
[TestCase("Cystatin C (N Latex): 2.37 [0.57 - 0.96] mg/l; ", Material.B)]
|
||||
[TestCase("Cystatin C (N Latex): 2.37 [0.57 - 0.96] mg/l; ", Material.S)]
|
||||
public void ParseLaurisMaterial(string laurisString, Material expectedMaterial)
|
||||
{
|
||||
LaurisItem i = new LaurisItem(laurisString);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* LaurisParagraphTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* LaurisTimePointTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ZaaImporterTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* UnitTest1.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ImporterTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* PrescriptionTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SelectFirstDayTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* TestHelpers.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -41,16 +41,20 @@
|
||||
<AssemblyOriginatorKeyFile>zaaReloaded2.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Bovender, Version=0.5.0.0, Culture=neutral, PublicKeyToken=df1c15557d8b6df8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Bovender.0.5.0.0\lib\net40\Bovender.dll</HintPath>
|
||||
<Reference Include="Bovender, Version=0.16.2.0, Culture=neutral, PublicKeyToken=df1c15557d8b6df8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Bovender.0.16.2.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>
|
||||
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.3.7\lib\net40\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.4.1\lib\net40\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
@ -66,6 +70,10 @@
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="YamlDotNet, Version=3.9.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.Signed.3.9.0\lib\net35\YamlDotNet.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
@ -107,6 +115,7 @@
|
||||
<Compile Include="ViewModels\SettingsViewModelTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Tests.licenseheader" />
|
||||
<None Include="zaaReloaded2.pfx" />
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ParametersTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -2,7 +2,7 @@
|
||||
* {{
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Class1.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ElementPickerViewModelTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ItemCommentViewModelTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SettingsRepositoryViewModel.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SettingsViewModelTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
29
Tests/app.config
Executable file
29
Tests/app.config
Executable file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
app.config
|
||||
part of zaaReloaded2
|
||||
|
||||
Copyright 2016 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.
|
||||
-->
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="YamlDotNet" publicKeyToken="ec19458f3c15af5e" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.9.0.0" newVersion="3.9.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Bovender" version="0.5.0.0" targetFramework="net40" />
|
||||
<package id="Bovender" version="0.16.2.0" targetFramework="net40" />
|
||||
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net40" />
|
||||
<package id="NLog" version="4.3.7" targetFramework="net40" />
|
||||
<package id="NUnit" version="3.4.1" targetFramework="net40" />
|
||||
<package id="YamlDotNet.Signed" version="3.9.0" targetFramework="net40" />
|
||||
</packages>
|
Submodule deploy/VstoAddinInstaller updated: 26f2dda389...fba5721259
4
deploy/make-installer.iss
Normal file → Executable file
4
deploy/make-installer.iss
Normal file → Executable file
@ -2,13 +2,13 @@
|
||||
"x:\Code\zaaReloaded2\zaaReloaded2\zaaReloaded2.csproj /Build Release")
|
||||
|
||||
#define VERSIONFILE "..\zaaReloaded2\VERSION"
|
||||
#define PUB_YEARS "2015-2016"
|
||||
#define PUB_YEARS "2015-2017"
|
||||
#define TARGET_HOST "word"
|
||||
#define APP_GUID "{{8520B887-3AB1-422B-AB6B-A265D14FE4E5}"
|
||||
#define ADDIN_NAME "zaaReloaded"
|
||||
#define COMPANY "Daniel Kraus (bovender)"
|
||||
#define DESCRIPTION "Word-Addin, das Lauris-Laborwerte in der Zentralen Arztbriefablage formatiert."
|
||||
#define HOMEPAGE "http://zaa.nephrowiki.de"
|
||||
#define HOMEPAGE "https://doktorkraus.de/zaareloaded"
|
||||
#define REGKEY "zaaReloaded2"
|
||||
|
||||
#define SOURCEDIR "..\zaaReloaded2\bin\Release\"
|
||||
|
@ -368,7 +368,7 @@
|
||||
|
||||
<footer class="footer">
|
||||
<p>
|
||||
© 2015-2016 <a href="http://www.bovender.de">Daniel Kraus</a>
|
||||
© 2015-2017 <a href="https://www.bovender.de">Daniel Kraus</a>
|
||||
<span class="pull-right">
|
||||
Handarbeit mit
|
||||
<a href="http://www.vim.org">
|
||||
|
@ -1,4 +1,4 @@
|
||||
2.2.3
|
||||
http://zaa.nephrowiki.de/downloads/zaaReloaded-$VERSION.exe
|
||||
077df8d43cf97ef4082cda988393734a825b51cf0e023527cdc5752502c83f03 deploy/releases/zaaReloaded-2.2.3.exe
|
||||
2.2.6
|
||||
https://doktorkraus.de/zaareloaded/downloads/zaaReloaded-$VERSION.exe
|
||||
b6cc9ef2730cf86debeb4b0a5192e18eaa0ae555a330e2853772e0ebf317331f deploy/releases/zaaReloaded-2.2.6.exe
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Commands.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -42,7 +42,7 @@ namespace zaaReloaded2
|
||||
if (CanFormat())
|
||||
{
|
||||
SettingsRepository repository = SettingsRepository.Load();
|
||||
Guid lastSettingsUid = Properties.Settings.Default.LastSettings;
|
||||
Guid lastSettingsUid = UserSettings.Default.LastSettings;
|
||||
Settings lastSettings = repository.FindByGuid(lastSettingsUid);
|
||||
if (lastSettings != null)
|
||||
{
|
||||
@ -72,8 +72,7 @@ namespace zaaReloaded2
|
||||
SettingsViewModel settingsVM = args.Content.ViewModel as SettingsViewModel;
|
||||
Settings settings = settingsVM.RevealModelObject() as Settings;
|
||||
DoFormat(settings);
|
||||
Properties.Settings.Default.LastSettings = settings.Uid;
|
||||
Properties.Settings.Default.Save();
|
||||
UserSettings.Default.LastSettings = settings.Uid;
|
||||
};
|
||||
vm.InjectInto<SettingsRepositoryView>().ShowDialog();
|
||||
}
|
||||
@ -108,7 +107,7 @@ namespace zaaReloaded2
|
||||
+ "wenn Word in der Zentralen Arztbriefablage ausgeführt wird.\r"
|
||||
+ "Bitte Word als eigenständige Anwendung starten und dann "
|
||||
+ "noch einmal versuchen.";
|
||||
a.OkButtonLabel = "Schließen";
|
||||
a.OkButtonText = "Schließen";
|
||||
a.Invoke();
|
||||
}
|
||||
else
|
||||
@ -127,8 +126,8 @@ namespace zaaReloaded2
|
||||
|
||||
public static void ShowPreferences()
|
||||
{
|
||||
ViewModels.PreferencesViewModel.Default.InjectInto<Views.PreferencesView>()
|
||||
.ShowDialog();
|
||||
ViewModels.PreferencesViewModel vm = new PreferencesViewModel();
|
||||
vm.InjectInto<Views.PreferencesView>().ShowDialog();
|
||||
}
|
||||
|
||||
public static void ApplyDanielsStyle()
|
||||
@ -149,34 +148,45 @@ namespace zaaReloaded2
|
||||
// (NB Technically, there is never _no_ selection in a document.)
|
||||
Word.Window activeWindow = Globals.ThisAddIn.Application.ActiveWindow;
|
||||
Word.Selection sel = activeWindow.Selection;
|
||||
if (!(sel.Paragraphs.Count > 1
|
||||
Word.Paragraphs paragraphs = sel.Paragraphs;
|
||||
Word.Document document = activeWindow.Document;
|
||||
if (!(paragraphs.Count > 1
|
||||
|| (sel.Text.Length > 1 && sel.Text.EndsWith("\r"))))
|
||||
{
|
||||
if (!Medication.Importer.AutoDetect(activeWindow.Document))
|
||||
Logger.Info("FormatDrugs: Attempting to auto-detect");
|
||||
if (!Medication.Importer.AutoDetect(document))
|
||||
{
|
||||
Logger.Info("FormatDrugs: Failed to auto-detect");
|
||||
NotificationAction a = new NotificationAction();
|
||||
a.Caption = "Formatieren nicht möglich";
|
||||
a.Message = "Das Dokument scheint keine Medikationsliste zu enthalten.";
|
||||
a.OkButtonLabel = "Schließen";
|
||||
a.OkButtonText = "Schließen";
|
||||
a.Invoke();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Medication.Importer importer = new Medication.Importer(activeWindow.Selection.Text);
|
||||
Logger.Info("FormatDrugs: Importing");
|
||||
Medication.Importer importer = new Medication.Importer(sel.Text);
|
||||
Medication.Formatter formatter = new Medication.Formatter(importer.Prescriptions);
|
||||
|
||||
Logger.Info("FormatDrugs: Formatting");
|
||||
switch (columns)
|
||||
{
|
||||
case 1:
|
||||
formatter.FormatOneColumn(activeWindow.Document);
|
||||
formatter.FormatOneColumn(document);
|
||||
break;
|
||||
case 2:
|
||||
formatter.FormatTwoColumns(activeWindow.Document);
|
||||
formatter.FormatTwoColumns(document);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Logger.Info("FormatDrugs: Cleaning up");
|
||||
Bovender.ComHelpers.ReleaseComObject(document);
|
||||
Bovender.ComHelpers.ReleaseComObject(paragraphs);
|
||||
Bovender.ComHelpers.ReleaseComObject(sel);
|
||||
Bovender.ComHelpers.ReleaseComObject(activeWindow);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -187,57 +197,84 @@ namespace zaaReloaded2
|
||||
{
|
||||
// If no "real" selection exists, attempt to auto-detect the lab data.
|
||||
// (NB Technically, there is never _no_ selection in a document.)
|
||||
Word.Window activeWindow = Globals.ThisAddIn.Application.ActiveWindow;
|
||||
Word.Selection sel = activeWindow.Selection;
|
||||
if (!(sel.Paragraphs.Count > 1
|
||||
|| (sel.Text.Length > 1 && sel.Text.EndsWith("\r"))))
|
||||
Word.Application word = Globals.ThisAddIn.Application;
|
||||
Word.Document activeDocument = word.ActiveDocument;
|
||||
Word.Window activeWindow = word.ActiveWindow;
|
||||
Word.Selection selection = activeWindow.Selection;
|
||||
Word.Paragraphs paragraphs = selection.Paragraphs;
|
||||
if (!(paragraphs.Count > 1
|
||||
|| (selection.Text.Length > 1 && selection.Text.EndsWith("\r"))))
|
||||
{
|
||||
if (!AutoDetect.Detect(activeWindow.Document))
|
||||
Logger.Info("DoFormat: Attempting to auto-detect");
|
||||
Word.Document doc = activeWindow.Document;
|
||||
if (!AutoDetect.Detect(doc))
|
||||
{
|
||||
Logger.Info("DoFormat: Automatic detection failed");
|
||||
NotificationAction a = new NotificationAction();
|
||||
a.Caption = "Formatieren nicht möglich";
|
||||
a.Message = "Das Dokument scheint keine Lauris-Labordaten zu enthalten.";
|
||||
a.OkButtonLabel = "Schließen";
|
||||
a.OkButtonText = "Schließen";
|
||||
a.Invoke();
|
||||
return;
|
||||
}
|
||||
// Don't release the COM object here
|
||||
// Bovender.ComHelpers.ReleaseComObject(doc);
|
||||
}
|
||||
|
||||
Logger.Info("DoFormat: Importing");
|
||||
ZaaImporter importer = new ZaaImporter();
|
||||
importer.Import(Globals.ThisAddIn.Application.ActiveWindow.Selection.Text);
|
||||
Formatter.Formatter formatter = new Formatter.Formatter(
|
||||
Globals.ThisAddIn.Application.ActiveDocument);
|
||||
importer.Import(selection.Text);
|
||||
Formatter.Formatter formatter = new Formatter.Formatter(activeDocument);
|
||||
|
||||
formatter.Settings = settings;
|
||||
formatter.Laboratory = importer.Laboratory;
|
||||
CommentPool.Default.Reset();
|
||||
CommentPool.Default.FillInComment += CommentPool_FillInComment;
|
||||
try
|
||||
{
|
||||
Logger.Info("DoFormat: Formatting");
|
||||
formatter.Run();
|
||||
}
|
||||
catch (NoLaboratoryDataException)
|
||||
catch (NoLaboratoryDataException e)
|
||||
{
|
||||
Logger.Warn("DoFormat: No lab data?!");
|
||||
Logger.Warn(e);
|
||||
NotificationAction a = new NotificationAction();
|
||||
a.Caption = "Formatieren nicht möglich";
|
||||
a.Message = "Die aktuelle Markierung scheint keine Labordaten zu enthalten.";
|
||||
a.OkButtonLabel = "Schließen";
|
||||
a.OkButtonText = "Schließen";
|
||||
a.Invoke();
|
||||
}
|
||||
Bovender.ComHelpers.ReleaseComObject(paragraphs);
|
||||
Bovender.ComHelpers.ReleaseComObject(selection);
|
||||
Bovender.ComHelpers.ReleaseComObject(activeWindow);
|
||||
Bovender.ComHelpers.ReleaseComObject(activeDocument);
|
||||
Logger.Info("DoFormat: Finished");
|
||||
}
|
||||
|
||||
private static void CommentPool_FillInComment(object sender, ItemCommentEventArgs e)
|
||||
{
|
||||
if (Preferences.Default.SuppressItemCommentInteraction)
|
||||
if (UserSettings.Default.SuppressItemCommentInteraction)
|
||||
{
|
||||
Logger.Info("CommentPool_FillInComment: Comment interaction is suppressed by user settings");
|
||||
e.Comment.IsCancelled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info("CommentPool_FillInComment: Requesting user interaction");
|
||||
ItemCommentViewModel vm = new ItemCommentViewModel(e.Comment);
|
||||
vm.InjectInto<ItemCommentView>().ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* CommentPool.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ParameterComment.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ParameterCommentEventArgs.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* ControlElementBase.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Text.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ElementBase.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* FormatElementBase.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Items.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* NextColumn.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SelectEachDay.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SelectFirstDay.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SelectFirstDay - Copy.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* TwoColumns.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Settings.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SettingsRepository.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -59,7 +59,7 @@ namespace zaaReloaded2.Controller
|
||||
/// </remarks>
|
||||
public static SettingsRepository Load()
|
||||
{
|
||||
string s = Properties.Settings.Default.SettingsRepository;
|
||||
string s = UserSettings.Default.SettingsRepository;
|
||||
if (String.IsNullOrEmpty(s))
|
||||
{
|
||||
return new SettingsRepository();
|
||||
@ -67,7 +67,7 @@ namespace zaaReloaded2.Controller
|
||||
else
|
||||
{
|
||||
MemoryStream stream = new MemoryStream();
|
||||
string encoded = Properties.Settings.Default.SettingsRepository;
|
||||
string encoded = UserSettings.Default.SettingsRepository;
|
||||
byte[] bytes = Convert.FromBase64String(encoded);
|
||||
stream.Write(bytes, 0, bytes.Length);
|
||||
stream.Position = 0;
|
||||
@ -94,8 +94,7 @@ namespace zaaReloaded2.Controller
|
||||
serializer.Serialize(stream, this);
|
||||
stream.Position = 0;
|
||||
string encoded = Convert.ToBase64String(stream.ToArray());
|
||||
Properties.Settings.Default.SettingsRepository = encoded;
|
||||
Properties.Settings.Default.Save();
|
||||
UserSettings.Default.SettingsRepository = encoded;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Demo.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ExceptionDetailView.xaml.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ExceptionView.xaml.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ExceptionViewModel.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -48,7 +48,7 @@ namespace zaaReloaded2.ExceptionHandler
|
||||
{
|
||||
get
|
||||
{
|
||||
return zaaReloaded2.Updater.Version.CurrentVersion().ToString();
|
||||
return zaaReloaded2.Updater.Version.Current.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +86,11 @@ namespace zaaReloaded2.ExceptionHandler
|
||||
return @"x:\Code\zaaReloaded2\zaaReloaded2\";
|
||||
}
|
||||
|
||||
protected override Bovender.UserSettings.UserSettingsBase UserSettings
|
||||
{
|
||||
get { return zaaReloaded2.UserSettings.Default; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SubmissionCompletedAction.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SubmissionFailureView.xaml.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SubmissionProcessAction.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SubmissionProcessView.xaml.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* SubmissionSuccessView.xaml.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* AbnormalStyle.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* DanielsStyle.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* DocumentWriter.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Formatter.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -272,15 +272,18 @@ namespace zaaReloaded2.Formatter
|
||||
{
|
||||
if (Document != null)
|
||||
{
|
||||
Logger.Info("CreateStyles");
|
||||
Style style;
|
||||
// Don't see a better way to check for the existence of a particular
|
||||
// paragraph style than by using a try...catch construction.
|
||||
try
|
||||
{
|
||||
style = Document.Styles[Properties.Settings.Default.StyleParagraph];
|
||||
Logger.Info("CreateStyles: Found paragraph style in document");
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.Info("CreateStyles: Need to create paragraph style");
|
||||
// Add default paragraph style for laboratory
|
||||
style = Document.Styles.Add(Properties.Settings.Default.StyleParagraph);
|
||||
style.Font.Size = 10; // pt
|
||||
@ -293,13 +296,16 @@ namespace zaaReloaded2.Formatter
|
||||
style.ParagraphFormat.FirstLineIndent = -36; // pt
|
||||
style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify;
|
||||
}
|
||||
Bovender.ComHelpers.ReleaseComObject(style);
|
||||
|
||||
try
|
||||
{
|
||||
style = Document.Styles[Properties.Settings.Default.StyleHeader];
|
||||
Logger.Info("CreateStyles: Found header style in document");
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.Info("CreateStyles: Need to create header style");
|
||||
// Add header paragraph style for laboratory
|
||||
style = Document.Styles.Add(Properties.Settings.Default.StyleHeader);
|
||||
style.Font.Size = 10; // pt
|
||||
@ -313,6 +319,7 @@ namespace zaaReloaded2.Formatter
|
||||
style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify;
|
||||
style.set_NextParagraphStyle(Document.Styles[Properties.Settings.Default.StyleParagraph]);
|
||||
}
|
||||
Bovender.ComHelpers.ReleaseComObject(style);
|
||||
|
||||
/*
|
||||
try
|
||||
@ -422,5 +429,13 @@ namespace zaaReloaded2.Formatter
|
||||
Table _table;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* IItemFormatterDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ITimePointFormatterDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ItemFormatter.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ItemFormatterDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* NoLaboratoryDataException.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ReferenceStyle.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* TimePointFormatter.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* TimePointFormatterDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Helpers.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* IImporter.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* AutoDetect.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* LabItem.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -103,14 +103,17 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
// "HBs-Antigen: neg. ;"
|
||||
// "Erythrozyten (U): + [negativ]"
|
||||
Match match;
|
||||
Logger.Debug("ParseLauris: {0}", LaurisText);
|
||||
if (_numericalRegex.IsMatch(LaurisText))
|
||||
{
|
||||
Logger.Debug("ParseLauris: Numerical match");
|
||||
match = _numericalRegex.Match(LaurisText);
|
||||
ParseLimits(match);
|
||||
Value = match.Groups["value"].Value.Trim().Replace(',', '.');
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Debug("ParseLauris: Not a numerical match");
|
||||
match = _categoricalRegex.Match(LaurisText);
|
||||
Normal = match.Groups["normal"].Value.Trim();
|
||||
Value = match.Groups["value"].Value.Trim();
|
||||
@ -120,6 +123,11 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
OriginalName = match.Groups["name"].Value.Trim();
|
||||
Name = OriginalName;
|
||||
Unit = match.Groups["unit"].Value.Trim();
|
||||
Logger.Debug("ParseLauris: Match: {0}, {1}", Name, Unit);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Debug("ParseLauris: No match: \"{0}\"", LaurisText);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,9 +140,11 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
{
|
||||
if (match.Groups["limits"].Success)
|
||||
{
|
||||
Logger.Debug("ParseLimits: Has limits: {0}", match.Groups["limits"].Value);
|
||||
Match limitMatch = _limitRegex.Match(match.Groups["limits"].Value);
|
||||
if (limitMatch.Groups["limit1"].Success && limitMatch.Groups["limit2"].Success)
|
||||
{
|
||||
Logger.Debug("ParseLimits: Upper and lower limit detected");
|
||||
// Use InvariantCulture because Lauris always outputs dots as decimal separator
|
||||
// Only in rare cases, a comma sneaks in...
|
||||
LowerLimit = Double.Parse(limitMatch.Groups["limit1"].Value.Replace(',', '.'),
|
||||
@ -144,6 +154,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Debug("ParseLimits: Single limit detected");
|
||||
switch (limitMatch.Groups["operator"].Value.Trim())
|
||||
{
|
||||
case "<=":
|
||||
@ -159,9 +170,9 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
// Fixes exception ID 65ca8575.
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException(
|
||||
String.Format("Unknown operator in {0}",
|
||||
match.Groups["limits"].Value));
|
||||
string unknown = match.Groups["limits"].Value;
|
||||
Logger.Fatal("ParseLimits: Unknown operator \"{0}\"", unknown);
|
||||
throw new InvalidOperationException(String.Format("Unknown operator in {0}",unknown));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,5 +221,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
static readonly Regex _materialRegex = new Regex(@"\((?<material>(SU|PU))\)");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* LaurisParagraph.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -23,6 +23,7 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using zaaReloaded2.Thesaurus;
|
||||
using zaaReloaded2.LabModel;
|
||||
using Bovender.Extensions;
|
||||
|
||||
namespace zaaReloaded2.Importer.ZaaImporter
|
||||
{
|
||||
@ -109,9 +110,11 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
/// </summary>
|
||||
void Parse()
|
||||
{
|
||||
Logger.Info("Parse: \"{0}\"", OriginalParagraph.TruncateWithEllipsis(40));
|
||||
Match m = _expectedFormat.Match(OriginalParagraph);
|
||||
if (m.Success)
|
||||
{
|
||||
Logger.Info("Parse: Matches Lauris paragraph format");
|
||||
Items = new ItemDictionary();
|
||||
if (m.Groups["caption"].Success)
|
||||
{
|
||||
@ -127,6 +130,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info("Parse: Does not match Lauris paragraph format");
|
||||
IsLaurisParagraph = false;
|
||||
}
|
||||
}
|
||||
@ -140,5 +144,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
Thesaurus.Units _unitDictionary;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* LaurisTimePoint.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -199,6 +199,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
Match m = _timeStampRegex.Match(paragraph);
|
||||
if (m.Success)
|
||||
{
|
||||
Logger.Info("ParseParagraph: Matches time stamp");
|
||||
DateTime dt;
|
||||
if (DateTime.TryParseExact(
|
||||
m.Groups["datetime"].Value,
|
||||
@ -213,27 +214,30 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
// Put the remainder of the line back to the
|
||||
// 'paragraph' parameter to deal with exceptional
|
||||
// lines such as
|
||||
// "(17.09.2015 10:44:00) Cyclosporin-A vor Gabe: 130 µg/l;"
|
||||
// "(17.09.2015-201710:44:00) Cyclosporin-A vor Gabe: 130 µg/l;"
|
||||
// We need to add a dummy caption because this is
|
||||
// the normal format of a paragraph generated from Lauris.
|
||||
if (m.Groups["tail"].Success)
|
||||
{
|
||||
Logger.Info("ParseParagraph: Time stamp has a tail -- putting it back with a dummy caption");
|
||||
paragraph = "DUMMY CAPTION: " + m.Groups["tail"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
paragraph = String.Empty;
|
||||
paragraph = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(paragraph))
|
||||
{
|
||||
Logger.Info("ParseParagraph: Not a time stamp");
|
||||
LaurisParagraph lp = new LaurisParagraph(
|
||||
paragraph,
|
||||
_parameterDictionary,
|
||||
_unitDictionary);
|
||||
if (lp.IsLaurisParagraph)
|
||||
{
|
||||
Logger.Debug("ParseParagraph: Merging Lauris paragraph");
|
||||
Items.Merge(lp.Items);
|
||||
}
|
||||
}
|
||||
@ -259,5 +263,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
Units _unitDictionary;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ZaaImporter.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -67,15 +67,19 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
/// <param name="text">ZAA-formatted Lauris output to import.</param>
|
||||
public void Import(string text)
|
||||
{
|
||||
Logger.Info("Import: \"{0}\"", text.TruncateWithEllipsis(120));
|
||||
string[] paragraphs = Helpers.SplitParagraphs(text);
|
||||
Logger.Info("Import: {0} paragraph(s)", paragraphs.Length);
|
||||
LaurisTimePoint timePoint = null;
|
||||
|
||||
foreach (string paragraph in paragraphs)
|
||||
{
|
||||
Logger.Info("Import: \"{0}\"", paragraph.TruncateWithEllipsis(40));
|
||||
// If the current paragraph looks like a Lauris time stamp,
|
||||
// create a new time point.
|
||||
if (LaurisTimePoint.IsTimeStampLine(paragraph))
|
||||
{
|
||||
Logger.Info("Import: Time stamp detected", paragraph);
|
||||
timePoint = new LaurisTimePoint(paragraph, _parameters, _units);
|
||||
// Add the time point to the laboratory only if none
|
||||
// with the same time stamp exists yet.
|
||||
@ -94,6 +98,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
// if no time point exists yet, create one.
|
||||
else if (LaurisParagraph.ResemblesLaurisParagraph(paragraph))
|
||||
{
|
||||
Logger.Info("Import: Lauris paragraph detected");
|
||||
if (timePoint == null)
|
||||
{
|
||||
timePoint = new LaurisTimePoint(_parameters, _units);
|
||||
@ -101,6 +106,10 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
}
|
||||
timePoint.AddParagraph(paragraph);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Debug("Import: Neither time stamp, nor Lauris paragraph");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,5 +132,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
Units _units;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ItemDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ITimePointsDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ItemDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* LabItem.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -206,13 +206,14 @@ namespace zaaReloaded2.LabModel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Material == LabModel.Material.B)
|
||||
switch (Material)
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return String.Format("{0}-{1}", Material.ToString(), Name);
|
||||
case Material.S:
|
||||
case Material.E:
|
||||
case Material.B:
|
||||
return Name;
|
||||
default:
|
||||
return String.Format("{0}-{1}", Material.ToString(), Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Laboratory.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Materials.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -28,6 +28,12 @@ namespace zaaReloaded2.LabModel
|
||||
/// </summary>
|
||||
public enum Material
|
||||
{
|
||||
[Description("Serum")]
|
||||
/// Serum (default -- first declared)
|
||||
S,
|
||||
[Description("EDTA-Blut")]
|
||||
/// EDTA blood
|
||||
E,
|
||||
[Description("Blut")]
|
||||
/// Blood
|
||||
B,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* TimePoint.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* TimePointsDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
109
zaaReloaded2/LogFile.cs
Executable file
109
zaaReloaded2/LogFile.cs
Executable file
@ -0,0 +1,109 @@
|
||||
/* LogFile.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015-2017 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 NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using NLog.Targets.Wrappers;
|
||||
|
||||
namespace zaaReloaded2
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides logging to file and to the debug console; wraps
|
||||
/// NLog configuration and targets.
|
||||
/// </summary>
|
||||
public class LogFile : Bovender.Logging.LogFile
|
||||
{
|
||||
#region Singleton
|
||||
|
||||
new public static LogFile Default { get { return _lazy.Value; } }
|
||||
|
||||
private static readonly Lazy<LogFile> _lazy = new Lazy<LogFile>(
|
||||
() =>
|
||||
{
|
||||
LogFile logFile = new LogFile();
|
||||
Bovender.Logging.LogFile.LogFileProvider = new Func<Bovender.Logging.LogFile>(() => logFile);
|
||||
return logFile;
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region Static properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether file logging is enabled, without initializing
|
||||
/// the singleton instance if it isn't.
|
||||
/// </summary>
|
||||
new public static bool IsInitializedAndEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _lazy.IsValueCreated && Default.IsFileLoggingEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the folder where log files are stored.
|
||||
/// </summary>
|
||||
public override string LogFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_logFolder == null)
|
||||
{
|
||||
_logFolder = System.IO.Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
Properties.Settings.Default.AppDataFolder,
|
||||
Properties.Settings.Default.UserFolder);
|
||||
}
|
||||
return _logFolder;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
private LogFile()
|
||||
: base()
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private fields
|
||||
|
||||
string _logFolder;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
/* Formatter.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Importer.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Prescription.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,73 +0,0 @@
|
||||
/* Preferences.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;
|
||||
|
||||
namespace zaaReloaded2
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds user preferences.
|
||||
/// </summary>
|
||||
public class Preferences
|
||||
{
|
||||
#region Singleton
|
||||
|
||||
public static Preferences Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
static readonly Preferences _instance = new Preferences();
|
||||
|
||||
static Preferences() { }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the add-in should not ask for
|
||||
/// item comments (i.e. typist mode).
|
||||
/// </summary>
|
||||
public bool SuppressItemCommentInteraction
|
||||
{
|
||||
get
|
||||
{
|
||||
return Properties.Settings.Default.SuppressItemCommentInteraction;
|
||||
}
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.SuppressItemCommentInteraction = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
protected Preferences() { }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
118
zaaReloaded2/Properties/Settings.Designer.cs
generated
118
zaaReloaded2/Properties/Settings.Designer.cs
generated
@ -23,18 +23,6 @@ namespace zaaReloaded2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string SettingsRepository {
|
||||
get {
|
||||
return ((string)(this["SettingsRepository"]));
|
||||
}
|
||||
set {
|
||||
this["SettingsRepository"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2")]
|
||||
@ -64,7 +52,7 @@ namespace zaaReloaded2.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://zaa.nephrowiki.de")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://doktorkraus.de/zaareloaded")]
|
||||
public global::System.Uri Homepage {
|
||||
get {
|
||||
return ((global::System.Uri)(this["Homepage"]));
|
||||
@ -73,7 +61,7 @@ namespace zaaReloaded2.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://zaa.nephrowiki.de/versioninfo.txt")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://doktorkraus.de/zaareloaded/versioninfo.txt")]
|
||||
public string VersionInfoFile {
|
||||
get {
|
||||
return ((string)(this["VersionInfoFile"]));
|
||||
@ -82,24 +70,13 @@ namespace zaaReloaded2.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://zaa.nephrowiki.de/postreport.php")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://doktorkraus.de/zaareloaded/postreport.php")]
|
||||
public string ExceptionPostUrl {
|
||||
get {
|
||||
return ((string)(this["ExceptionPostUrl"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
public global::System.DateTime LastUpdateCheck {
|
||||
get {
|
||||
return ((global::System.DateTime)(this["LastUpdateCheck"]));
|
||||
}
|
||||
set {
|
||||
this["LastUpdateCheck"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://www.apache.org/licenses/LICENSE-2.0")]
|
||||
@ -127,18 +104,6 @@ namespace zaaReloaded2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("00000000-0000-0000-0000-000000000000")]
|
||||
public global::System.Guid LastSettings {
|
||||
get {
|
||||
return ((global::System.Guid)(this["LastSettings"]));
|
||||
}
|
||||
set {
|
||||
this["LastSettings"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Laborwerte")]
|
||||
@ -184,18 +149,6 @@ namespace zaaReloaded2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string ImportExportPath {
|
||||
get {
|
||||
return ((string)(this["ImportExportPath"]));
|
||||
}
|
||||
set {
|
||||
this["ImportExportPath"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Überschrift")]
|
||||
@ -223,30 +176,6 @@ namespace zaaReloaded2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool SuppressItemCommentInteraction {
|
||||
get {
|
||||
return ((bool)(this["SuppressItemCommentInteraction"]));
|
||||
}
|
||||
set {
|
||||
this["SuppressItemCommentInteraction"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool FirstRunWizardShown {
|
||||
get {
|
||||
return ((bool)(this["FirstRunWizardShown"]));
|
||||
}
|
||||
set {
|
||||
this["FirstRunWizardShown"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("BITTE_ERGÄNZEN")]
|
||||
@ -258,25 +187,13 @@ namespace zaaReloaded2.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("http://git.bovender.de")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://git.bovender.de")]
|
||||
public string Repository {
|
||||
get {
|
||||
return ((string)(this["Repository"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool NeedUpgrade {
|
||||
get {
|
||||
return ((bool)(this["NeedUpgrade"]));
|
||||
}
|
||||
set {
|
||||
this["NeedUpgrade"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Medikamente")]
|
||||
@ -285,5 +202,32 @@ namespace zaaReloaded2.Properties {
|
||||
return ((string)(this["DrugsParagraph"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("user")]
|
||||
public string UserFolder {
|
||||
get {
|
||||
return ((string)(this["UserFolder"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2")]
|
||||
public string AppDataFolder {
|
||||
get {
|
||||
return ((string)(this["AppDataFolder"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("settings.yml")]
|
||||
public string UserSettingsFile {
|
||||
get {
|
||||
return ((string)(this["UserSettingsFile"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,6 @@
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="zaaReloaded2.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="SettingsRepository" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="AddinName" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">zaaReloaded2</Value>
|
||||
</Setting>
|
||||
@ -15,16 +12,13 @@
|
||||
<Value Profile="(Default)">Daniel Kraus</Value>
|
||||
</Setting>
|
||||
<Setting Name="Homepage" Type="System.Uri" Scope="Application">
|
||||
<Value Profile="(Default)">http://zaa.nephrowiki.de</Value>
|
||||
<Value Profile="(Default)">https://doktorkraus.de/zaareloaded</Value>
|
||||
</Setting>
|
||||
<Setting Name="VersionInfoFile" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">http://zaa.nephrowiki.de/versioninfo.txt</Value>
|
||||
<Value Profile="(Default)">https://doktorkraus.de/zaareloaded/versioninfo.txt</Value>
|
||||
</Setting>
|
||||
<Setting Name="ExceptionPostUrl" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">http://zaa.nephrowiki.de/postreport.php</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastUpdateCheck" Type="System.DateTime" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
<Value Profile="(Default)">https://doktorkraus.de/zaareloaded/postreport.php</Value>
|
||||
</Setting>
|
||||
<Setting Name="LicenseUrl" Type="System.Uri" Scope="Application">
|
||||
<Value Profile="(Default)">http://www.apache.org/licenses/LICENSE-2.0</Value>
|
||||
@ -35,9 +29,6 @@
|
||||
<Setting Name="SettingsNameClinic" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Standard für NepA</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastSettings" Type="System.Guid" Scope="User">
|
||||
<Value Profile="(Default)">00000000-0000-0000-0000-000000000000</Value>
|
||||
</Setting>
|
||||
<Setting Name="StyleParagraph" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">zaaReloaded2-Laborwerte</Value>
|
||||
</Setting>
|
||||
@ -53,9 +44,6 @@
|
||||
<Setting Name="SerializationVersion" Type="System.Int32" Scope="Application">
|
||||
<Value Profile="(Default)">2</Value>
|
||||
</Setting>
|
||||
<Setting Name="ImportExportPath" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="StyleHeader" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">zaaReloaded2-Überschrift</Value>
|
||||
</Setting>
|
||||
@ -65,23 +53,23 @@
|
||||
<Setting Name="AbnormalStyle" Type="zaaReloaded2.Formatter.AbnormalStyle" Scope="Application">
|
||||
<Value Profile="(Default)">None</Value>
|
||||
</Setting>
|
||||
<Setting Name="SuppressItemCommentInteraction" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="FirstRunWizardShown" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="ManualCommentPrompt" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">BITTE_ERGÄNZEN</Value>
|
||||
</Setting>
|
||||
<Setting Name="Repository" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">http://git.bovender.de</Value>
|
||||
</Setting>
|
||||
<Setting Name="NeedUpgrade" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
<Value Profile="(Default)">https://git.bovender.de</Value>
|
||||
</Setting>
|
||||
<Setting Name="DrugsParagraph" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">zaaReloaded2-Medikamente</Value>
|
||||
</Setting>
|
||||
<Setting Name="UserFolder" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">user</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppDataFolder" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">zaaReloaded2</Value>
|
||||
</Setting>
|
||||
<Setting Name="UserSettingsFile" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">settings.yml</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@ -1,7 +1,7 @@
|
||||
/* Ribbon.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* LineParser.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ParameterDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* DictionaryBase.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* UnitDictionary.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* thisaddin.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -24,11 +24,14 @@ using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Configuration;
|
||||
|
||||
namespace zaaReloaded2
|
||||
{
|
||||
public partial class ThisAddIn
|
||||
{
|
||||
#region Static property
|
||||
|
||||
/// <summary>
|
||||
/// Gets the subdirectory for addin data in the user profile directory.
|
||||
/// </summary>
|
||||
@ -42,44 +45,77 @@ namespace zaaReloaded2
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start up and shut down
|
||||
|
||||
private void ThisAddIn_Startup(object sender, System.EventArgs e)
|
||||
{
|
||||
Bovender.ExceptionHandler.CentralHandler.ManageExceptionCallback += CentralHandler_ManageExceptionCallback;
|
||||
Bovender.WpfHelpers.RegisterTextBoxSelectAll();
|
||||
|
||||
if (Properties.Settings.Default.NeedUpgrade)
|
||||
#if DEBUG
|
||||
Bovender.Logging.LogFile.Default.EnableDebugLogging();
|
||||
#endif
|
||||
try
|
||||
{
|
||||
Properties.Settings.Default.Upgrade();
|
||||
Properties.Settings.Default.NeedUpgrade = false;
|
||||
Properties.Settings.Default.Save();
|
||||
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
|
||||
if (System.IO.File.Exists(config.FilePath))
|
||||
{
|
||||
System.IO.File.Delete(config.FilePath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Warn("ThisAddIn_Startup: Unable to delete user config file");
|
||||
Logger.Warn(ex);
|
||||
}
|
||||
|
||||
Bovender.ExceptionHandler.CentralHandler.ManageExceptionCallback += CentralHandler_ManageExceptionCallback;
|
||||
Bovender.Win32Window.MainWindowHandleProvider = () =>
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
};
|
||||
Bovender.WpfHelpers.RegisterTextBoxSelectAll();
|
||||
UserSettings userSettings = UserSettings.Default;
|
||||
|
||||
CheckForUpdates();
|
||||
_oldCaption = Globals.ThisAddIn.Application.Caption;
|
||||
Globals.ThisAddIn.Application.Caption =
|
||||
Microsoft.Office.Interop.Word.Application word = Globals.ThisAddIn.Application;
|
||||
_oldCaption = word.Caption;
|
||||
word.Caption =
|
||||
String.Format(
|
||||
"{0} ({1} {2})",
|
||||
_oldCaption,
|
||||
Properties.Settings.Default.AddinName,
|
||||
Updater.Version.CurrentVersion().ToString()
|
||||
Updater.Version.Current.ToString()
|
||||
);
|
||||
|
||||
ViewModels.FirstRunViewModel.InjectIntoIfNeeded<Views.FirstRunView>();
|
||||
Logger.Info("ThisAddIn_Startup: Finished startup");
|
||||
}
|
||||
|
||||
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
|
||||
{
|
||||
if (_updaterVM != null && _updaterVM.IsUpdatePending)
|
||||
UserSettings.Default.LastVersionSeen = Updater.Version.Current.ToString();
|
||||
UserSettings.Default.Save();
|
||||
|
||||
if (_updaterVM != null && _updaterVM.InstallCommand.CanExecute(null))
|
||||
{
|
||||
if (_updaterVM.InstallUpdateCommand.CanExecute(null))
|
||||
_updaterVM.InstallUpdateCommand.Execute(null);
|
||||
Logger.Info("ThisAddIn_Shutdown: Installing update");
|
||||
_updaterVM.InstallCommand.Execute(null);
|
||||
}
|
||||
try
|
||||
{
|
||||
Logger.Info("ThisAddIn_Shutdown: Resetting application caption");
|
||||
Globals.ThisAddIn.Application.Caption = _oldCaption;
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Warn("ThisAddIn_Shutdown: Failed to reset application caption");
|
||||
Logger.Warn(ex);
|
||||
}
|
||||
Logger.Info("ThisAddIn_Shutdown: Finished shutdown");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public Ribbon Ribbon
|
||||
@ -109,24 +145,23 @@ namespace zaaReloaded2
|
||||
|
||||
void CheckForUpdates()
|
||||
{
|
||||
if (DateTime.Today == Properties.Settings.Default.LastUpdateCheck.Date)
|
||||
// Check only once per day
|
||||
if (DateTime.Today == UserSettings.Default.LastUpdateCheck.Date)
|
||||
return;
|
||||
|
||||
Properties.Settings.Default.LastUpdateCheck = DateTime.Today;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
_updaterVM = new UpdaterViewModel(new Updater.Updater());
|
||||
if (!_updaterVM.CanCheckForUpdate) return;
|
||||
|
||||
_updaterVM.UpdateAvailableMessage.Sent += UpdateAvailableMessage_Sent;
|
||||
_updaterVM.CheckForUpdateCommand.Execute(null);
|
||||
}
|
||||
|
||||
void UpdateAvailableMessage_Sent(object sender, MessageArgs<ViewModelMessageContent> e)
|
||||
{
|
||||
UpdaterViewModel uvm = e.Content.ViewModel as UpdaterViewModel;
|
||||
uvm.DestinationFolder = System.IO.Path.GetTempPath();
|
||||
uvm.DownloadUpdateCommand.Execute(null);
|
||||
Logger.Info("CheckForUpdates");
|
||||
UserSettings.Default.LastUpdateCheck = DateTime.Today;
|
||||
ReleaseInfo releaseInfo = new ReleaseInfo(new Uri(Properties.Settings.Default.VersionInfoFile));
|
||||
ReleaseInfoViewModel releaseInfoVM = new ReleaseInfoViewModel(releaseInfo, Updater.Version.Current);
|
||||
releaseInfoVM.UpdateAvailableMessage.Sent += (sender, args) =>
|
||||
{
|
||||
Logger.Info("CheckForUpdates: Received update-available message");
|
||||
Updater.Updater updater = Updater.Updater.CreateDefault(releaseInfo);
|
||||
updater.DestinationFolder = System.IO.Path.GetTempPath();
|
||||
_updaterVM = new UpdaterViewModel(updater);
|
||||
_updaterVM.StartProcess();
|
||||
};
|
||||
releaseInfoVM.StartProcess();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -145,8 +180,8 @@ namespace zaaReloaded2
|
||||
#region Private fields
|
||||
|
||||
Ribbon _ribbon;
|
||||
UpdaterViewModel _updaterVM;
|
||||
string _oldCaption;
|
||||
UpdaterViewModel _updaterVM;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -163,5 +198,13 @@ namespace zaaReloaded2
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* Updater.cs
|
||||
using Bovender.Versioning;
|
||||
/* Updater.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2015 Daniel Kraus
|
||||
* Copyright 2015-2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -24,23 +25,38 @@ namespace zaaReloaded2.Updater
|
||||
{
|
||||
class Updater : Bovender.Versioning.Updater
|
||||
{
|
||||
protected override Bovender.Versioning.SemanticVersion GetCurrentVersion()
|
||||
#region Static properties
|
||||
|
||||
public static Updater Default { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public static methods
|
||||
|
||||
public static Updater CreateDefault(IReleaseInfo releaseInfo)
|
||||
{
|
||||
return Version.CurrentVersion();
|
||||
Default = new Updater(releaseInfo);
|
||||
return Default;
|
||||
}
|
||||
|
||||
protected override Uri GetVersionInfoUri()
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public Updater(Bovender.Versioning.IReleaseInfo releaseInfo)
|
||||
: base(releaseInfo)
|
||||
{
|
||||
return new Uri(Properties.Settings.Default.VersionInfoFile);
|
||||
CurrentVersion = Version.Current;
|
||||
}
|
||||
|
||||
protected override string BuildDestinationFileName()
|
||||
{
|
||||
return System.IO.Path.Combine(
|
||||
DestinationFolder,
|
||||
DownloadUri.ToString().Split('/').Last()
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class logger
|
||||
|
||||
private static NLog.Logger Logger { get { return _logger.Value; } }
|
||||
|
||||
private static readonly Lazy<NLog.Logger> _logger = new Lazy<NLog.Logger>(() => NLog.LogManager.GetCurrentClassLogger());
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user