eDosStationFull/eDosStation_Backup_2025.02.04_07.47.06/App.xaml.cs

67 lines
2 KiB
C#
Raw Normal View History

2026-08-18 12:15:26 +02:00
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows;
namespace eDosStation
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
[DllImport("kernel32.dll",CharSet =CharSet.Auto, EntryPoint = "LoadLibraryEx")]
private static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, uint dwFlags);
public System.IntPtr moduleHandle;
public bool TestOrCreateFolder(string fn)
{
bool rv = true;
try
{
if (!System.IO.Directory.Exists(fn))
{
if (System.IO.File.Exists(fn)) System.IO.File.Delete(fn);
System.IO.Directory.CreateDirectory(fn);
}
}
catch { rv = false; }
return rv;
}
public string eDosPort;
public string elatecPort, elatecFirmware;
public string RFIDReader;
private void Application_Startup(object sender, StartupEventArgs e)
{
//var pth1 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "EpdBaseClr.dll");
//var pth2 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Reader2.dll");
//moduleHandle = LoadLibraryEx(pth2, IntPtr.Zero, 0);
//moduleHandle = LoadLibraryEx(pth1, IntPtr.Zero, 0);
using (var h = new LSWDevices.LSWDevicesHelper())
{
eDosPort = h.eDosPort;
elatecPort = h.ElatecPort;
elatecFirmware = h.ElatecFirmware;
RFIDReader = h.RFIDReader;
}
TestOrCreateFolder("c:/temp");
TestOrCreateFolder("c:/Logs");
}
private void Application_Exit(object sender, ExitEventArgs e)
{
Environment.Exit(0);
}
}
}