Files
bodyshop-uploader/BodyshopUploader/App.xaml.cs
2023-02-24 15:51:37 -08:00

56 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 RomeOnlinePartner
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
static Mutex mutex = new Mutex(false, "Rome 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("Rome 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();
RomeOnlinePartner.Properties.Settings.Default.Save();
Utils.QuickBooksInterop.DisconnectFromQuickBooks();
}
}
}