Config: add debug flag
This commit is contained in:
@ -8,6 +8,7 @@ namespace Elwig.Helpers {
|
|||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
private readonly string FileName;
|
private readonly string FileName;
|
||||||
|
public bool Debug;
|
||||||
public string DatabaseFile = App.DataPath + "database.sqlite3";
|
public string DatabaseFile = App.DataPath + "database.sqlite3";
|
||||||
public string? DatabaseLog = null;
|
public string? DatabaseLog = null;
|
||||||
public string? Branch = null;
|
public string? Branch = null;
|
||||||
@ -49,6 +50,13 @@ namespace Elwig.Helpers {
|
|||||||
Branch = branch;
|
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();
|
ScaleList.Clear();
|
||||||
Scales = ScaleList;
|
Scales = ScaleList;
|
||||||
if (ini != null) {
|
if (ini != null) {
|
||||||
@ -72,6 +80,7 @@ namespace Elwig.Helpers {
|
|||||||
using var file = new StreamWriter(FileName, false, Utils.UTF8);
|
using var file = new StreamWriter(FileName, false, Utils.UTF8);
|
||||||
file.Write($"\r\n[general]\r\n");
|
file.Write($"\r\n[general]\r\n");
|
||||||
if (Branch != null) file.Write($"branch = {Branch}\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");
|
file.Write($"\r\n[database]\r\nfile = {DatabaseFile}\r\n");
|
||||||
if (DatabaseLog != null) file.Write($"log = {DatabaseLog}\r\n");
|
if (DatabaseLog != null) file.Write($"log = {DatabaseLog}\r\n");
|
||||||
foreach (var s in ScaleList) {
|
foreach (var s in ScaleList) {
|
||||||
|
@ -771,8 +771,11 @@ namespace Elwig.Windows {
|
|||||||
using var doc = new DeliveryNote(p.Delivery, Context);
|
using var doc = new DeliveryNote(p.Delivery, Context);
|
||||||
await doc.Generate();
|
await doc.Generate();
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
doc.Show();
|
if (App.Config.Debug) {
|
||||||
//await doc.Print(2);
|
doc.Show();
|
||||||
|
} else {
|
||||||
|
await doc.Print(2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FinishButton.Cursor = null;
|
FinishButton.Cursor = null;
|
||||||
DeliveryList.SelectedItem = null;
|
DeliveryList.SelectedItem = null;
|
||||||
|
@ -5,6 +5,10 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
public MainWindow() {
|
public MainWindow() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
if (!App.Config.Debug) {
|
||||||
|
TestWindowButton.Visibility = Visibility.Hidden;
|
||||||
|
//QueryWindowButton.Visibility = Visibility.Hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs evt) { }
|
private void Window_Loaded(object sender, RoutedEventArgs evt) { }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
[general]
|
[general]
|
||||||
; Only needed, if more than one branch is stored in database
|
; Only needed, if more than one branch is stored in database
|
||||||
branch = Zweigstelle
|
branch = Zweigstelle
|
||||||
|
;debug = true
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
; Relative or absolute path to database file
|
; Relative or absolute path to database file
|
||||||
|
Reference in New Issue
Block a user