56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
using Hardcodet.Wpf.TaskbarNotification;
|
||
using Microsoft.Win32;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Configuration;
|
||
using System.Data;
|
||
using System.Diagnostics;
|
||
using System.Linq;
|
||
using System.Threading;
|
||
using System.Threading.Tasks;
|
||
using System.Windows;
|
||
using System.Windows.Interop;
|
||
using System.Windows.Media;
|
||
|
||
namespace BodyshopPartner
|
||
{
|
||
/// <summary>
|
||
/// Interaction logic for App.xaml
|
||
/// </summary>
|
||
public partial class App : Application
|
||
{
|
||
static Mutex mutex = new Mutex(false, "ImEX Online Partner");
|
||
|
||
App()
|
||
{
|
||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-MX");
|
||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-CA");
|
||
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; // Set to prevent Window black out from Material Desgin. https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/1620
|
||
// Use a name unique to the application (eg include your company URL)
|
||
// Wait 2 seconds if contended – in case another instance
|
||
// of the program is in the process of shutting down.
|
||
if (!mutex.WaitOne(TimeSpan.FromSeconds(2), false))
|
||
{
|
||
MessageBox.Show("ImEX Online Partner is already running.");
|
||
App.Current.Shutdown();
|
||
return;
|
||
}
|
||
|
||
//Set all of the constants
|
||
Utils.AppMetaData.CreateEndpoints();
|
||
}
|
||
|
||
|
||
|
||
private void Application_Exit(object sender, ExitEventArgs e)
|
||
{
|
||
|
||
|
||
mutex.ReleaseMutex();
|
||
Utils.PowerModeEventHandler.DisposeEventHandler();
|
||
BodyshopPartner.Properties.Settings.Default.Save();
|
||
Utils.QuickBooksInterop.DisconnectFromQuickBooks();
|
||
}
|
||
}
|
||
}
|