1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using AIPractice.LabellerServer.Managers;
- using System;
- using System.IO;
- using System.Linq;
- using System.Threading;
- using System.Windows;
- namespace AIPractice.LabellerServer
- {
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : Application
- {
- private LabellerServer _labellerServer;
- protected override void OnStartup(StartupEventArgs e)
- {
- if (e.Args.Contains("DelayStart"))
- {
- Thread.Sleep(3000);
- }
- if (Environment.Is64BitProcess)
- {
- File.Copy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sqlite3.x64.dll"), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sqlite3.dll"), true);
- }
- else
- {
- File.Copy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sqlite3.x86.dll"), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sqlite3.dll"), true);
- }
- ManagerContainer.RegisterManager<ILabelManager>(new LabelManager());
- ManagerContainer.RegisterManager<IDataManager>(new DataManager());
- _labellerServer = new LabellerServer();
- _labellerServer.Start();
- base.OnStartup(e);
- }
- protected override void OnExit(ExitEventArgs e)
- {
- _labellerServer.Stop();
- base.OnExit(e);
- }
- }
- }
|