Merge branch 'refactor' into develop

- Repariert: Word bleibt nicht mehr hängen, wenn man versucht, ein Dokument zu speichern.
- Verbessert: Multiple Verbesserungen im Programmcode.
This commit is contained in:
daniel 2016-10-03 16:29:27 +02:00
commit ae012d42fb
35 changed files with 844 additions and 372 deletions

View File

@ -44,6 +44,7 @@ namespace Tests.Controller.Elements
public void TearDown() public void TearDown()
{ {
((_Document)_document).Close(WdSaveOptions.wdDoNotSaveChanges); ((_Document)_document).Close(WdSaveOptions.wdDoNotSaveChanges);
Bovender.ComHelpers.ReleaseComObject(_document);
} }
[Test] [Test]

View File

@ -32,14 +32,14 @@ namespace Tests.Controller
[SetUp] [SetUp]
public void SetUp() public void SetUp()
{ {
_savedSettings = zaaReloaded2.Properties.Settings.Default.SettingsRepository; _savedSettings = zaaReloaded2.UserSettings.Default.SettingsRepository;
} }
[TearDown] [TearDown]
public void TearDown() public void TearDown()
{ {
zaaReloaded2.Properties.Settings.Default.SettingsRepository = _savedSettings; zaaReloaded2.UserSettings.Default.SettingsRepository = _savedSettings;
zaaReloaded2.Properties.Settings.Default.Save(); zaaReloaded2.UserSettings.Default.Save();
} }
[Test] [Test]

View File

@ -153,7 +153,7 @@ namespace Tests.Importer.ZaaImporter
[TestCase("Albumin (SU)/die: 149.9 [<= 30] mg/d; ", Material.SU)] [TestCase("Albumin (SU)/die: 149.9 [<= 30] mg/d; ", Material.SU)]
[TestCase("Gesamt-Eiweiss/Creatinin (PU): 281 [<= 70] mg/g Crea;", Material.U)] [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) public void ParseLaurisMaterial(string laurisString, Material expectedMaterial)
{ {
LaurisItem i = new LaurisItem(laurisString); LaurisItem i = new LaurisItem(laurisString);

View File

@ -41,16 +41,20 @@
<AssemblyOriginatorKeyFile>zaaReloaded2.pfx</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>zaaReloaded2.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Bovender, Version=0.5.0.0, Culture=neutral, PublicKeyToken=df1c15557d8b6df8, processorArchitecture=MSIL"> <Reference Include="Bovender, Version=0.14.5.0, Culture=neutral, PublicKeyToken=df1c15557d8b6df8, processorArchitecture=MSIL">
<HintPath>..\packages\Bovender.0.5.0.0\lib\net40\Bovender.dll</HintPath> <HintPath>..\packages\Bovender.0.14.5.0\lib\net40\Bovender.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Office.Interop.Word, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <Reference Include="Microsoft.Office.Interop.Word, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
</Reference> </Reference>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <HintPath>..\packages\NLog.4.3.7\lib\net40\NLog.dll</HintPath>
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.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>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
@ -66,6 +70,10 @@
<Reference Include="System.Xaml" /> <Reference Include="System.Xaml" />
<Reference Include="System.XML" /> <Reference Include="System.XML" />
<Reference Include="WindowsBase" /> <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> </ItemGroup>
<Choose> <Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'"> <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -107,6 +115,7 @@
<Compile Include="ViewModels\SettingsViewModelTest.cs" /> <Compile Include="ViewModels\SettingsViewModelTest.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Tests.licenseheader" /> <None Include="Tests.licenseheader" />
<None Include="zaaReloaded2.pfx" /> <None Include="zaaReloaded2.pfx" />

29
Tests/app.config Executable file
View 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>

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Bovender" version="0.5.0.0" targetFramework="net40" /> <package id="Bovender" version="0.14.5.0" targetFramework="net40" />
<package id="Expression.Blend.Sdk" version="1.0.2" 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> </packages>

@ -1 +1 @@
Subproject commit 26f2dda3892341a7eaf93df75b765edcf910ca71 Subproject commit fba57212590cafd9cc650b0602dccb8b0dc39e5b

View File

@ -1,4 +1,4 @@
2.2.4 2.2.4
http://zaa.nephrowiki.de/downloads/zaaReloaded-$VERSION.exe https://doktorkraus.de/zaareloaded/downloads/zaaReloaded-$VERSION.exe
2149acc9b48152b84fedd0466d372dd11f8f4dbb72cd4db928f9a54890f06ed9 deploy/releases/zaaReloaded-2.2.4.exe 2149acc9b48152b84fedd0466d372dd11f8f4dbb72cd4db928f9a54890f06ed9 deploy/releases/zaaReloaded-2.2.4.exe

View File

@ -42,7 +42,7 @@ namespace zaaReloaded2
if (CanFormat()) if (CanFormat())
{ {
SettingsRepository repository = SettingsRepository.Load(); SettingsRepository repository = SettingsRepository.Load();
Guid lastSettingsUid = Properties.Settings.Default.LastSettings; Guid lastSettingsUid = UserSettings.Default.LastSettings;
Settings lastSettings = repository.FindByGuid(lastSettingsUid); Settings lastSettings = repository.FindByGuid(lastSettingsUid);
if (lastSettings != null) if (lastSettings != null)
{ {
@ -72,8 +72,7 @@ namespace zaaReloaded2
SettingsViewModel settingsVM = args.Content.ViewModel as SettingsViewModel; SettingsViewModel settingsVM = args.Content.ViewModel as SettingsViewModel;
Settings settings = settingsVM.RevealModelObject() as Settings; Settings settings = settingsVM.RevealModelObject() as Settings;
DoFormat(settings); DoFormat(settings);
Properties.Settings.Default.LastSettings = settings.Uid; UserSettings.Default.LastSettings = settings.Uid;
Properties.Settings.Default.Save();
}; };
vm.InjectInto<SettingsRepositoryView>().ShowDialog(); vm.InjectInto<SettingsRepositoryView>().ShowDialog();
} }
@ -108,7 +107,7 @@ namespace zaaReloaded2
+ "wenn Word in der Zentralen Arztbriefablage ausgeführt wird.\r" + "wenn Word in der Zentralen Arztbriefablage ausgeführt wird.\r"
+ "Bitte Word als eigenständige Anwendung starten und dann " + "Bitte Word als eigenständige Anwendung starten und dann "
+ "noch einmal versuchen."; + "noch einmal versuchen.";
a.OkButtonLabel = "Schließen"; a.OkButtonText = "Schließen";
a.Invoke(); a.Invoke();
} }
else else
@ -127,8 +126,8 @@ namespace zaaReloaded2
public static void ShowPreferences() public static void ShowPreferences()
{ {
ViewModels.PreferencesViewModel.Default.InjectInto<Views.PreferencesView>() ViewModels.PreferencesViewModel vm = new PreferencesViewModel();
.ShowDialog(); vm.InjectInto<Views.PreferencesView>().ShowDialog();
} }
public static void ApplyDanielsStyle() public static void ApplyDanielsStyle()
@ -149,34 +148,45 @@ namespace zaaReloaded2
// (NB Technically, there is never _no_ selection in a document.) // (NB Technically, there is never _no_ selection in a document.)
Word.Window activeWindow = Globals.ThisAddIn.Application.ActiveWindow; Word.Window activeWindow = Globals.ThisAddIn.Application.ActiveWindow;
Word.Selection sel = activeWindow.Selection; 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")))) || (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(); NotificationAction a = new NotificationAction();
a.Caption = "Formatieren nicht möglich"; a.Caption = "Formatieren nicht möglich";
a.Message = "Das Dokument scheint keine Medikationsliste zu enthalten."; a.Message = "Das Dokument scheint keine Medikationsliste zu enthalten.";
a.OkButtonLabel = "Schließen"; a.OkButtonText = "Schließen";
a.Invoke(); a.Invoke();
return; 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); Medication.Formatter formatter = new Medication.Formatter(importer.Prescriptions);
Logger.Info("FormatDrugs: Formatting");
switch (columns) switch (columns)
{ {
case 1: case 1:
formatter.FormatOneColumn(activeWindow.Document); formatter.FormatOneColumn(document);
break; break;
case 2: case 2:
formatter.FormatTwoColumns(activeWindow.Document); formatter.FormatTwoColumns(document);
break; break;
default: default:
break; break;
} }
Logger.Info("FormatDrugs: Cleaning up");
Bovender.ComHelpers.ReleaseComObject(document);
Bovender.ComHelpers.ReleaseComObject(paragraphs);
Bovender.ComHelpers.ReleaseComObject(sel);
Bovender.ComHelpers.ReleaseComObject(activeWindow);
} }
#endregion #endregion
@ -187,57 +197,84 @@ namespace zaaReloaded2
{ {
// If no "real" selection exists, attempt to auto-detect the lab data. // If no "real" selection exists, attempt to auto-detect the lab data.
// (NB Technically, there is never _no_ selection in a document.) // (NB Technically, there is never _no_ selection in a document.)
Word.Window activeWindow = Globals.ThisAddIn.Application.ActiveWindow; Word.Application word = Globals.ThisAddIn.Application;
Word.Selection sel = activeWindow.Selection; Word.Document activeDocument = word.ActiveDocument;
if (!(sel.Paragraphs.Count > 1 Word.Window activeWindow = word.ActiveWindow;
|| (sel.Text.Length > 1 && sel.Text.EndsWith("\r")))) 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(); NotificationAction a = new NotificationAction();
a.Caption = "Formatieren nicht möglich"; a.Caption = "Formatieren nicht möglich";
a.Message = "Das Dokument scheint keine Lauris-Labordaten zu enthalten."; a.Message = "Das Dokument scheint keine Lauris-Labordaten zu enthalten.";
a.OkButtonLabel = "Schließen"; a.OkButtonText = "Schließen";
a.Invoke(); a.Invoke();
return; return;
} }
// Don't release the COM object here
// Bovender.ComHelpers.ReleaseComObject(doc);
} }
Logger.Info("DoFormat: Importing");
ZaaImporter importer = new ZaaImporter(); ZaaImporter importer = new ZaaImporter();
importer.Import(Globals.ThisAddIn.Application.ActiveWindow.Selection.Text); importer.Import(selection.Text);
Formatter.Formatter formatter = new Formatter.Formatter( Formatter.Formatter formatter = new Formatter.Formatter(activeDocument);
Globals.ThisAddIn.Application.ActiveDocument);
formatter.Settings = settings; formatter.Settings = settings;
formatter.Laboratory = importer.Laboratory; formatter.Laboratory = importer.Laboratory;
CommentPool.Default.Reset(); CommentPool.Default.Reset();
CommentPool.Default.FillInComment += CommentPool_FillInComment; CommentPool.Default.FillInComment += CommentPool_FillInComment;
try try
{ {
Logger.Info("DoFormat: Formatting");
formatter.Run(); formatter.Run();
} }
catch (NoLaboratoryDataException) catch (NoLaboratoryDataException e)
{ {
Logger.Warn("DoFormat: No lab data?!");
Logger.Warn(e);
NotificationAction a = new NotificationAction(); NotificationAction a = new NotificationAction();
a.Caption = "Formatieren nicht möglich"; a.Caption = "Formatieren nicht möglich";
a.Message = "Die aktuelle Markierung scheint keine Labordaten zu enthalten."; a.Message = "Die aktuelle Markierung scheint keine Labordaten zu enthalten.";
a.OkButtonLabel = "Schließen"; a.OkButtonText = "Schließen";
a.Invoke(); 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) 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; e.Comment.IsCancelled = true;
} }
else else
{ {
Logger.Info("CommentPool_FillInComment: Requesting user interaction");
ItemCommentViewModel vm = new ItemCommentViewModel(e.Comment); ItemCommentViewModel vm = new ItemCommentViewModel(e.Comment);
vm.InjectInto<ItemCommentView>().ShowDialog(); vm.InjectInto<ItemCommentView>().ShowDialog();
} }
} }
#endregion #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
} }
} }

View File

@ -59,7 +59,7 @@ namespace zaaReloaded2.Controller
/// </remarks> /// </remarks>
public static SettingsRepository Load() public static SettingsRepository Load()
{ {
string s = Properties.Settings.Default.SettingsRepository; string s = UserSettings.Default.SettingsRepository;
if (String.IsNullOrEmpty(s)) if (String.IsNullOrEmpty(s))
{ {
return new SettingsRepository(); return new SettingsRepository();
@ -67,7 +67,7 @@ namespace zaaReloaded2.Controller
else else
{ {
MemoryStream stream = new MemoryStream(); MemoryStream stream = new MemoryStream();
string encoded = Properties.Settings.Default.SettingsRepository; string encoded = UserSettings.Default.SettingsRepository;
byte[] bytes = Convert.FromBase64String(encoded); byte[] bytes = Convert.FromBase64String(encoded);
stream.Write(bytes, 0, bytes.Length); stream.Write(bytes, 0, bytes.Length);
stream.Position = 0; stream.Position = 0;
@ -94,8 +94,7 @@ namespace zaaReloaded2.Controller
serializer.Serialize(stream, this); serializer.Serialize(stream, this);
stream.Position = 0; stream.Position = 0;
string encoded = Convert.ToBase64String(stream.ToArray()); string encoded = Convert.ToBase64String(stream.ToArray());
Properties.Settings.Default.SettingsRepository = encoded; UserSettings.Default.SettingsRepository = encoded;
Properties.Settings.Default.Save();
} }
#endregion #endregion

View File

@ -48,7 +48,7 @@ namespace zaaReloaded2.ExceptionHandler
{ {
get 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\"; return @"x:\Code\zaaReloaded2\zaaReloaded2\";
} }
protected override Bovender.UserSettings.UserSettingsBase UserSettings
{
get { return zaaReloaded2.UserSettings.Default; }
}
#endregion #endregion
} }
} }

View File

@ -272,15 +272,18 @@ namespace zaaReloaded2.Formatter
{ {
if (Document != null) if (Document != null)
{ {
Logger.Info("CreateStyles");
Style style; Style style;
// Don't see a better way to check for the existence of a particular // Don't see a better way to check for the existence of a particular
// paragraph style than by using a try...catch construction. // paragraph style than by using a try...catch construction.
try try
{ {
style = Document.Styles[Properties.Settings.Default.StyleParagraph]; style = Document.Styles[Properties.Settings.Default.StyleParagraph];
Logger.Info("CreateStyles: Found paragraph style in document");
} }
catch catch
{ {
Logger.Info("CreateStyles: Need to create paragraph style");
// Add default paragraph style for laboratory // Add default paragraph style for laboratory
style = Document.Styles.Add(Properties.Settings.Default.StyleParagraph); style = Document.Styles.Add(Properties.Settings.Default.StyleParagraph);
style.Font.Size = 10; // pt style.Font.Size = 10; // pt
@ -293,13 +296,16 @@ namespace zaaReloaded2.Formatter
style.ParagraphFormat.FirstLineIndent = -36; // pt style.ParagraphFormat.FirstLineIndent = -36; // pt
style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify; style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify;
} }
Bovender.ComHelpers.ReleaseComObject(style);
try try
{ {
style = Document.Styles[Properties.Settings.Default.StyleHeader]; style = Document.Styles[Properties.Settings.Default.StyleHeader];
Logger.Info("CreateStyles: Found header style in document");
} }
catch catch
{ {
Logger.Info("CreateStyles: Need to create header style");
// Add header paragraph style for laboratory // Add header paragraph style for laboratory
style = Document.Styles.Add(Properties.Settings.Default.StyleHeader); style = Document.Styles.Add(Properties.Settings.Default.StyleHeader);
style.Font.Size = 10; // pt style.Font.Size = 10; // pt
@ -313,6 +319,7 @@ namespace zaaReloaded2.Formatter
style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify; style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify;
style.set_NextParagraphStyle(Document.Styles[Properties.Settings.Default.StyleParagraph]); style.set_NextParagraphStyle(Document.Styles[Properties.Settings.Default.StyleParagraph]);
} }
Bovender.ComHelpers.ReleaseComObject(style);
/* /*
try try
@ -422,5 +429,13 @@ namespace zaaReloaded2.Formatter
Table _table; Table _table;
#endregion #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
} }
} }

View File

@ -105,12 +105,14 @@ namespace zaaReloaded2.Importer.ZaaImporter
Match match; Match match;
if (_numericalRegex.IsMatch(LaurisText)) if (_numericalRegex.IsMatch(LaurisText))
{ {
Logger.Debug("ParseLauris: Numerical match");
match = _numericalRegex.Match(LaurisText); match = _numericalRegex.Match(LaurisText);
ParseLimits(match); ParseLimits(match);
Value = match.Groups["value"].Value.Trim().Replace(',', '.'); Value = match.Groups["value"].Value.Trim().Replace(',', '.');
} }
else else
{ {
Logger.Debug("ParseLauris: Not a numerical match");
match = _categoricalRegex.Match(LaurisText); match = _categoricalRegex.Match(LaurisText);
Normal = match.Groups["normal"].Value.Trim(); Normal = match.Groups["normal"].Value.Trim();
Value = match.Groups["value"].Value.Trim(); Value = match.Groups["value"].Value.Trim();
@ -120,6 +122,11 @@ namespace zaaReloaded2.Importer.ZaaImporter
OriginalName = match.Groups["name"].Value.Trim(); OriginalName = match.Groups["name"].Value.Trim();
Name = OriginalName; Name = OriginalName;
Unit = match.Groups["unit"].Value.Trim(); Unit = match.Groups["unit"].Value.Trim();
Logger.Debug("ParseLauris: Match: {0}, {1}", Name, Unit);
}
else
{
Logger.Debug("ParseLauris: No match: \"{0}\"", LaurisText);
} }
} }
@ -132,6 +139,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
{ {
if (match.Groups["limits"].Success) if (match.Groups["limits"].Success)
{ {
Logger.Debug("ParseLimits: Has limits");
Match limitMatch = _limitRegex.Match(match.Groups["limits"].Value); Match limitMatch = _limitRegex.Match(match.Groups["limits"].Value);
if (limitMatch.Groups["limit1"].Success && limitMatch.Groups["limit2"].Success) if (limitMatch.Groups["limit1"].Success && limitMatch.Groups["limit2"].Success)
{ {
@ -210,5 +218,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
static readonly Regex _materialRegex = new Regex(@"\((?<material>(SU|PU))\)"); static readonly Regex _materialRegex = new Regex(@"\((?<material>(SU|PU))\)");
#endregion #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
} }
} }

View File

@ -23,6 +23,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using zaaReloaded2.Thesaurus; using zaaReloaded2.Thesaurus;
using zaaReloaded2.LabModel; using zaaReloaded2.LabModel;
using Bovender.Extensions;
namespace zaaReloaded2.Importer.ZaaImporter namespace zaaReloaded2.Importer.ZaaImporter
{ {
@ -112,6 +113,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
Match m = _expectedFormat.Match(OriginalParagraph); Match m = _expectedFormat.Match(OriginalParagraph);
if (m.Success) if (m.Success)
{ {
Logger.Info("Parse: Matches Lauris paragraph format");
Items = new ItemDictionary(); Items = new ItemDictionary();
if (m.Groups["caption"].Success) if (m.Groups["caption"].Success)
{ {
@ -127,6 +129,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
} }
else else
{ {
Logger.Info("Parse: Does not match Lauris paragraph format");
Logger.Info("Parse: {0}", OriginalParagraph.TruncateWithEllipsis(40));
IsLaurisParagraph = false; IsLaurisParagraph = false;
} }
} }
@ -140,5 +144,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
Thesaurus.Units _unitDictionary; Thesaurus.Units _unitDictionary;
#endregion #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
} }
} }

View File

@ -199,6 +199,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
Match m = _timeStampRegex.Match(paragraph); Match m = _timeStampRegex.Match(paragraph);
if (m.Success) if (m.Success)
{ {
Logger.Info("ParseParagraph: Matches time stamp");
DateTime dt; DateTime dt;
if (DateTime.TryParseExact( if (DateTime.TryParseExact(
m.Groups["datetime"].Value, m.Groups["datetime"].Value,
@ -218,6 +219,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
// the normal format of a paragraph generated from Lauris. // the normal format of a paragraph generated from Lauris.
if (m.Groups["tail"].Success) if (m.Groups["tail"].Success)
{ {
Logger.Debug("ParseParagraph: Time stamp has tail, adding dummy caption");
paragraph = "DUMMY CAPTION: " + m.Groups["tail"].Value; paragraph = "DUMMY CAPTION: " + m.Groups["tail"].Value;
} }
else else
@ -228,12 +230,14 @@ namespace zaaReloaded2.Importer.ZaaImporter
if (!String.IsNullOrEmpty(paragraph)) if (!String.IsNullOrEmpty(paragraph))
{ {
Logger.Info("ParseParagraph: Not a time stamp");
LaurisParagraph lp = new LaurisParagraph( LaurisParagraph lp = new LaurisParagraph(
paragraph, paragraph,
_parameterDictionary, _parameterDictionary,
_unitDictionary); _unitDictionary);
if (lp.IsLaurisParagraph) if (lp.IsLaurisParagraph)
{ {
Logger.Debug("ParseParagraph: Merging Lauris paragraph");
Items.Merge(lp.Items); Items.Merge(lp.Items);
} }
} }
@ -259,5 +263,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
Units _unitDictionary; Units _unitDictionary;
#endregion #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
} }
} }

View File

@ -67,6 +67,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// <param name="text">ZAA-formatted Lauris output to import.</param> /// <param name="text">ZAA-formatted Lauris output to import.</param>
public void Import(string text) public void Import(string text)
{ {
Logger.Info("Import");
string[] paragraphs = Helpers.SplitParagraphs(text); string[] paragraphs = Helpers.SplitParagraphs(text);
LaurisTimePoint timePoint = null; LaurisTimePoint timePoint = null;
@ -76,6 +77,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
// create a new time point. // create a new time point.
if (LaurisTimePoint.IsTimeStampLine(paragraph)) if (LaurisTimePoint.IsTimeStampLine(paragraph))
{ {
Logger.Info("Import: Time stamp line: {0}", paragraph);
timePoint = new LaurisTimePoint(paragraph, _parameters, _units); timePoint = new LaurisTimePoint(paragraph, _parameters, _units);
// Add the time point to the laboratory only if none // Add the time point to the laboratory only if none
// with the same time stamp exists yet. // with the same time stamp exists yet.
@ -94,6 +96,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
// if no time point exists yet, create one. // if no time point exists yet, create one.
else if (LaurisParagraph.ResemblesLaurisParagraph(paragraph)) else if (LaurisParagraph.ResemblesLaurisParagraph(paragraph))
{ {
Logger.Info("Import: Lauris paragraph detected");
if (timePoint == null) if (timePoint == null)
{ {
timePoint = new LaurisTimePoint(_parameters, _units); timePoint = new LaurisTimePoint(_parameters, _units);
@ -101,6 +104,11 @@ namespace zaaReloaded2.Importer.ZaaImporter
} }
timePoint.AddParagraph(paragraph); timePoint.AddParagraph(paragraph);
} }
else
{
Logger.Debug("Import: Neither time line, nor Lauris paragraph");
Logger.Debug("Import: {0}", paragraph.TruncateWithEllipsis(30));
}
} }
} }
@ -123,5 +131,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
Units _units; Units _units;
#endregion #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
} }
} }

View File

@ -206,13 +206,14 @@ namespace zaaReloaded2.LabModel
{ {
get get
{ {
if (Material == LabModel.Material.B) switch (Material)
{ {
return Name; case Material.S:
} case Material.E:
else case Material.B:
{ return Name;
return String.Format("{0}-{1}", Material.ToString(), Name); default:
return String.Format("{0}-{1}", Material.ToString(), Name);
} }
} }
} }

View File

@ -28,6 +28,12 @@ namespace zaaReloaded2.LabModel
/// </summary> /// </summary>
public enum Material public enum Material
{ {
[Description("Serum")]
/// Serum (default -- first declared)
S,
[Description("EDTA-Blut")]
/// EDTA blood
E,
[Description("Blut")] [Description("Blut")]
/// Blood /// Blood
B, B,

109
zaaReloaded2/LogFile.cs Executable file
View File

@ -0,0 +1,109 @@
/* LogFile.cs
* 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.
*/
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
}
}

View File

@ -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
}
}

View File

@ -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.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2")] [global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2")]
@ -64,7 +52,7 @@ namespace zaaReloaded2.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [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 { public global::System.Uri Homepage {
get { get {
return ((global::System.Uri)(this["Homepage"])); return ((global::System.Uri)(this["Homepage"]));
@ -73,7 +61,7 @@ namespace zaaReloaded2.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [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 { public string VersionInfoFile {
get { get {
return ((string)(this["VersionInfoFile"])); return ((string)(this["VersionInfoFile"]));
@ -82,24 +70,13 @@ namespace zaaReloaded2.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [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 { public string ExceptionPostUrl {
get { get {
return ((string)(this["ExceptionPostUrl"])); 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.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("http://www.apache.org/licenses/LICENSE-2.0")] [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.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Laborwerte")] [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.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Überschrift")] [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.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("BITTE_ERGÄNZEN")] [global::System.Configuration.DefaultSettingValueAttribute("BITTE_ERGÄNZEN")]
@ -258,25 +187,13 @@ namespace zaaReloaded2.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("http://git.bovender.de")] [global::System.Configuration.DefaultSettingValueAttribute("https://git.bovender.de")]
public string Repository { public string Repository {
get { get {
return ((string)(this["Repository"])); 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.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Medikamente")] [global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Medikamente")]
@ -285,5 +202,32 @@ namespace zaaReloaded2.Properties {
return ((string)(this["DrugsParagraph"])); 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"]));
}
}
} }
} }

View File

@ -2,9 +2,6 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="zaaReloaded2.Properties" GeneratedClassName="Settings"> <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="zaaReloaded2.Properties" GeneratedClassName="Settings">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="SettingsRepository" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="AddinName" Type="System.String" Scope="Application"> <Setting Name="AddinName" Type="System.String" Scope="Application">
<Value Profile="(Default)">zaaReloaded2</Value> <Value Profile="(Default)">zaaReloaded2</Value>
</Setting> </Setting>
@ -15,16 +12,13 @@
<Value Profile="(Default)">Daniel Kraus</Value> <Value Profile="(Default)">Daniel Kraus</Value>
</Setting> </Setting>
<Setting Name="Homepage" Type="System.Uri" Scope="Application"> <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>
<Setting Name="VersionInfoFile" Type="System.String" Scope="Application"> <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>
<Setting Name="ExceptionPostUrl" Type="System.String" Scope="Application"> <Setting Name="ExceptionPostUrl" Type="System.String" Scope="Application">
<Value Profile="(Default)">http://zaa.nephrowiki.de/postreport.php</Value> <Value Profile="(Default)">https://doktorkraus.de/zaareloaded/postreport.php</Value>
</Setting>
<Setting Name="LastUpdateCheck" Type="System.DateTime" Scope="User">
<Value Profile="(Default)" />
</Setting> </Setting>
<Setting Name="LicenseUrl" Type="System.Uri" Scope="Application"> <Setting Name="LicenseUrl" Type="System.Uri" Scope="Application">
<Value Profile="(Default)">http://www.apache.org/licenses/LICENSE-2.0</Value> <Value Profile="(Default)">http://www.apache.org/licenses/LICENSE-2.0</Value>
@ -35,9 +29,6 @@
<Setting Name="SettingsNameClinic" Type="System.String" Scope="Application"> <Setting Name="SettingsNameClinic" Type="System.String" Scope="Application">
<Value Profile="(Default)">Standard für NepA</Value> <Value Profile="(Default)">Standard für NepA</Value>
</Setting> </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"> <Setting Name="StyleParagraph" Type="System.String" Scope="Application">
<Value Profile="(Default)">zaaReloaded2-Laborwerte</Value> <Value Profile="(Default)">zaaReloaded2-Laborwerte</Value>
</Setting> </Setting>
@ -53,9 +44,6 @@
<Setting Name="SerializationVersion" Type="System.Int32" Scope="Application"> <Setting Name="SerializationVersion" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">2</Value> <Value Profile="(Default)">2</Value>
</Setting> </Setting>
<Setting Name="ImportExportPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="StyleHeader" Type="System.String" Scope="Application"> <Setting Name="StyleHeader" Type="System.String" Scope="Application">
<Value Profile="(Default)">zaaReloaded2-Überschrift</Value> <Value Profile="(Default)">zaaReloaded2-Überschrift</Value>
</Setting> </Setting>
@ -65,23 +53,23 @@
<Setting Name="AbnormalStyle" Type="zaaReloaded2.Formatter.AbnormalStyle" Scope="Application"> <Setting Name="AbnormalStyle" Type="zaaReloaded2.Formatter.AbnormalStyle" Scope="Application">
<Value Profile="(Default)">None</Value> <Value Profile="(Default)">None</Value>
</Setting> </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"> <Setting Name="ManualCommentPrompt" Type="System.String" Scope="Application">
<Value Profile="(Default)">BITTE_ERGÄNZEN</Value> <Value Profile="(Default)">BITTE_ERGÄNZEN</Value>
</Setting> </Setting>
<Setting Name="Repository" Type="System.String" Scope="Application"> <Setting Name="Repository" Type="System.String" Scope="Application">
<Value Profile="(Default)">http://git.bovender.de</Value> <Value Profile="(Default)">https://git.bovender.de</Value>
</Setting>
<Setting Name="NeedUpgrade" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting> </Setting>
<Setting Name="DrugsParagraph" Type="System.String" Scope="Application"> <Setting Name="DrugsParagraph" Type="System.String" Scope="Application">
<Value Profile="(Default)">zaaReloaded2-Medikamente</Value> <Value Profile="(Default)">zaaReloaded2-Medikamente</Value>
</Setting> </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> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -24,11 +24,14 @@ using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
using System.Configuration;
namespace zaaReloaded2 namespace zaaReloaded2
{ {
public partial class ThisAddIn public partial class ThisAddIn
{ {
#region Static property
/// <summary> /// <summary>
/// Gets the subdirectory for addin data in the user profile directory. /// Gets the subdirectory for addin data in the user profile directory.
/// </summary> /// </summary>
@ -42,44 +45,77 @@ namespace zaaReloaded2
} }
} }
#endregion
#region Start up and shut down
private void ThisAddIn_Startup(object sender, System.EventArgs e) private void ThisAddIn_Startup(object sender, System.EventArgs e)
{ {
Bovender.ExceptionHandler.CentralHandler.ManageExceptionCallback += CentralHandler_ManageExceptionCallback; #if DEBUG
Bovender.WpfHelpers.RegisterTextBoxSelectAll(); Bovender.Logging.LogFile.Default.EnableDebugLogging();
#endif
if (Properties.Settings.Default.NeedUpgrade) try
{ {
Properties.Settings.Default.Upgrade(); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
Properties.Settings.Default.NeedUpgrade = false; if (System.IO.File.Exists(config.FilePath))
Properties.Settings.Default.Save(); {
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(); CheckForUpdates();
_oldCaption = Globals.ThisAddIn.Application.Caption; Microsoft.Office.Interop.Word.Application word = Globals.ThisAddIn.Application;
Globals.ThisAddIn.Application.Caption = _oldCaption = word.Caption;
word.Caption =
String.Format( String.Format(
"{0} ({1} {2})", "{0} ({1} {2})",
_oldCaption, _oldCaption,
Properties.Settings.Default.AddinName, Properties.Settings.Default.AddinName,
Updater.Version.CurrentVersion().ToString() Updater.Version.Current.ToString()
); );
ViewModels.FirstRunViewModel.InjectIntoIfNeeded<Views.FirstRunView>(); ViewModels.FirstRunViewModel.InjectIntoIfNeeded<Views.FirstRunView>();
Logger.Info("ThisAddIn_Startup: Finished startup");
} }
private void ThisAddIn_Shutdown(object sender, System.EventArgs e) 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)) Logger.Info("ThisAddIn_Shutdown: Installing update");
_updaterVM.InstallUpdateCommand.Execute(null); _updaterVM.InstallCommand.Execute(null);
} }
try try
{ {
Logger.Info("ThisAddIn_Shutdown: Resetting application caption");
Globals.ThisAddIn.Application.Caption = _oldCaption; 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 #region Properties
public Ribbon Ribbon public Ribbon Ribbon
@ -109,24 +145,23 @@ namespace zaaReloaded2
void CheckForUpdates() void CheckForUpdates()
{ {
if (DateTime.Today == Properties.Settings.Default.LastUpdateCheck.Date) // Check only once per day
if (DateTime.Today == UserSettings.Default.LastUpdateCheck.Date)
return; return;
Properties.Settings.Default.LastUpdateCheck = DateTime.Today; Logger.Info("CheckForUpdates");
Properties.Settings.Default.Save(); UserSettings.Default.LastUpdateCheck = DateTime.Today;
ReleaseInfo releaseInfo = new ReleaseInfo(new Uri(Properties.Settings.Default.VersionInfoFile));
_updaterVM = new UpdaterViewModel(new Updater.Updater()); ReleaseInfoViewModel releaseInfoVM = new ReleaseInfoViewModel(releaseInfo, Updater.Version.Current);
if (!_updaterVM.CanCheckForUpdate) return; releaseInfoVM.UpdateAvailableMessage.Sent += (sender, args) =>
{
_updaterVM.UpdateAvailableMessage.Sent += UpdateAvailableMessage_Sent; Logger.Info("CheckForUpdates: Received update-available message");
_updaterVM.CheckForUpdateCommand.Execute(null); Updater.Updater updater = Updater.Updater.CreateDefault(releaseInfo);
} updater.DestinationFolder = System.IO.Path.GetTempPath();
_updaterVM = new UpdaterViewModel(updater);
void UpdateAvailableMessage_Sent(object sender, MessageArgs<ViewModelMessageContent> e) _updaterVM.StartProcess();
{ };
UpdaterViewModel uvm = e.Content.ViewModel as UpdaterViewModel; releaseInfoVM.StartProcess();
uvm.DestinationFolder = System.IO.Path.GetTempPath();
uvm.DownloadUpdateCommand.Execute(null);
} }
#endregion #endregion
@ -145,8 +180,8 @@ namespace zaaReloaded2
#region Private fields #region Private fields
Ribbon _ribbon; Ribbon _ribbon;
UpdaterViewModel _updaterVM;
string _oldCaption; string _oldCaption;
UpdaterViewModel _updaterVM;
#endregion #endregion
@ -163,5 +198,13 @@ namespace zaaReloaded2
} }
#endregion #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
} }
} }

View File

@ -1,4 +1,5 @@
/* Updater.cs using Bovender.Versioning;
/* Updater.cs
* part of zaaReloaded2 * part of zaaReloaded2
* *
* Copyright 2015 Daniel Kraus * Copyright 2015 Daniel Kraus
@ -24,23 +25,38 @@ namespace zaaReloaded2.Updater
{ {
class Updater : Bovender.Versioning.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() #endregion
{
return System.IO.Path.Combine(
DestinationFolder,
DownloadUri.ToString().Split('/').Last()
);
}
#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
} }
} }

View File

@ -26,18 +26,41 @@ namespace zaaReloaded2.Updater
{ {
class Version : SemanticVersion class Version : SemanticVersion
{ {
#region Static 'overrides' #region Current version singleton
public static SemanticVersion Current
{
get
{
return _lazy.Value;
}
}
private static readonly Lazy<SemanticVersion> _lazy =
new Lazy<SemanticVersion>(() => new Version());
#endregion
#region Public method
public string BrandName
{
get
{
return Properties.Settings.Default.AddinName + " " + ToString();
}
}
#endregion
#region Constructors
/// <summary> /// <summary>
/// Returns the current version of the XL Toolbox addin. /// Creates an instance with the current zaaReloaded2 version
/// </summary> /// </summary>
/// <returns></returns> private Version() : base(Assembly.GetExecutingAssembly()) { }
new public static SemanticVersion CurrentVersion()
{ public Version(string version) : base(version) { }
return Bovender.Versioning.SemanticVersion.CurrentVersion(
Assembly.GetExecutingAssembly()
);
}
#endregion #endregion
} }

198
zaaReloaded2/UserSettings.cs Executable file
View File

@ -0,0 +1,198 @@
/* UserSettings.cs
* 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.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace zaaReloaded2
{
[Serializable]
class UserSettings : Bovender.UserSettings.UserSettingsBase
{
#region Static property
public static string UserSettingsFile
{
get
{
return Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Properties.Settings.Default.AppDataFolder,
Properties.Settings.Default.UserFolder,
Properties.Settings.Default.UserSettingsFile);
}
}
#endregion
#region Singleton factory
new public static UserSettings Default
{
get
{
return _lazy.Value;
}
}
private static Lazy<UserSettings> _lazy = new Lazy<UserSettings>(() =>
{
// Logger.Info("Initializing singleton instance");
UserSettings s = FromFileOrDefault<UserSettings>(UserSettingsFile);
Bovender.UserSettings.UserSettingsBase.Default = s;
return s;
});
#endregion
#region User settings
public DateTime LastUpdateCheck
{
get
{
if (_lastUpdateCheck == null)
{
_lastUpdateCheck = new DateTime(2016, 1, 1);
}
return _lastUpdateCheck;
}
set
{
_lastUpdateCheck = value;
}
}
public string LastVersionSeen
{
get
{
if (_lastVersionSeen == null)
{
_lastVersionSeen = DEFAULT_VERSION;
}
return _lastVersionSeen;
}
set
{
_lastVersionSeen = value;
}
}
public int UpdateCheckInterval
{
get
{
if (_updateCheckInterval <= 0)
{
_updateCheckInterval = 7;
}
return _updateCheckInterval;
}
set
{
_updateCheckInterval = value;
}
}
public bool EnableLogging
{
get
{
return LogFile.IsInitializedAndEnabled;
}
set
{
if (value)
{
LogFile.Default.IsFileLoggingEnabled = true;
}
else if (LogFile.IsInitializedAndEnabled)
{
LogFile.Default.IsFileLoggingEnabled = true;
}
}
}
public string ImportExportPath { get; set; }
public bool SuppressItemCommentInteraction { get; set; }
public Guid LastSettings
{
get
{
if (_lastSettings == null)
{
_lastSettings = new Guid("00000000-0000-0000-0000-000000000000");
}
return _lastSettings;
}
set
{
_lastSettings = value;
}
}
public string SettingsRepository { get; set; }
[YamlDotNet.Serialization.YamlIgnore]
public bool FirstRun { get { return LastVersionSeen == DEFAULT_VERSION; } }
#endregion
#region Private fields
private DateTime _lastUpdateCheck;
private int _updateCheckInterval;
private string _lastVersionSeen;
private Guid _lastSettings;
private const string DEFAULT_VERSION = "0.0.0";
#endregion
#region Overrides
public override string GetSettingsFilePath()
{
return UserSettingsFile;
}
#endregion
#region Constructor
/// <summary>
/// Creates a new instance. This should never be called directly, use
/// the singleton factory instead. The constructor must be public to
/// enable deserialization.
/// </summary>
public UserSettings() { }
#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
}
}

View File

@ -67,7 +67,7 @@ namespace zaaReloaded2.ViewModels
{ {
get get
{ {
return zaaReloaded2.Updater.Version.CurrentVersion().ToString(); return zaaReloaded2.Updater.Version.Current.ToString();
} }
} }

View File

@ -40,7 +40,7 @@ namespace zaaReloaded2.ViewModels
public static void InjectIntoIfNeeded<T>() public static void InjectIntoIfNeeded<T>()
where T: System.Windows.Window, new() where T: System.Windows.Window, new()
{ {
if (!Properties.Settings.Default.FirstRunWizardShown) if (UserSettings.Default.FirstRun)
{ {
FirstRunViewModel vm = new FirstRunViewModel(); FirstRunViewModel vm = new FirstRunViewModel();
vm.InjectInto<T>().Show(); vm.InjectInto<T>().Show();
@ -93,34 +93,19 @@ namespace zaaReloaded2.ViewModels
void DoSelectDoctorsMode() void DoSelectDoctorsMode()
{ {
// Properties will be saved by the DoCloseView override. // Properties will be saved by the DoCloseView override.
Properties.Settings.Default.SuppressItemCommentInteraction = false; UserSettings.Default.SuppressItemCommentInteraction = false;
CloseViewCommand.Execute(null); CloseViewCommand.Execute(null);
} }
void DoSelectTypistsMode() void DoSelectTypistsMode()
{ {
// Properties will be saved by the DoCloseView override. // Properties will be saved by the DoCloseView override.
Properties.Settings.Default.SuppressItemCommentInteraction = true; UserSettings.Default.SuppressItemCommentInteraction = true;
CloseViewCommand.Execute(null); CloseViewCommand.Execute(null);
} }
#endregion #endregion
#region Overrides
/// <summary>
/// Sets the FirstRunWizardShown property of the assembly properties
/// to true and calls the base function to close the associated view.
/// </summary>
protected override void DoCloseView()
{
Properties.Settings.Default.FirstRunWizardShown = true;
Properties.Settings.Default.Save();
base.DoCloseView();
}
#endregion
#region Implementation of ViewModelBase #region Implementation of ViewModelBase
public override object RevealModelObject() public override object RevealModelObject()

View File

@ -29,25 +29,47 @@ namespace zaaReloaded2.ViewModels
/// </summary> /// </summary>
public class PreferencesViewModel : ViewModelBase public class PreferencesViewModel : ViewModelBase
{ {
#region Singleton #region Properties
public static PreferencesViewModel Default public bool SuppressItemCommentInteraction
{ {
get get
{ {
return _instance; return _suppressCommentInteraction;
}
set
{
if (value != _suppressCommentInteraction)
{
_suppressCommentInteraction = value;
OnPropertyChanged("SuppressItemCommentInteraction");
}
} }
} }
static PreferencesViewModel() { } public bool EnableLogging
{
get
{
return _enableLogging;
}
set
{
if (value != _enableLogging)
{
_enableLogging = value;
OnPropertyChanged("EnableLogging");
}
}
}
static readonly PreferencesViewModel _instance = new PreferencesViewModel(); public string LogFolder
{
#endregion get
{
#region Properties return LogFile.Default.LogFolder;
}
public bool SuppressItemCommentInteraction { get; set; } }
#endregion #endregion
@ -67,13 +89,32 @@ namespace zaaReloaded2.ViewModels
} }
} }
public DelegatingCommand OpenLogFolderCommand
{
get
{
if (_openLogFolderCommand == null)
{
_openLogFolderCommand = new DelegatingCommand(
param => DoOpenLogFolder(),
param => CanOpenLogFolder());
}
return _openLogFolderCommand;
}
}
#endregion #endregion
#region Constructor #region Constructor
public PreferencesViewModel() public PreferencesViewModel()
{ {
SuppressItemCommentInteraction = Preferences.Default.SuppressItemCommentInteraction; _suppressCommentInteraction = UserSettings.Default.SuppressItemCommentInteraction;
_enableLogging = UserSettings.Default.EnableLogging;
PropertyChanged += (sender, args) =>
{
_dirty = true;
};
} }
#endregion #endregion
@ -82,20 +123,45 @@ namespace zaaReloaded2.ViewModels
void DoSave() void DoSave()
{ {
Preferences.Default.SuppressItemCommentInteraction = SuppressItemCommentInteraction; if (_dirty)
{
UserSettings.Default.SuppressItemCommentInteraction = SuppressItemCommentInteraction;
UserSettings.Default.EnableLogging = EnableLogging;
}
DoCloseView(); DoCloseView();
} }
bool CanSave() bool CanSave()
{ {
return true; return _dirty;
}
void DoOpenLogFolder()
{
if (CanOpenLogFolder())
{
System.Diagnostics.Process.Start(LogFolder);
if (!_dirty)
{
CloseViewCommand.Execute(null);
}
}
}
bool CanOpenLogFolder()
{
return !String.IsNullOrEmpty(LogFolder);
} }
#endregion #endregion
#region Field #region Fields
DelegatingCommand _saveCommand; DelegatingCommand _saveCommand;
DelegatingCommand _openLogFolderCommand;
bool _dirty;
bool _enableLogging;
bool _suppressCommentInteraction;
#endregion #endregion
@ -103,7 +169,7 @@ namespace zaaReloaded2.ViewModels
public override object RevealModelObject() public override object RevealModelObject()
{ {
throw new NotImplementedException(); return UserSettings.Default;
} }
#endregion #endregion

View File

@ -445,8 +445,7 @@ namespace zaaReloaded2.ViewModels
{ {
if (message.Confirmed) if (message.Confirmed)
{ {
Properties.Settings.Default.ImportExportPath = message.Value; UserSettings.Default.ImportExportPath = message.Value;
Properties.Settings.Default.Save();
Settings settings = LastSelected.RevealModelObject() as Settings; Settings settings = LastSelected.RevealModelObject() as Settings;
try try
{ {
@ -477,8 +476,7 @@ namespace zaaReloaded2.ViewModels
{ {
if (message.Confirmed) if (message.Confirmed)
{ {
Properties.Settings.Default.ImportExportPath = message.Value; UserSettings.Default.ImportExportPath = message.Value;
Properties.Settings.Default.Save();
try try
{ {
Settings settings = Settings.LoadFromFile(message.Value); Settings settings = Settings.LoadFromFile(message.Value);
@ -495,7 +493,7 @@ namespace zaaReloaded2.ViewModels
string SuggestImportExportPath() string SuggestImportExportPath()
{ {
string path = Properties.Settings.Default.ImportExportPath; string path = UserSettings.Default.ImportExportPath;
if (String.IsNullOrEmpty(path)) if (String.IsNullOrEmpty(path))
{ {
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

View File

@ -23,22 +23,36 @@
xmlns:b="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender" xmlns:b="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:action="clr-namespace:Bovender.Mvvm.Actions;assembly=Bovender" xmlns:action="clr-namespace:Bovender.Mvvm.Actions;assembly=Bovender"
SizeToContent="WidthAndHeight" ResizeMode="NoResize" ShowInTaskbar="False" SizeToContent="WidthAndHeight" ResizeMode="NoResize"
ShowInTaskbar="False" Topmost="True"
b:WindowState.CenterScreen="True" b:WindowState.Save="True" b:WindowState.CenterScreen="True" b:WindowState.Save="True"
Title="Einstellungen" Title="Einstellungen"
> >
<Window.Resources> <Window.Resources>
<ResourceDictionary Source="/Bovender;component/Style.xaml" /> <ResourceDictionary Source="/Bovender;component/Style.xaml" />
</Window.Resources> </Window.Resources>
<DockPanel Margin="10"> <DockPanel Margin="20">
<UniformGrid DockPanel.Dock="Bottom" Columns="2" Rows="1" <UniformGrid DockPanel.Dock="Bottom" Columns="2" Rows="1"
HorizontalAlignment="Right" Margin="0 10 0 0"> HorizontalAlignment="Right" Margin="0 20 0 0">
<Button Command="{Binding SaveCommand}" Content="OK" IsDefault="True" Margin="0 0 5 0" /> <Button Command="{Binding SaveCommand}" Content="OK" IsDefault="True" Margin="0 0 5 0" />
<Button Command="{Binding CloseViewCommand}" Content="Abbrechen" IsCancel="True" Margin="5 0 0 0" /> <Button Command="{Binding CloseViewCommand}" Content="Abbrechen" IsCancel="True" Margin="5 0 0 0" />
</UniformGrid> </UniformGrid>
<GroupBox Header="Sekretariatsmodus" Padding="10"> <StackPanel>
<CheckBox IsChecked="{Binding SuppressItemCommentInteraction}" Content="Keine Interaktion für _Kommentare"> <GroupBox Header="Sekretariatsmodus" Margin="0 0 0 5" Padding="10">
</CheckBox> <StackPanel>
</GroupBox> <CheckBox IsChecked="{Binding SuppressItemCommentInteraction}" Content="Keine Interaktion für _Kommentare" />
</StackPanel>
</GroupBox>
<GroupBox Header="Debugging" Margin="0 5 0 0" Padding="10">
<StackPanel>
<CheckBox IsChecked="{Binding EnableLogging}" Content="_Logfile aktivieren" />
<TextBlock Margin="0 10 0 0">
<Hyperlink Command="{Binding OpenLogFolderCommand}">
<TextBlock Text="{Binding LogFolder}" />
</Hyperlink>
</TextBlock>
</StackPanel>
</GroupBox>
</StackPanel>
</DockPanel> </DockPanel>
</Window> </Window>

View File

@ -38,11 +38,11 @@
<action:ShowViewAction View="zaaReloaded2.Views.SettingsView" Assembly="zaaReloaded2" /> <action:ShowViewAction View="zaaReloaded2.Views.SettingsView" Assembly="zaaReloaded2" />
</i:EventTrigger> </i:EventTrigger>
<i:EventTrigger SourceObject="{Binding ConfirmDeleteSettingsMessage}" EventName="Sent"> <i:EventTrigger SourceObject="{Binding ConfirmDeleteSettingsMessage}" EventName="Sent">
<action:ConfirmationAction Caption="Stil entfernen" OkButtonLabel="Ja" CancelButtonLabel="Nein" <action:ConfirmationAction Caption="Stil entfernen" OkButtonText="Ja" CancelButtonText="Nein"
Message="Soll dieser Stil wirklich unwiederbringlich entfernt werden?" /> Message="Soll dieser Stil wirklich unwiederbringlich entfernt werden?" />
</i:EventTrigger> </i:EventTrigger>
<i:EventTrigger SourceObject="{Binding ConfirmResetSettingsMessage}" EventName="Sent"> <i:EventTrigger SourceObject="{Binding ConfirmResetSettingsMessage}" EventName="Sent">
<action:ConfirmationAction Caption="Stile zurücksetzen" OkButtonLabel="Ja" CancelButtonLabel="Nein" <action:ConfirmationAction Caption="Stile zurücksetzen" OkButtonText="Ja" CancelButtonText="Nein"
Message="Sollen alle Stile gelöscht und die eingebauten Stile geladen werden?" /> Message="Sollen alle Stile gelöscht und die eingebauten Stile geladen werden?" />
</i:EventTrigger> </i:EventTrigger>
<i:EventTrigger SourceObject="{Binding ChooseExportFileNameMessage}" EventName="Sent"> <i:EventTrigger SourceObject="{Binding ChooseExportFileNameMessage}" EventName="Sent">

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
app.config app.config
@ -20,12 +20,9 @@
--> -->
<configuration> <configuration>
<configSections> <configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="zaaReloaded2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="zaaReloaded2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup> </sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="zaaReloaded2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections> </configSections>
<applicationSettings> <applicationSettings>
<zaaReloaded2.Properties.Settings> <zaaReloaded2.Properties.Settings>
@ -39,13 +36,13 @@
<value>Daniel Kraus</value> <value>Daniel Kraus</value>
</setting> </setting>
<setting name="Homepage" serializeAs="String"> <setting name="Homepage" serializeAs="String">
<value>http://zaa.nephrowiki.de</value> <value>https://doktorkraus.de/zaareloaded</value>
</setting> </setting>
<setting name="VersionInfoFile" serializeAs="String"> <setting name="VersionInfoFile" serializeAs="String">
<value>http://zaa.nephrowiki.de/versioninfo.txt</value> <value>https://doktorkraus.de/zaareloaded/versioninfo.txt</value>
</setting> </setting>
<setting name="ExceptionPostUrl" serializeAs="String"> <setting name="ExceptionPostUrl" serializeAs="String">
<value>http://zaa.nephrowiki.de/postreport.php</value> <value>https://doktorkraus.de/zaareloaded/postreport.php</value>
</setting> </setting>
<setting name="LicenseUrl" serializeAs="String"> <setting name="LicenseUrl" serializeAs="String">
<value>http://www.apache.org/licenses/LICENSE-2.0</value> <value>http://www.apache.org/licenses/LICENSE-2.0</value>
@ -84,36 +81,28 @@
<value>BITTE_ERGÄNZEN</value> <value>BITTE_ERGÄNZEN</value>
</setting> </setting>
<setting name="Repository" serializeAs="String"> <setting name="Repository" serializeAs="String">
<value>http://git.bovender.de</value> <value>https://git.bovender.de</value>
</setting> </setting>
<setting name="DrugsParagraph" serializeAs="String"> <setting name="DrugsParagraph" serializeAs="String">
<value>zaaReloaded2-Medikamente</value> <value>zaaReloaded2-Medikamente</value>
</setting> </setting>
<setting name="UserFolder" serializeAs="String">
<value>user</value>
</setting>
<setting name="AppDataFolder" serializeAs="String">
<value>zaaReloaded2</value>
</setting>
<setting name="UserSettingsFile" serializeAs="String">
<value>settings.yml</value>
</setting>
</zaaReloaded2.Properties.Settings> </zaaReloaded2.Properties.Settings>
</applicationSettings> </applicationSettings>
<userSettings> <runtime>
<zaaReloaded2.Properties.Settings> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<setting name="SettingsRepository" serializeAs="String"> <dependentAssembly>
<value /> <assemblyIdentity name="YamlDotNet" publicKeyToken="ec19458f3c15af5e" culture="neutral" />
</setting> <bindingRedirect oldVersion="0.0.0.0-3.9.0.0" newVersion="3.9.0.0" />
<setting name="LastUpdateCheck" serializeAs="String"> </dependentAssembly>
<value /> </assemblyBinding>
</setting> </runtime>
<setting name="LastSettings" serializeAs="String">
<value>00000000-0000-0000-0000-000000000000</value>
</setting>
<setting name="ImportExportPath" serializeAs="String">
<value />
</setting>
<setting name="SuppressItemCommentInteraction" serializeAs="String">
<value>False</value>
</setting>
<setting name="FirstRunWizardShown" serializeAs="String">
<value>False</value>
</setting>
<setting name="NeedUpgrade" serializeAs="String">
<value>True</value>
</setting>
</zaaReloaded2.Properties.Settings>
</userSettings>
</configuration> </configuration>

View File

@ -19,6 +19,8 @@
limitations under the License. limitations under the License.
--> -->
<packages> <packages>
<package id="Bovender" version="0.5.0.0" targetFramework="net40" /> <package id="Bovender" version="0.14.5.0" targetFramework="net40" />
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" /> <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
<package id="NLog" version="4.3.7" targetFramework="net40" />
<package id="YamlDotNet.Signed" version="3.9.0" targetFramework="net40" />
</packages> </packages>

View File

@ -134,14 +134,19 @@
--> -->
<ItemGroup> <ItemGroup>
<Reference Include="Accessibility" /> <Reference Include="Accessibility" />
<Reference Include="Bovender, Version=0.5.0.0, Culture=neutral, PublicKeyToken=df1c15557d8b6df8, processorArchitecture=MSIL"> <Reference Include="Bovender, Version=0.14.5.0, Culture=neutral, PublicKeyToken=df1c15557d8b6df8, processorArchitecture=MSIL">
<HintPath>..\packages\Bovender.0.5.0.0\lib\net40\Bovender.dll</HintPath> <HintPath>..\packages\Bovender.0.14.5.0\lib\net40\Bovender.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> <Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<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="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization.Formatters.Soap" /> <Reference Include="System.Runtime.Serialization.Formatters.Soap" />
@ -156,6 +161,10 @@
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="WindowsBase" /> <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> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.Office.Tools.v4.0.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="Microsoft.Office.Tools.v4.0.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
@ -222,10 +231,10 @@
<Compile Include="Formatter\DanielsStyle.cs" /> <Compile Include="Formatter\DanielsStyle.cs" />
<Compile Include="Formatter\DocumentWriter.cs" /> <Compile Include="Formatter\DocumentWriter.cs" />
<Compile Include="Formatter\NoLaboratoryDataException.cs" /> <Compile Include="Formatter\NoLaboratoryDataException.cs" />
<Compile Include="LogFile.cs" />
<Compile Include="Medication\Formatter.cs" /> <Compile Include="Medication\Formatter.cs" />
<Compile Include="Medication\Importer.cs" /> <Compile Include="Medication\Importer.cs" />
<Compile Include="Medication\Prescription.cs" /> <Compile Include="Medication\Prescription.cs" />
<Compile Include="Preferences.cs" />
<Compile Include="Ribbon.cs" /> <Compile Include="Ribbon.cs" />
<Compile Include="Thesaurus\ThesaurusBase.cs" /> <Compile Include="Thesaurus\ThesaurusBase.cs" />
<Compile Include="Formatter\IItemFormatterDictionary.cs" /> <Compile Include="Formatter\IItemFormatterDictionary.cs" />
@ -258,6 +267,7 @@
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Updater\Updater.cs" /> <Compile Include="Updater\Updater.cs" />
<Compile Include="UserSettings.cs" />
<Compile Include="ViewModels\AboutViewModel.cs" /> <Compile Include="ViewModels\AboutViewModel.cs" />
<Compile Include="ViewModels\CategoryViewModel.cs" /> <Compile Include="ViewModels\CategoryViewModel.cs" />
<Compile Include="ViewModels\ElementPickerViewModel.cs" /> <Compile Include="ViewModels\ElementPickerViewModel.cs" />