Compare commits
2 Commits
b2a78907cf
...
7f01b85878
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f01b85878 | |||
| a659d07db2 |
@@ -8,6 +8,7 @@ namespace Elwig.Helpers {
|
||||
public class Config {
|
||||
|
||||
private readonly string FileName;
|
||||
public bool Debug;
|
||||
public string DatabaseFile = App.DataPath + "database.sqlite3";
|
||||
public string? DatabaseLog = null;
|
||||
public string? Branch = null;
|
||||
@@ -49,6 +50,13 @@ namespace Elwig.Helpers {
|
||||
Branch = branch;
|
||||
}
|
||||
|
||||
if (ini == null || !ini.TryGetKey("general.debug", out string debug)) {
|
||||
Debug = false;
|
||||
} else {
|
||||
debug = debug.ToLower();
|
||||
Debug = debug == "1" || debug == "true" || debug == "yes" || debug == "on";
|
||||
}
|
||||
|
||||
ScaleList.Clear();
|
||||
Scales = ScaleList;
|
||||
if (ini != null) {
|
||||
@@ -72,6 +80,7 @@ namespace Elwig.Helpers {
|
||||
using var file = new StreamWriter(FileName, false, Utils.UTF8);
|
||||
file.Write($"\r\n[general]\r\n");
|
||||
if (Branch != null) file.Write($"branch = {Branch}\r\n");
|
||||
if (Debug) file.Write("debug = true\r\n");
|
||||
file.Write($"\r\n[database]\r\nfile = {DatabaseFile}\r\n");
|
||||
if (DatabaseLog != null) file.Write($"log = {DatabaseLog}\r\n");
|
||||
foreach (var s in ScaleList) {
|
||||
|
||||
@@ -771,8 +771,11 @@ namespace Elwig.Windows {
|
||||
using var doc = new DeliveryNote(p.Delivery, Context);
|
||||
await doc.Generate();
|
||||
Mouse.OverrideCursor = null;
|
||||
doc.Show();
|
||||
//await doc.Print(2);
|
||||
if (App.Config.Debug) {
|
||||
doc.Show();
|
||||
} else {
|
||||
await doc.Print(2);
|
||||
}
|
||||
}
|
||||
FinishButton.Cursor = null;
|
||||
DeliveryList.SelectedItem = null;
|
||||
|
||||
@@ -5,6 +5,10 @@ namespace Elwig.Windows {
|
||||
|
||||
public MainWindow() {
|
||||
InitializeComponent();
|
||||
if (!App.Config.Debug) {
|
||||
TestWindowButton.Visibility = Visibility.Hidden;
|
||||
//QueryWindowButton.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs evt) { }
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
[general]
|
||||
; Only needed, if more than one branch is stored in database
|
||||
branch = Zweigstelle
|
||||
;debug = true
|
||||
|
||||
[database]
|
||||
; Relative or absolute path to database file
|
||||
|
||||
@@ -72,14 +72,14 @@ namespace Tests {
|
||||
[Test]
|
||||
public void Test_SplitAddress() {
|
||||
Assert.Multiple(() => {
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<EFBFBD>e 1"), Is.EqualTo(("Winzerstra<EFBFBD>e", "1")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstraße 1"), Is.EqualTo(("Winzerstraße", "1")));
|
||||
Assert.That(Utils.SplitAddress("Auf dem Feld 12"), Is.EqualTo(("Auf dem Feld", "12")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<EFBFBD>e 5a"), Is.EqualTo(("Winzerstra<EFBFBD>e", "5a")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<EFBFBD>e 1-3/2"), Is.EqualTo(("Winzerstra<EFBFBD>e", "1-3/2")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<EFBFBD>e 3/4/5"), Is.EqualTo(("Winzerstra<EFBFBD>e", "3/4/5")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<EFBFBD>e 7/2/4/77"), Is.EqualTo(("Winzerstra<EFBFBD>e", "7/2/4/77")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<EFBFBD>e 95b"), Is.EqualTo(("Winzerstra<EFBFBD>e", "95b")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<EFBFBD>e 1, TOP 3"), Is.EqualTo(("Winzerstra<EFBFBD>e", "1, TOP 3")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstraße 5a"), Is.EqualTo(("Winzerstraße", "5a")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstraße 1-3/2"), Is.EqualTo(("Winzerstraße", "1-3/2")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstraße 3/4/5"), Is.EqualTo(("Winzerstraße", "3/4/5")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstraße 7/2/4/77"), Is.EqualTo(("Winzerstraße", "7/2/4/77")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstraße 95b"), Is.EqualTo(("Winzerstraße", "95b")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstraße 1, TOP 3"), Is.EqualTo(("Winzerstraße", "1, TOP 3")));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user