Release for 1.0.15 to fix mutex + black out.
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
using Microsoft.Win32;
|
||||
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
|
||||
{
|
||||
@@ -15,24 +19,32 @@ namespace BodyshopPartner
|
||||
/// </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");
|
||||
|
||||
Process proc = Process.GetCurrentProcess();
|
||||
int count = Process.GetProcesses().Where(p =>
|
||||
p.ProcessName == proc.ProcessName).Count();
|
||||
|
||||
if (count > 1)
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Application_Exit(object sender, ExitEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
mutex.ReleaseMutex();
|
||||
Utils.PowerModeEventHandler.DisposeEventHandler();
|
||||
BodyshopPartner.Properties.Settings.Default.Save();
|
||||
Utils.QuickBooksInterop.DisconnectFromQuickBooks();
|
||||
|
||||
@@ -118,12 +118,6 @@
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="ToastNotifications, Version=2.5.1.0, Culture=neutral, PublicKeyToken=e89d9d7314a7c797, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ToastNotifications.2.5.1\lib\net40\ToastNotifications.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ToastNotifications.Messages, Version=2.5.1.0, Culture=neutral, PublicKeyToken=e89d9d7314a7c797, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ToastNotifications.Messages.2.5.1\lib\net40\ToastNotifications.Messages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
||||
@@ -51,7 +51,7 @@ using System.Windows;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.15.0")]
|
||||
[assembly: AssemblyVersion("1.0.16.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
//Setting Squirrel Aware Version.
|
||||
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
||||
@@ -222,6 +222,15 @@ namespace BodyshopPartner.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show.
|
||||
/// </summary>
|
||||
public static string Label_Show {
|
||||
get {
|
||||
return ResourceManager.GetString("Label_Show", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Source System.
|
||||
/// </summary>
|
||||
|
||||
@@ -171,6 +171,9 @@
|
||||
<data name="Label_Restart" xml:space="preserve">
|
||||
<value>_Restart</value>
|
||||
</data>
|
||||
<data name="Label_Show" xml:space="preserve">
|
||||
<value>Show</value>
|
||||
</data>
|
||||
<data name="Label_SourceSystem" xml:space="preserve">
|
||||
<value>Source System</value>
|
||||
</data>
|
||||
|
||||
@@ -24,4 +24,6 @@ B267713EE688D7AE11DF601300DD009BE489C3F7 ImEXOnlinePartner-1.0.11-delta.nupkg 91
|
||||
11E3C5D192C4832CFBE46243BB7AA36B27BF3C4C ImEXOnlinePartner-1.0.13-delta.nupkg 29519
|
||||
B5D1B3BBD5962AE5AE9650B50956C8CF8C5EBEB9 ImEXOnlinePartner-1.0.13-full.nupkg 5147044
|
||||
AFC97D32A72155DDCDC9FA0C42E0E0309FD80E1A ImEXOnlinePartner-1.0.14-delta.nupkg 52030
|
||||
3D90B05D7BF821194DF934A09DE33CD850350148 ImEXOnlinePartner-1.0.14-full.nupkg 5147961
|
||||
3D90B05D7BF821194DF934A09DE33CD850350148 ImEXOnlinePartner-1.0.14-full.nupkg 5147961
|
||||
8A9B92246C6518FE21644AADF548FDDD18548812 ImEXOnlinePartner-1.0.15-delta.nupkg 45479
|
||||
08370231115AB8CBAF7F96F73096C76250BCB6DB ImEXOnlinePartner-1.0.15-full.nupkg 5148126
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BodyshopPartner.ViewModels
|
||||
@@ -32,8 +33,13 @@ namespace BodyshopPartner.ViewModels
|
||||
{
|
||||
_openMainWindowCommand = new RelayCommand(
|
||||
p => true,
|
||||
p => Console.WriteLine("nada")
|
||||
); ;
|
||||
p =>
|
||||
{
|
||||
((Window)p).Show();
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
return _openMainWindowCommand;
|
||||
}
|
||||
@@ -81,7 +87,7 @@ namespace BodyshopPartner.ViewModels
|
||||
_startFolderMonitorsCommand = new RelayCommand(
|
||||
p => MonitoringPaths.Count > 0 && ActiveShop != null,
|
||||
p => StartAllFolderMonitors()
|
||||
) ;
|
||||
);
|
||||
}
|
||||
return _startFolderMonitorsCommand;
|
||||
}
|
||||
@@ -148,7 +154,7 @@ namespace BodyshopPartner.ViewModels
|
||||
async p =>
|
||||
{
|
||||
await InstallUpdates();
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
return _installUpdatesCommand;
|
||||
|
||||
@@ -56,11 +56,12 @@
|
||||
|
||||
<tb:TaskbarIcon DockPanel.Dock="Top"
|
||||
IconSource="../favicon.ico"
|
||||
DoubleClickCommand="{StaticResource OpenMainWindowCommand}"
|
||||
DoubleClickCommand="{Binding OpenMainWindowCommand}"
|
||||
DoubleClickCommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
|
||||
PopupActivation="LeftClick"
|
||||
MenuActivation="RightClick"
|
||||
ToolTipText="Bodyshop Uploader">
|
||||
<tb:TaskbarIcon.TrayPopup>
|
||||
>
|
||||
<!--<tb:TaskbarIcon.TrayPopup>
|
||||
<Border Background="{DynamicResource MaterialDesignPaper}"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="2">
|
||||
@@ -95,9 +96,12 @@
|
||||
</ItemsControl>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</tb:TaskbarIcon.TrayPopup>
|
||||
</tb:TaskbarIcon.TrayPopup>-->
|
||||
<tb:TaskbarIcon.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.Label_Show}"
|
||||
Command="{Binding OpenMainWindowCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />
|
||||
<MenuItem Header="{x:Static p:Resources.Label_Restart}"
|
||||
Command="{Binding StartFolderMonitorsCommand}" />
|
||||
<MenuItem Header="{x:Static p:Resources.Label_StopAllMonitors}"
|
||||
@@ -131,9 +135,9 @@
|
||||
Content="{x:Static p:Resources.Label_AutoStartMonitor}" />
|
||||
<CheckBox IsChecked="{Binding Source={x:Static p:Settings.Default}, Path=StartWithWindows}"
|
||||
Margin="8"
|
||||
Content="{x:Static p:Resources.Label_StartWithWindows}"
|
||||
Content="{x:Static p:Resources.Label_StartWithWindows}"
|
||||
Command="{Binding StartWithWindowsCommand}"
|
||||
CommandParameter="{Binding Source={x:Static p:Settings.Default}, Path=StartWithWindows}"/>
|
||||
CommandParameter="{Binding Source={x:Static p:Settings.Default}, Path=StartWithWindows}" />
|
||||
|
||||
<Button Command="{Binding AddMonitoringPathCommand, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="8"
|
||||
|
||||
@@ -32,10 +32,10 @@ namespace BodyshopPartner.Views
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
//e.Cancel = true ;
|
||||
//this.Hide();
|
||||
Utils.HTTPServer.tokenSource.Cancel();
|
||||
Application.Current.Shutdown();
|
||||
e.Cancel = true;
|
||||
this.Hide();
|
||||
//Utils.HTTPServer.tokenSource.Cancel();
|
||||
//Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user