add-朗读及打印服务添加防重复启动

dev
liuwf 2 weeks ago
parent eaf35219a2
commit 0d7ebe7a8f

@ -12,6 +12,7 @@ using SlnMesnac.Extensions;
using SlnMesnac.Generate;
using SlnMesnac.TouchSocket;
using SlnMesnac.Redis;
using System.Threading;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
@ -42,12 +43,22 @@ namespace PrintBarCode
/// </summary>
public class Startup
{
private System.Threading.Mutex? mutex = null;
/// <summary>
///
/// </summary>
/// <param name="configuration"></param>
public Startup(IConfiguration configuration)
{
bool ret;
mutex = new System.Threading.Mutex(true, System.Diagnostics.Process.GetCurrentProcess().ProcessName, out ret);
if (!ret)
{
MessageBox.Show("应用程序已开启,禁止重复运行");
Environment.Exit(0);
}
Configuration = configuration;
}

@ -13,6 +13,7 @@ using SlnMesnac.Generate;
using SlnMesnac.TouchSocket;
using ReadService;
using SlnMesnac.Redis;
using System.Threading;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
@ -43,12 +44,20 @@ namespace ConsoleApp
/// </summary>
public class Startup
{
private System.Threading.Mutex? mutex = null;
/// <summary>
///
/// </summary>
/// <param name="configuration"></param>
public Startup(IConfiguration configuration)
{
bool ret;
mutex = new System.Threading.Mutex(true, System.Diagnostics.Process.GetCurrentProcess().ProcessName, out ret);
if (!ret)
{
Console.WriteLine("应用程序已开启,禁止重复运行");
Environment.Exit(0);
}
Configuration = configuration;
}

@ -40,7 +40,7 @@
<Border Grid.Row="1" Grid.Column="0" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,10,5,5">
<DataGrid Grid.Row="0" ItemsSource="{Binding WcsAgvStatusDataGrid}" Background="Transparent"
FontSize="20" ColumnHeaderHeight="75"
RowHeight="61" AutoGenerateColumns="False" RowHeaderWidth="0"
RowHeight="51" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="2" CanUserAddRows="False" HorizontalAlignment="Center"
Foreground="#FFFFFF" >

Loading…
Cancel
Save