Commit 1cbf2cc2 LN

增加中英文

1 个父辈 26c8ece9
......@@ -76,6 +76,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="FormManager.cs" />
<Compile Include="FrmLanguare.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmLanguare.Designer.cs">
<DependentUpon>FrmLanguare.cs</DependentUpon>
</Compile>
<Compile Include="FrmAxisDebug.cs">
<SubType>Form</SubType>
</Compile>
......@@ -121,12 +127,16 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceCulture.cs" />
<Compile Include="useControl\AxisMoveControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="useControl\AxisMoveControl.Designer.cs">
<DependentUpon>AxisMoveControl.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="FrmLanguare.resx">
<DependentUpon>FrmLanguare.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmAxisDebug.resx">
<DependentUpon>FrmAxisDebug.cs</DependentUpon>
</EmbeddedResource>
......@@ -161,6 +171,9 @@
<EmbeddedResource Include="useControl\AxisMoveControl.resx">
<DependentUpon>AxisMoveControl.cs</DependentUpon>
</EmbeddedResource>
<None Include="resource\language.resource">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......@@ -170,6 +183,9 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="resource\ResourceMap.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
......
......@@ -37,7 +37,8 @@
<add key="UseAIOBOX" value="1"/>
<!--是否使用蜂鸣器-->
<add key ="UseBuzzer" value ="1"/>
<add key ="StartScan_CMD" value ="S"/>
<add key ="StartScan_CMD" value ="S"/>
<add key ="ShowLanguageMsg" value ="1"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......@@ -50,6 +51,25 @@
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="ResourcesLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/ResourcesLog.log"/>
<param name="Encoding" value="UTF-8" />
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="ResourcesLog">
<level value="Info" />
<appender-ref ref="ResourcesLog" />
</logger>
<root>
<level value="Info"/>
<appender-ref ref="RollingLogFileAppender"/>
......
......@@ -69,7 +69,7 @@ namespace OnlineStore.ACSingleStore
{
return true;
}
MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
MyMessage.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
private void btnMiddleMove_MouseDown(object sender, MouseEventArgs e)
......@@ -84,7 +84,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MyMessage.Show("请先输入正确的速度");
return;
}
btnMiddleMove.BackColor = Color.Green;
......@@ -113,7 +113,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MyMessage.Show("请先输入正确的速度");
return;
}
btnUpDownMove.BackColor = Color.Green;
......@@ -137,13 +137,13 @@ namespace OnlineStore.ACSingleStore
{
if (StoreManager.Store.InOutAxisCanMove().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MyMessage.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int speed = FormUtil.GetIntValue(txtInOutSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MyMessage.Show( "请先输入正确的速度");
return;
}
this.btnInOutMove.BackColor = Color.Green;
......@@ -171,7 +171,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MyMessage.Show("请先输入正确的速度");
return;
}
this.btnMiddleMovej.BackColor = Color.Green;
......@@ -200,7 +200,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MyMessage.Show("请先输入正确的速度");
return;
}
btnUpDownMovej.BackColor = Color.Green;
......@@ -224,13 +224,13 @@ namespace OnlineStore.ACSingleStore
{
if (StoreManager.Store.InOutAxisCanMove().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MyMessage.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int speed = FormUtil.GetIntValue(txtInOutSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MyMessage.Show("请先输入正确的速度");
return;
}
this.btnInOutMovej.BackColor = Color.Green;
......@@ -254,7 +254,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtComSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MyMessage.Show("请先输入正确的速度");
return;
}
this.btnComMove.BackColor = Color.Green;
......@@ -276,7 +276,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtComSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MyMessage.Show("请先输入正确的速度");
return;
}
this.btnComMovej.BackColor = Color.Green;
......@@ -351,7 +351,7 @@ namespace OnlineStore.ACSingleStore
private void trackBar1_ValueChanged(object sender, EventArgs e)
{
int value = trackBar1.Value;
lblSpeed.Text = "点动速度=" + (value / 10f) + "倍目标速度";
lblSpeed.Text = ResourceCulture.GetString("点动速度")+ " = " + (value / 10f) + ResourceCulture.GetString("倍目标速度");
txtMiddleSpeed.Text = (middle.TargetSpeed * value / 10).ToString();
txtInOutSpeed.Text = (inout.TargetSpeed * value / 10).ToString();
......
......@@ -42,6 +42,7 @@
this.Name = "FrmBase";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FrmBase";
this.VisibleChanged += new System.EventHandler(this.FrmBase_VisibleChanged);
this.ResumeLayout(false);
}
......
......@@ -53,7 +53,81 @@ namespace OnlineStore.ACSingleStore
}
public FrmBase()
{
InitializeComponent();
}
InitializeComponent();
}
public string CurrLanguage = "";
public string ClassName
{
get
{
return this.GetType().Name;
}
set
{
}
}
public void LanguageProcess()
{
if (CurrLanguage.Equals(ResourceCulture.CurrLanguage))
{
return;
}
string className = this.ClassName;
CurrLanguage = ResourceCulture.CurrLanguage;
this.Text = ResourceCulture.GetString(ResourceCulture.GetTextIdStr(className), this.Text);
foreach (Control con in this.Controls)
{
if (con is Label || con is Button || con is RadioButton || con is CheckBox)
{
string newStr = ResourceCulture.GetString(ResourceCulture.GetTextIdStr(className, con.Name), con.Text);
con.Text = newStr;
con.Tag = newStr;
}
else if (con.Controls.Count > 0)
{
PreControlLanaguage(con);
}
}
}
private void PreControlLanaguage(Control partentControl)
{
if (partentControl is UserFromControl.IOTextControl )
{
return;
}else if(partentControl is TableLayoutPanel)
{
return;
}
string className = this.ClassName;
partentControl.Text = ResourceCulture.GetString(ResourceCulture.GetTextIdStr(className, partentControl.Name), partentControl.Text);
foreach (Control con in partentControl.Controls)
{
if (con is Label || con is Button || con is RadioButton || con is CheckBox)
{
string newStr = ResourceCulture.GetString(ResourceCulture.GetTextIdStr(className, con.Name), con.Text);
con.Text = newStr;
}
else if (con.Controls.Count > 0)
{
PreControlLanaguage(con);
}
}
}
private void FrmBase_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible.Equals(true))
{
LanguageProcess();
LanguagePro();
}
}
public virtual void LanguagePro()
{
}
}
}
......@@ -108,7 +108,7 @@ namespace OnlineStore.ACSingleStore
}
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(ex.StackTrace, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error(LOGGER, ex.StackTrace);
}
}
......
namespace OnlineStore.ACSingleStore
{
partial class FrmLanguare
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.rbtnEnglish = new System.Windows.Forms.RadioButton();
this.rbtnChina = new System.Windows.Forms.RadioButton();
this.SuspendLayout();
//
// btnCancel
//
this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(238, 187);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(122, 45);
this.btnCancel.TabIndex = 283;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOk
//
this.btnOk.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOk.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOk.Location = new System.Drawing.Point(77, 187);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(122, 45);
this.btnOk.TabIndex = 282;
this.btnOk.Text = "确定";
this.btnOk.UseVisualStyleBackColor = false;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// rbtnEnglish
//
this.rbtnEnglish.AutoSize = true;
this.rbtnEnglish.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.rbtnEnglish.Location = new System.Drawing.Point(198, 113);
this.rbtnEnglish.Name = "rbtnEnglish";
this.rbtnEnglish.Size = new System.Drawing.Size(60, 25);
this.rbtnEnglish.TabIndex = 281;
this.rbtnEnglish.TabStop = true;
this.rbtnEnglish.Text = "英文";
this.rbtnEnglish.UseVisualStyleBackColor = true;
//
// rbtnChina
//
this.rbtnChina.AutoSize = true;
this.rbtnChina.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.rbtnChina.Location = new System.Drawing.Point(198, 59);
this.rbtnChina.Name = "rbtnChina";
this.rbtnChina.Size = new System.Drawing.Size(60, 25);
this.rbtnChina.TabIndex = 280;
this.rbtnChina.TabStop = true;
this.rbtnChina.Text = "中文";
this.rbtnChina.UseVisualStyleBackColor = true;
//
// FrmLanguare
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(456, 274);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.rbtnEnglish);
this.Controls.Add(this.rbtnChina);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmLanguare";
this.Text = "语言设置";
this.Load += new System.EventHandler(this.FrmLanguare_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.RadioButton rbtnEnglish;
private System.Windows.Forms.RadioButton rbtnChina;
}
}
\ No newline at end of file

using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
{
public partial class FrmLanguare : FrmBase
{
public FrmLanguare( )
{
InitializeComponent();
}
private void FrmLanguare_Load(object sender, EventArgs e)
{
LanguageProcess();
if (ResourceCulture.CurrLanguage.Equals(ResourceCulture.English))
{
rbtnEnglish.Checked = true;
}
else
{
rbtnChina.Checked = true;
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOk_Click(object sender, EventArgs e)
{
string str = ConfigAppSettings.GetValue(Setting_Init.Default_Language);
if (rbtnEnglish.Checked)
{
str = ResourceCulture.English;
}
else
{
str = ResourceCulture.China;
}
ResourceCulture.SetCurrentCulture(str);
ConfigAppSettings.SaveValue(Setting_Init.Default_Language, str);
this.Close();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -63,8 +63,8 @@ namespace OnlineStore.ACSingleStore
}
else
{
// this.DialogResult = DialogResult.No;
MessageBox.Show("请输入正确的密码");
// this.DialogResult = DialogResult.No;
MyMessage.Show("请输入正确的密码");
txtPwd.Focus();
}
}
......
......@@ -47,6 +47,7 @@
this.btnAxisP = new System.Windows.Forms.Button();
this.btnIO = new System.Windows.Forms.Button();
this.tabPage6 = new System.Windows.Forms.TabPage();
this.btnLan = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.btnClearL = new System.Windows.Forms.Button();
this.btnLogDebug = new System.Windows.Forms.Button();
......@@ -228,7 +229,7 @@
this.tabControl2.Controls.Add(this.tabPage4);
this.tabControl2.Controls.Add(this.tabPage5);
this.tabControl2.Controls.Add(this.tabPage6);
this.tabControl2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabControl2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabControl2.Location = new System.Drawing.Point(6, 4);
this.tabControl2.Name = "tabControl2";
this.tabControl2.SelectedIndex = 0;
......@@ -244,10 +245,10 @@
this.tabPage4.Controls.Add(this.btnSotreReset);
this.tabPage4.Controls.Add(this.btnStoreStop);
this.tabPage4.Controls.Add(this.btnStoreStart);
this.tabPage4.Location = new System.Drawing.Point(4, 30);
this.tabPage4.Location = new System.Drawing.Point(4, 29);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(1072, 46);
this.tabPage4.Size = new System.Drawing.Size(1072, 47);
this.tabPage4.TabIndex = 0;
this.tabPage4.Text = " 料仓操作 ";
this.tabPage4.UseVisualStyleBackColor = true;
......@@ -256,10 +257,10 @@
//
this.chbBuzzer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chbBuzzer.AutoSize = true;
this.chbBuzzer.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbBuzzer.Location = new System.Drawing.Point(683, 13);
this.chbBuzzer.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbBuzzer.Location = new System.Drawing.Point(694, 13);
this.chbBuzzer.Name = "chbBuzzer";
this.chbBuzzer.Size = new System.Drawing.Size(109, 25);
this.chbBuzzer.Size = new System.Drawing.Size(98, 24);
this.chbBuzzer.TabIndex = 271;
this.chbBuzzer.Text = "启用蜂鸣器";
this.chbBuzzer.UseVisualStyleBackColor = true;
......@@ -291,10 +292,10 @@
//
this.chbAuto.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chbAuto.AutoSize = true;
this.chbAuto.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAuto.Location = new System.Drawing.Point(804, 13);
this.chbAuto.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAuto.Location = new System.Drawing.Point(817, 13);
this.chbAuto.Name = "chbAuto";
this.chbAuto.Size = new System.Drawing.Size(125, 25);
this.chbAuto.Size = new System.Drawing.Size(112, 24);
this.chbAuto.TabIndex = 270;
this.chbAuto.Text = "开机自动启动";
this.chbAuto.UseVisualStyleBackColor = true;
......@@ -429,6 +430,7 @@
//
// tabPage6
//
this.tabPage6.Controls.Add(this.btnLan);
this.tabPage6.Controls.Add(this.button4);
this.tabPage6.Controls.Add(this.btnClearL);
this.tabPage6.Controls.Add(this.btnLogDebug);
......@@ -439,10 +441,21 @@
this.tabPage6.Text = " 其他 ";
this.tabPage6.UseVisualStyleBackColor = true;
//
// btnLan
//
this.btnLan.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLan.Location = new System.Drawing.Point(4, 3);
this.btnLan.Name = "btnLan";
this.btnLan.Size = new System.Drawing.Size(132, 39);
this.btnLan.TabIndex = 225;
this.btnLan.Text = "语言";
this.btnLan.UseVisualStyleBackColor = true;
this.btnLan.Click += new System.EventHandler(this.btnLan_Click);
//
// button4
//
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button4.Location = new System.Drawing.Point(273, 4);
this.button4.Location = new System.Drawing.Point(403, 3);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(132, 39);
this.button4.TabIndex = 15;
......@@ -453,7 +466,7 @@
// btnClearL
//
this.btnClearL.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClearL.Location = new System.Drawing.Point(140, 4);
this.btnClearL.Location = new System.Drawing.Point(270, 3);
this.btnClearL.Name = "btnClearL";
this.btnClearL.Size = new System.Drawing.Size(132, 39);
this.btnClearL.TabIndex = 14;
......@@ -464,7 +477,7 @@
// btnLogDebug
//
this.btnLogDebug.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLogDebug.Location = new System.Drawing.Point(7, 4);
this.btnLogDebug.Location = new System.Drawing.Point(137, 3);
this.btnLogDebug.Name = "btnLogDebug";
this.btnLogDebug.Size = new System.Drawing.Size(132, 39);
this.btnLogDebug.TabIndex = 13;
......@@ -2116,6 +2129,7 @@
private System.Windows.Forms.CheckBox chbBuzzer;
private ACPackingStore.AxisMoveControl axisMoveControl1;
private System.Windows.Forms.Button btnUpdown;
private System.Windows.Forms.Button btnLan;
}
}
......@@ -98,7 +98,7 @@ namespace OnlineStore.ACSingleStore
bool result = ACServerManager.OpenPort(PortName);
if (!result)
{
MessageBox.Show(ResourceCulture.GetString("打开串口失败"));
MyMessage.Show(ResourceCulture.GetString("打开串口失败"));
return;
}
......@@ -197,7 +197,7 @@ namespace OnlineStore.ACSingleStore
if (speed <= (0))
{
MessageBox.Show(ResourceCulture.GetString("请输入正确的速度"));
MyMessage.Show("请输入正确的速度");
txtSpeed.Focus();
return;
}
......@@ -381,11 +381,5 @@ namespace OnlineStore.ACSingleStore
this.Close();
}
}
public class ResourceCulture
{
internal static string GetString(string str)
{
return str;
}
}
}
......@@ -72,7 +72,7 @@ namespace OnlineStore.ACPackingStore
{
return true;
}
MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
MyMessage.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
private void btnAxisAMove_Click(object sender, EventArgs e)
......
......@@ -56,6 +56,7 @@
<Compile Include="Setting_Init.cs" />
<Compile Include="util\AcSerialBean.cs" />
<Compile Include="util\ConfigAppSettings.cs" />
<Compile Include="util\FileUtil.cs" />
<Compile Include="util\FormUtil.cs" />
<Compile Include="util\HttpHelper.cs" />
<Compile Include="util\HumitureController.cs" />
......
......@@ -100,5 +100,7 @@ namespace OnlineStore.Common
public static string Tool_TargetSpeed = "Tool_TargetSpeed";
public static string Tool_TargetPosition = "Tool_TargetPosition";
public static string ShowLanguageMsg = "ShowLanguageMsg";
public static string Default_Language= "Default_Language";
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace OnlineStore.Common
{
public class FileUtil
{
public static string[] ReadFileArray(string filePath)
{
try
{
string[] lines = File.ReadAllLines(filePath, Encoding.GetEncoding("gbk"));
return lines;
}
catch (Exception ex)
{
LogUtil.error("读取文件【" + filePath + "】出错:" + ex.ToString());
}
return new string[] { };
}
public static bool SaveListToFile(string[] lines, string filePath)
{
try
{
if (File.Exists(filePath))
{
File.Delete(filePath);
}
File.WriteAllLines(filePath, lines, Encoding.GetEncoding("gbk"));
FileUtil.BackConfig(filePath, lines);
}
catch (Exception ex)
{
LogUtil.error("保存文件【" + filePath + "】出错:" + ex.ToString());
return false;
}
return true;
}
public static void BackConfig(string filePath, string[] lines)
{
//备份保存
try
{
FileInfo file = new FileInfo(filePath);
string date = DateTime.Now.ToString("yyyy-MM-dd");
string targetBackPath = @"C:\configBack\" + date + @"\";
if (!Directory.Exists(targetBackPath))
{
Directory.CreateDirectory(targetBackPath);
}
string fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + "." + file.Name;
string backFile = targetBackPath + fileName;
if (File.Exists(backFile))
{
File.Delete(backFile);
}
File.WriteAllLines(backFile, lines, Encoding.GetEncoding("gbk"));
}
catch (Exception e)
{
LogUtil.error("备份【" + filePath + "】到C:configBack出错:" + e.ToString());
}
//备份保存
try
{
FileInfo file = new FileInfo(filePath);
string date = DateTime.Now.ToString("yyyy-MM-dd");
string targetBackPath = @"D:\configBack\" + date + @"\";
if (!Directory.Exists(targetBackPath))
{
Directory.CreateDirectory(targetBackPath);
}
string fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + "." + file.Name;
string backFile = targetBackPath + fileName;
if (File.Exists(backFile))
{
File.Delete(backFile);
}
File.WriteAllLines(backFile, lines, Encoding.GetEncoding("gbk"));
}
catch (Exception e)
{
LogUtil.error("备份【" + filePath + "】到D:configBack出错:" + e.ToString());
}
}
}
}
......@@ -169,7 +169,12 @@ namespace OnlineStore.Common
public static void info(string msg)
{
info(LOGGER,msg );
}
}
public static readonly ILog ResourcesLog = LogManager.GetLogger("ResourcesLog");
public static void RLog(string str)
{
ResourcesLog.Info(str);
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!