Files
bodyshop-uploader/BodyshopUploader/App.xaml.cs
2021-04-13 11:10:20 -07:00

42 lines
1.3 KiB
C#

using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace BodyshopPartner
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
App()
{
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-MX");
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-CA");
Process proc = Process.GetCurrentProcess();
int count = Process.GetProcesses().Where(p =>
p.ProcessName == proc.ProcessName).Count();
if (count > 1)
{
MessageBox.Show("ImEX Online Partner is already running.");
App.Current.Shutdown();
}
}
private void Application_Exit(object sender, ExitEventArgs e)
{
Utils.PowerModeEventHandler.DisposeEventHandler();
BodyshopPartner.Properties.Settings.Default.Save();
Utils.QuickBooksInterop.DisconnectFromQuickBooks();
}
}
}