Program.cs
3.21 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using Emgu.CV;
using MoyaSignup.Dataclasses;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace MoyaSignup
{
static class Program
{
public static DebugWriteListener DebugWListener;
public static Form1 Form1;
public static LogForm LogFrm;
public static DateTime HeartBeat = System.DateTime.Now;
public static string AppDataPath = "";
public static List<DsDeviceContainer> CaptureDevices;
public static List<Capture> WebCams;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (!Debugger.IsAttached)
{
if (args.Length == 0 || args[0] != "-noautoupdate")
{
if (AutoUpdateLib.AutoUpdateCore.CheckForUpdates(null))
return; //program is required to close by autoupdate (probably updated)
}
}
System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
Version appVersion = a.GetName().Version;
string appVersionString = appVersion.ToString();
if (Properties.Settings.Default.ApplicationVersion != appVersion.ToString())
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.ApplicationVersion = appVersionString;
}
AppDataPath = Path.Combine(Application.LocalUserAppDataPath, "MoyaSignup");
if (!Directory.Exists(AppDataPath))
Directory.CreateDirectory(AppDataPath);
Directory.SetCurrentDirectory(AppDataPath);
DebugWListener = new DebugWriteListener("debug.log");
Debug.Listeners.Add(DebugWListener);
Debug.WriteLine("[program] Opened debug log");
Directory.SetCurrentDirectory(Application.StartupPath);
//HeartBeatMonitor hbmon = new HeartBeatMonitor();
Form1 = new Form1();
Form1.KeyUp += Form1_KeyUp;
Application.Run(Form1);
Debug.Close();
//hbmon.Stop();
}
private static void Form1_KeyUp(object sender, KeyEventArgs e)
{
if (e.Alt && e.Control && e.KeyCode == Keys.S)
{
Debug.WriteLine("[program] Catched key event alt + ctrl + S: Shutting down the program.");
Form1.AllowShutdown = true;
//allowShutdown = true;
Application.Exit();
return;
} else if(e.Alt && e.Control && e.KeyCode == Keys.C)
{
//WebCamViewForm frm = new WebCamViewForm(webCams);
//frm.Show();
}
else if (e.Alt && e.KeyCode == Keys.F5)
{
//userDetailsEditor1.SetPrinter(ThermoPrinterLibrary.ThermoPrinter.Models.IDP3210);
//MessageBox.Show("Printteri: IDP3210");
}
}
}
}