fyf pirms 1 gada
vecāks
revīzija
fd8b4a797d
3 mainītis faili ar 68 papildinājumiem un 4 dzēšanām
  1. +1
    -1
      BPASmartClient.ScreenLib/AppMain.cs
  2. +66
    -2
      BPASmartClient.ScreenLib/Helper/Main.cs
  3. +1
    -1
      BPASmartClient.ScreenSplitMeals/App.config

+ 1
- 1
BPASmartClient.ScreenLib/AppMain.cs Parādīt failu

@@ -18,7 +18,7 @@ namespace BPASmartClient.ScreenLib
//启动Redis数据读取
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
FSystemHelper.GetInstance.CreateDesktopShortcut();
// FSystemHelper.GetInstance.AutoStart(true);
//FSystemHelper.GetInstance.AutoStart(true);
WindowLargeScreen windowLarge = new WindowLargeScreen();
#region 设置显示页面与标题
string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}";


+ 66
- 2
BPASmartClient.ScreenLib/Helper/Main.cs Parādīt failu

@@ -5,6 +5,7 @@ using IWshRuntimeLibrary;
using Microsoft.Web.WebView2.Wpf;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
@@ -168,12 +169,35 @@ namespace BPASmartClient.ScreenLib
/// </summary>
public void StartServer()
{
string path = System.Configuration.ConfigurationManager.AppSettings["StartServer"].ToString();
string processName = "";
try
{
string path = System.Configuration.ConfigurationManager.AppSettings["StartServer"].ToString();
if (System.IO.File.Exists(path))
{
Process.Start(path);
processName = System.IO.Path.GetFileNameWithoutExtension(path);
if (!IsProcess(processName))
{
Process.Start(path);
}


ThreadManage.GetInstance().StartLong(new Action(() =>
{
try
{
if (!IsProcess(processName))
{
Process.Start(path);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"{Name}:线程服务异常,原因:{ex.Message}");
}
Thread.Sleep(3000);
}), $"{Name},进程监控");
}
}
catch (Exception ex)
@@ -181,6 +205,46 @@ namespace BPASmartClient.ScreenLib

}
}

public bool IsProcess(string procName)
{
bool isProcess = false;
Process[] ps = Process.GetProcessesByName(procName);
if (ps.Length > 0)
{
isProcess=true;
}
return isProcess;
}
/// <summary>
/// 关闭进程
/// </summary>
/// <param name="procName"></param>
/// <returns></returns>
public bool CloseProc(string procName)
{
bool result = false;
ArrayList procList = new ArrayList();
string tempName;
int begpos;
int endpos;
foreach (Process thisProc in Process.GetProcesses())
{
tempName = thisProc.ToString();
begpos = tempName.IndexOf("(") + 1;
endpos = tempName.IndexOf(")");
tempName = tempName[begpos..endpos];
procList.Add(tempName);
if (tempName == procName)
{
if (!thisProc.CloseMainWindow())
// 当发送关闭窗口命令无效时强行结束进程
thisProc.Kill();
result = true;
}
}
return result;
}
/// <summary>
/// 停止服务
/// </summary>


+ 1
- 1
BPASmartClient.ScreenSplitMeals/App.config Parādīt failu

@@ -9,7 +9,7 @@
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/>
<!--显示窗体:0 广告 1 地球-->
<add key="ShowForm" value="1"/>
<add key="StartServer" value="D:\fengyoufu\代码\Code\C#项目\收银系统\Pos\bin\Debug\net6.0-windows\黑菠萝收银系统.exe"/>
<add key="StartServer" value="D:\fengyoufu\代码\Code\C#项目\新上位机代码\BPASmart.MenuLoad\bin\Debug\net6.0-windows\可视化配置工具.exe"/>
<!--<add key="一号屏" value="0"/>
<add key="二号屏" value="1"/>
<add key="三号屏" value="2"/>-->


Notiek ielāde…
Atcelt
Saglabāt