add-添加自动更新组件

dev
liuwf 1 month ago
parent d6c36ff463
commit a0605cba8c

@ -80,7 +80,7 @@ namespace SlnMesnac.Business
_mesProductOrderService = serviceProvider.GetRequiredService<IMesProductOrderService>();
_baseMaterialInfoService = serviceProvider.GetRequiredService<IBaseMaterialInfoService>();
Init();
}
private void test()

@ -140,5 +140,23 @@ namespace SlnMesnac.Config
}
/// <summary>
///软件自动更新,当前版本号
/// </summary>
public string Version
{
get { return iniHelper.IniReadValue("system", "Version"); }
set { iniHelper.IniWriteValue("system", "Version", value); }
}
/// <summary>
///软件自动更新,当前程序名
/// </summary>
public string ProcessName
{
get { return iniHelper.IniReadValue("system", "ProcessName"); }
set { iniHelper.IniWriteValue("system", "ProcessName", value); }
}
}
}

@ -7,12 +7,15 @@ using OracleInternal.Sharding;
using ServiceStack;
using SlnMesnac.Business;
using SlnMesnac.Business.@base;
using SlnMesnac.Common;
using SlnMesnac.Config;
using SlnMesnac.Plc;
using SlnMesnac.TouchSocket;
using SlnMesnac.WPF.Page;
using SlnMesnac.WPF.Page.Generate;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -152,8 +155,47 @@ namespace SlnMesnac.WPF.ViewModel
StartLiseningStatus();
checkStatus();
RefreshTime();
}
/// <summary>
/// 检查版本--暂时不使用
/// </summary>
private void CheckVersion()
{
try
{
string version = HttpHelper.SendGetMessage("172.16.12.100", 5001, "wcs/RecieveRcs/version");
var vs = new Version(version);
// SystemData.VerSion
var lovs = new Version(debugConfig.Version);
if (vs > lovs)
{
var result = MessageBox.Show("有新版本是否更新?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
if (result == MessageBoxResult.Yes)
{
Process.Start("AutoUpdate.exe", new List<string>
{
version,
debugConfig.ProcessName,
// SystemData.ProcessName,
$"http://172.16.12.100:5001/wcs/RecieveRcs?fileName={debugConfig.ProcessName}.zip"
});
debugConfig.Version = version;
Application.Current.Shutdown();
Process.GetCurrentProcess().Kill();
}
}
}
catch
{
}
}
private void RefreshTime()
{
DispatcherTimer _timer = new DispatcherTimer();

Loading…
Cancel
Save