Config: add debug flag
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user