-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
76 lines (64 loc) · 2.39 KB
/
App.xaml.cs
File metadata and controls
76 lines (64 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Windows;
using AppArguments;
using DBF.Helpers;
using GithubTools;
using Microsoft.VisualBasic.Devices;
using Syncfusion.UI.Xaml.Maps;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace DBF
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private Github _github = new Github("DBF");
protected override void OnStartup(StartupEventArgs e)
{
Arguments.Parse(validArgs, requiredArgs, showHelp);
#if (RELEASE || PRODTEST)
if (Arguments.Values.Lookup("mode") == "restart")
_github.MarkAppStarted();
else
_github.UpdateAndMarkAppStarted();
#endif
base.OnStartup(e);
}
protected override void OnExit(ExitEventArgs e)
{
_github.MarkAppExitedNormally();
base.OnExit(e);
}
#region Argument handling
private static Dictionary<string, string[]> validArgs = new Dictionary<string, string[]>
{ {"mode", new[] { "normal", "restart"}}
, {"debug", new[] { "false", "true","" }}
};
private static string[] requiredArgs = new string[0];
private static void showHelp(string msg, bool exitProgram)
{
string helpText = @"
🔧 DBF Tools Help
====================
Usages:
DBF.exe [mode:MyMode]
Parameters:
mode : normal | restart
normal : Normal start of program (default)
restart : Restart using last saved timer states
debug : true | false (default=false) - Only for testing, so debugger can be attached
Example:
DBF.exe mode:restart debug=true";
if (string.IsNullOrWhiteSpace(msg))
new MessageWindow( helpText).ShowDialog();
else
new MessageWindow(msg + "\n\n" + helpText).ShowDialog();
if (exitProgram)
Environment.Exit(1);
}
#endregion
}
}