Commit 0611b64c 刘韬

语言翻译连接到smf服务器

1 个父辈 83e877cb
......@@ -68,6 +68,7 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Collections.NonGeneric, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Collections.NonGeneric.4.3.0\lib\net46\System.Collections.NonGeneric.dll</HintPath>
......@@ -218,6 +219,12 @@
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="resources\en-US.lngres">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="resources\ja-JP.lngres">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="resources\language.resource">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......@@ -230,7 +237,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="resources\ResourceMap.csv">
<None Include="resources\zh-CN.lngres">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
......
......@@ -68,7 +68,7 @@ namespace OnlineStore.ACSingleStore
{
if (CurrLanguage.Equals(ResourceCulture.CurrLanguage))
{
return;
//return;
}
string className = this.ClassName;
CurrLanguage = ResourceCulture.CurrLanguage;
......
......@@ -162,6 +162,7 @@ namespace OnlineStore.ACSingleStore
string str = ConfigAppSettings.GetValue(Setting_Init.Default_Language);
LogUtil.info("默认语言:" + str);
ResourceCulture.SetCurrentCulture(str);
ResourceCulture.LanguageReload += ResourceCulture_LanguageReload;
LogUtil.logBox = this.richTextBox1;
initValue();
this.ShowInTaskbar = true;
......@@ -221,6 +222,12 @@ namespace OnlineStore.ACSingleStore
}
private void ResourceCulture_LanguageReload(object sender, EventArgs e)
{
this.LanguageProcess();
LanguagePro();
}
private void AddForm<T>(string text, T form) where T : Form
{
TabPage lineTabPage = new TabPage(text);
......
......@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore d6afcf61f69f86354ab33fb351e3c50845d3f3da")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore 83e877cb53ebc04ada5946366bce97c40db9a113")]
[assembly: AssemblyCopyright("Copyright ? 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
......@@ -89,6 +89,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="util\ScanCodeManager.cs" />
<Compile Include="util\SMF.cs" />
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" />
......
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.Common
{
public class SMF
{
static string _server= ConfigAppSettings.GetValue(Setting_Init.http_server);
static string server
{
get
{
_server = "http://192.168.1.243/smf-core";
if (_server.EndsWith("/")) {
return _server.Remove(_server.Length-1,1);
}
else
return _server;
}
}
public static bool UploadJsonData(string api, string json,out SmfResult smfResult)
{
smfResult = new SmfResult();
try
{
MyWebClient wc = new MyWebClient(10 * 1000);
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
var resp = wc.UploadData(server+api, Encoding.UTF8.GetBytes(json));
smfResult = JsonHelper.DeserializeJsonToObject<SmfResult>(Encoding.UTF8.GetString(resp));
}
catch (Exception e) {
LogUtil.info($"UploadJsonData:{api}"+e.ToString());
}
return smfResult.okResult;
}
public static List<SmfLangData> DownloadLngData()
{
string api = "/api/translation/resource?type=siso";
try
{
MyWebClient wc = new MyWebClient(10 * 1000);
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
var resp = wc.DownloadData(server + api);
var jsondata = Encoding.UTF8.GetString(resp);
return JsonConvert.DeserializeObject<List<SmfLangData>>(jsondata);
}
catch (Exception e)
{
LogUtil.info($"DownloadLngData:{api}" + e.ToString());
}
return new List<SmfLangData>();
}
}
//{"code":0,"data":"ok","msg":"ok","msgKey":"smfcore.ok","okResult":true}
public class SmfResult {
public int code;
public string data;
public string msg;
public string msgKey;
public bool okResult;
}
public class SmfLangData {
public string lanCode;
public Dictionary<string, string> resourceMap;
}
}
......@@ -2190,7 +2190,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("收到服务器命令:op=" + resultOperation.op + ",未找到对应处理");
}
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 200)
if (span.TotalMilliseconds > 600)
{
LogUtil.info(StoreName + "TimerProcess[" + span.TotalMilliseconds + "]");
}
......
......@@ -13,6 +13,7 @@ namespace OnlineStore.DeviceLibrary
{
Thread DoorRunMonitorThread;
int DoorAccSpeed = 0;
void InitDoorRunMonitor() {
DoorRunMonitorThread = new Thread(new ThreadStart(DoorRunMonitor));
DoorRunMonitorThread.Start();
......@@ -163,7 +164,7 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg(ResourceControl.WaitSingleTimeOut, "Motor_Error","Low");
continue;
}
if (!!SafetyLightCurtains && IOManager.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.LOW))
if (!SafetyLightCurtains && IOManager.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.LOW))
{
DoorStop(false);
SafetyLightCurtains = true;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!