Commit ddaed713 几米阳光

add en us

1 个父辈 4793d737
正在显示 37 个修改的文件 包含 722 行增加984 行删除
......@@ -89,6 +89,12 @@
<Compile Include="FrmIOStatus.Designer.cs">
<DependentUpon>FrmIOStatus.cs</DependentUpon>
</Compile>
<Compile Include="FrmLanguage.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmLanguage.Designer.cs">
<DependentUpon>FrmLanguage.cs</DependentUpon>
</Compile>
<Compile Include="FrmStoreBox.cs">
<SubType>Form</SubType>
</Compile>
......@@ -98,6 +104,7 @@
<Compile Include="ManagerUtil.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceCulture.cs" />
<EmbeddedResource Include="FrmAxisDebug.resx">
<DependentUpon>FrmAxisDebug.cs</DependentUpon>
</EmbeddedResource>
......@@ -107,9 +114,22 @@
<EmbeddedResource Include="FrmIOStatus.resx">
<DependentUpon>FrmIOStatus.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmLanguage.resx">
<DependentUpon>FrmLanguage.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmStoreBox.resx">
<DependentUpon>FrmStoreBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resource.en-US.resx">
<SubType>Designer</SubType>
<CustomToolNamespace>OnlineStore.ACSingleStore</CustomToolNamespace>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resource.zh-CN.resx">
<SubType>Designer</SubType>
<CustomToolNamespace>OnlineStore.ACSingleStore</CustomToolNamespace>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
......@@ -7,6 +7,8 @@
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="AC_SA_料仓" />
<!--默认语言-->
<add key="Default_Language" value="zh-CN" />
<add key="scanner_start_command" value="S" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4" />
......
......@@ -57,7 +57,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
return;
}
btnMiddleMove.BackColor = Color.Green;
......@@ -79,7 +79,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
return;
}
btnUpDownMove.BackColor = Color.Green;
......@@ -100,13 +100,13 @@ namespace OnlineStore.ACSingleStore
{
if (ACStoreManager.store.LoacationIsDown().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MessageBox.Show( cannotMove,warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int speed = FormUtil.GetIntValue(txtInOutSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
return;
}
this.btnInOutMove.BackColor = Color.Green;
......@@ -128,7 +128,7 @@ namespace OnlineStore.ACSingleStore
// int speed = FormUtil.GetIntValue(txtComSpeed);
// if (speed <= 0)
// {
// MessageBox.Show("提示", "请先输入正确的速度");
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
// return;
// }
// this.btnComMove.BackColor = Color.Green;
......@@ -147,13 +147,14 @@ namespace OnlineStore.ACSingleStore
// ShuoKeControls.SuddownStop(compress_Slv);
// }
//}
private string cannotMove = ResourceCulture.GetString(ResourceCulture.CannotMove, "定位气缸不在下降端,不能移动进出轴");
private string warn = ResourceCulture.GetString(ResourceCulture.WarnMsg, "警告");
private void btnMiddleMovej_MouseDown(object sender, MouseEventArgs e)
{
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
return;
}
this.btnMiddleMovej.BackColor = Color.Green;
......@@ -175,7 +176,7 @@ namespace OnlineStore.ACSingleStore
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
return;
}
btnUpDownMovej.BackColor = Color.Green;
......@@ -196,13 +197,13 @@ namespace OnlineStore.ACSingleStore
{
if (ACStoreManager.store.LoacationIsDown().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MessageBox.Show(cannotMove, warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int speed = FormUtil.GetIntValue(txtInOutSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
return;
}
this.btnInOutMovej.BackColor = Color.Green;
......@@ -224,7 +225,7 @@ namespace OnlineStore.ACSingleStore
// int speed = FormUtil.GetIntValue(txtComSpeed);
// if (speed <= 0)
// {
// MessageBox.Show("提示", "请先输入正确的速度");
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
// return;
// }
// this.btnComMovej.BackColor = Color.Green;
......
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
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 FrmAxisMoveConfig : FrmBase
{
private AC_SA_BoxBean boxBean = null;
public FrmAxisMoveConfig(AC_SA_BoxBean box )
{
this.boxBean = box;
InitializeComponent();
}
private void FrmAxisMoveConfig_Load(object sender, EventArgs e)
{
txtUpdownP1S.Text = boxBean.Config.UpDownAxis_P1_Speed.ToString();
txtUpdownP2S.Text = boxBean.Config.UpDownAxis_P2_Speed.ToString();
txtUpdownP3S.Text = boxBean.Config.UpDownAxis_P3_Speed.ToString();
txtUpdownP4S.Text = boxBean.Config.UpDownAxis_P4_Speed.ToString();
txtUpdownP5S.Text = boxBean.Config.UpDownAxis_P5_Speed.ToString();
txtUpdownP6S.Text = boxBean.Config.UpDownAxis_P6_Speed.ToString();
txtUpdownP7S.Text = boxBean.Config.UpDownAxis_P7_Speed.ToString();
txtUpdownP8S.Text = boxBean.Config.UpDownAxis_P8_Speed.ToString();
txtInOutP1S.Text = boxBean.Config.InOutAxis_P1_Speed.ToString();
txtInOutP2S.Text = boxBean.Config.InOutAxis_P2_Speed.ToString();
txtInOutP3S.Text = boxBean.Config.InOutAxis_P3_Speed.ToString();
txtMiddleP1S.Text = boxBean.Config.MiddleAxis_P1_Speed.ToString();
txtMiddleP2S.Text = boxBean.Config.MiddleAxis_P2_Speed.ToString();
//txtMiddleSpeed.Text = boxBean.Config.MiddleAxis_StartSpeed.ToString();
//txtInOutSpeed.Text = boxBean.Config.InoutAxis_StartSpeed.ToString();
//txtUpDownSpeed.Text = boxBean.Config.UpdownAxis_StartSpeed.ToString();
this.txtMSpeed.Text = boxBean.Config.MiddleAxis_TargetSpeed.ToString();
this.txtISpeed.Text = boxBean.Config.InoutAxis_TargetSpeed.ToString();
this.txtUSpeed.Text = boxBean.Config.UpdownAxis_TargetSpeed.ToString();
this.txtMAtime.Text = boxBean.Config.MiddleAxis_AddSpeed.ToString();
this.txtIAtime.Text = boxBean.Config.InoutAxis_DelSpeed.ToString();
this.txtUAtime.Text = boxBean.Config.UpdownAxis_AddSpeed.ToString();
this.txtMDtime.Text = boxBean.Config.MiddleAxis_DelSpeed.ToString();
this.txtIDtime.Text = boxBean.Config.InoutAxis_DelSpeed.ToString();
this.txtUDtime.Text = boxBean.Config.UpdownAxis_DelSpeed.ToString();
txtMiddleMax.Text = boxBean.Config.MiddleAxis_ErrorCountMax.ToString();
txtUpdownMax.Text = boxBean.Config.UpdownAxis_ErrorCountMax.ToString();
txtInoutMax.Text = boxBean.Config.InoutAxis_ErrorCountMax.ToString();
//txtComMax.Text = boxBean.Config.CompressAxis_ErrorCountMax.ToString();
txtMiddleMin.Text = boxBean.Config.MiddleAxis_ErrorCountMin.ToString();
txtUpdownMin.Text = boxBean.Config.UpdownAxis_ErrorCountMin.ToString();
txtInoutMin.Text = boxBean.Config.InoutAxis_ErrorCountMin.ToString();
//txtComMin.Text = boxBean.Config.CompressAxis_ErrorCountMin.ToString();
txtMRSpeed.Text = boxBean.Config.MiddleAxis_ResolveSpeed.ToString();
txtIRSpeed.Text = boxBean.Config.InoutAxis_ResolveSpeed.ToString();
txtURSpeed.Text = boxBean.Config.UpdownAxis_ResolveSpeed.ToString();
//txtCRSpeed.Text = boxBean.Config.CompressAxis_ResolveSpeed.ToString();
//txtAddSpeed.Text = boxBean.Config.CompressAxis_AddSpeed.ToString();
//txtDelSpeed.Text = boxBean.Config.CompressAxis_DelSpeed.ToString();
//txtMaxSpeed.Text = boxBean.Config.CompressAxis_MaxSpeed.ToString();
//txtBeginSpeed.Text = boxBean.Config.CompressAxis_StartSpeed.ToString();
//txtTargetSpeed.Text = boxBean.Config.CompressAxis_EndSpeed.ToString();
//this.txtCDtime.Text = boxBean.Config.CompressAxis_DecelTime.ToString();
//this.txtCSpeed.Text = boxBean.Config.CompressAxis_TargetSpeed.ToString();
//this.txtCAtime.Text = boxBean.Config.CompressAxis_AccelTime.ToString();
}
private void btnSaveAxisSpeed_Click(object sender, EventArgs e)
{
DialogResult resul = MessageBox.Show("配置使用地方过多,需要重启才能生效,是否确定保存?", "提示", MessageBoxButtons.YesNo);
if (!resul.Equals(DialogResult.Yes))
{
return;
}
boxBean.Config.UpDownAxis_P1_Speed = FormUtil.GetIntValue(txtUpdownP1S);
boxBean.Config.UpDownAxis_P2_Speed = FormUtil.GetIntValue(txtUpdownP2S);
boxBean.Config.UpDownAxis_P3_Speed = FormUtil.GetIntValue(txtUpdownP3S);
boxBean.Config.UpDownAxis_P4_Speed = FormUtil.GetIntValue(txtUpdownP4S);
boxBean.Config.UpDownAxis_P5_Speed = FormUtil.GetIntValue(txtUpdownP5S);
boxBean.Config.UpDownAxis_P6_Speed = FormUtil.GetIntValue(txtUpdownP6S);
boxBean.Config.UpDownAxis_P7_Speed = FormUtil.GetIntValue(txtUpdownP7S);
boxBean.Config.UpDownAxis_P8_Speed = FormUtil.GetIntValue(txtUpdownP8S);
boxBean.Config.InOutAxis_P1_Speed = FormUtil.GetIntValue(txtInOutP1S);
boxBean.Config.InOutAxis_P2_Speed = FormUtil.GetIntValue(txtInOutP2S);
boxBean.Config.InOutAxis_P3_Speed = FormUtil.GetIntValue(txtInOutP3S);
boxBean.Config.MiddleAxis_P1_Speed = FormUtil.GetIntValue(txtMiddleP1S);
boxBean.Config.MiddleAxis_P2_Speed = FormUtil.GetIntValue(txtMiddleP2S);
//boxBean.Config.CompressAxis_P1_Speed = FormUtil.GetIntValue(txtComPressP1S);
//boxBean.Config.CompressAxis_P2_Speed = FormUtil.GetIntValue(txtComPressP2S);
//boxBean.Config.CompressAxis_P3_Speed = FormUtil.GetIntValue(txtComPressP3S);
//boxBean.Config.MiddleAxis_StartSpeed = FormUtil.GetIntValue(txtMiddleSpeed);
//boxBean.Config.InoutAxis_StartSpeed = FormUtil.GetIntValue(txtInOutSpeed);
//boxBean.Config.UpdownAxis_StartSpeed = FormUtil.GetIntValue(txtUpDownSpeed);
//boxBean.Config.CompressAxis_StartSpeed = FormUtil.GetIntValue(txtComSpeed);
boxBean.Config.MiddleAxis_TargetSpeed = FormUtil.GetIntValue(txtMSpeed);
boxBean.Config.InoutAxis_TargetSpeed = FormUtil.GetIntValue(txtISpeed);
boxBean.Config.UpdownAxis_TargetSpeed = FormUtil.GetIntValue(txtUSpeed);
boxBean.Config.MiddleAxis_AddSpeed = FormUtil.GetShortValue(txtMAtime);
boxBean.Config.InoutAxis_AddSpeed = FormUtil.GetShortValue(txtIAtime);
boxBean.Config.UpdownAxis_AddSpeed = FormUtil.GetShortValue(txtUAtime);
boxBean.Config.MiddleAxis_DelSpeed = FormUtil.GetShortValue(txtMDtime);
boxBean.Config.InoutAxis_DelSpeed = FormUtil.GetShortValue(txtIDtime);
boxBean.Config.UpdownAxis_DelSpeed = FormUtil.GetShortValue(txtUDtime);
boxBean.Config.MiddleAxis_ErrorCountMax = FormUtil.GetShortValue(txtMiddleMax);
boxBean.Config.UpdownAxis_ErrorCountMax = FormUtil.GetShortValue(txtUpdownMax);
boxBean.Config.InoutAxis_ErrorCountMax = FormUtil.GetShortValue(txtInoutMax);
boxBean.Config.MiddleAxis_ErrorCountMin = FormUtil.GetShortValue(txtMiddleMin);
boxBean.Config.UpdownAxis_ErrorCountMin = FormUtil.GetShortValue(txtUpdownMin);
boxBean.Config.InoutAxis_ErrorCountMin = FormUtil.GetShortValue(txtInoutMin);
boxBean.Config.MiddleAxis_ResolveSpeed = FormUtil.GetShortValue(txtMRSpeed);
boxBean.Config.InoutAxis_ResolveSpeed = FormUtil.GetShortValue(txtIRSpeed);
boxBean.Config.UpdownAxis_ResolveSpeed = FormUtil.GetShortValue(txtURSpeed);
//boxBean.Config.CompressAxis_StartSpeed = FormUtil.GetIntValue(txtBeginSpeed);
//boxBean.Config.CompressAxis_AddSpeed = FormUtil.GetIntValue(txtAddSpeed);
//boxBean.Config.CompressAxis_DelSpeed = FormUtil.GetIntValue(txtDelSpeed);
//boxBean.Config.CompressAxis_EndSpeed = FormUtil.GetIntValue(txtTargetSpeed);
//boxBean.Config.CompressAxis_MaxSpeed = FormUtil.GetIntValue(txtMaxSpeed);
//boxBean.Config.CompressAxis_TargetSpeed = FormUtil.GetIntValue(txtCSpeed);
//boxBean.Config.CompressAxis_AccelTime = FormUtil.GetShortValue(txtCAtime);
//boxBean.Config.CompressAxis_DecelTime = FormUtil.GetShortValue(txtCDtime);
//更新缓存
ACStoreManager.UpdateBoxConfig(boxBean.Config);
}
private void FrmAxisMoveConfig_Shown(object sender, EventArgs e)
{
SetSkin(this);
}
}
}
......@@ -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);
}
......
......@@ -13,6 +13,17 @@ namespace OnlineStore.ACSingleStore
{
public partial class FrmBase : Form
{
public string CurrLanguage = "";
public string ClassName
{
get
{
return this.GetType().Name;
}
set
{
}
}
public FrmBase()
{
InitializeComponent();
......@@ -23,5 +34,57 @@ namespace OnlineStore.ACSingleStore
//skinEngine1.SkinFile = FormManager.SkinFileName;
//LogUtil.info("当前皮肤:" + skinEngine1.SkinFile);
}
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||con is ToolStripMenuItem)
{
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)
{
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();
}
}
}
}
namespace OnlineStore.ACSingleStore
{
partial class FrmCamera
{
/// <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.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.btnCloseCamera = new System.Windows.Forms.Button();
this.btnGetImage = new System.Windows.Forms.Button();
this.btnOpen = new System.Windows.Forms.Button();
this.hWindowControl1 = new HalconDotNet.HWindowControl();
this.btnExit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// timer1
//
this.timer1.Interval = 5000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// richTextBox1
//
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.Location = new System.Drawing.Point(496, 216);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(165, 167);
this.richTextBox1.TabIndex = 4;
this.richTextBox1.Text = "";
//
// btnCloseCamera
//
this.btnCloseCamera.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCloseCamera.Location = new System.Drawing.Point(523, 90);
this.btnCloseCamera.Name = "btnCloseCamera";
this.btnCloseCamera.Size = new System.Drawing.Size(135, 35);
this.btnCloseCamera.TabIndex = 3;
this.btnCloseCamera.Text = "关闭 ";
this.btnCloseCamera.UseVisualStyleBackColor = true;
this.btnCloseCamera.Click += new System.EventHandler(this.btnCloseCamera_Click);
//
// btnGetImage
//
this.btnGetImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnGetImage.Location = new System.Drawing.Point(523, 51);
this.btnGetImage.Name = "btnGetImage";
this.btnGetImage.Size = new System.Drawing.Size(135, 35);
this.btnGetImage.TabIndex = 2;
this.btnGetImage.Text = "扫码测试";
this.btnGetImage.UseVisualStyleBackColor = true;
this.btnGetImage.Click += new System.EventHandler(this.btnGetImage_Click);
//
// btnOpen
//
this.btnOpen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnOpen.Location = new System.Drawing.Point(523, 12);
this.btnOpen.Name = "btnOpen";
this.btnOpen.Size = new System.Drawing.Size(135, 35);
this.btnOpen.TabIndex = 1;
this.btnOpen.Text = "打开 ";
this.btnOpen.UseVisualStyleBackColor = true;
this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click);
//
// hWindowControl1
//
this.hWindowControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.hWindowControl1.BackColor = System.Drawing.Color.Black;
this.hWindowControl1.BorderColor = System.Drawing.Color.Black;
this.hWindowControl1.ImagePart = new System.Drawing.Rectangle(0, 0, 640, 480);
this.hWindowControl1.Location = new System.Drawing.Point(12, 12);
this.hWindowControl1.Name = "hWindowControl1";
this.hWindowControl1.Size = new System.Drawing.Size(478, 371);
this.hWindowControl1.TabIndex = 5;
this.hWindowControl1.WindowSize = new System.Drawing.Size(478, 371);
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Location = new System.Drawing.Point(523, 168);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(135, 35);
this.btnExit.TabIndex = 6;
this.btnExit.Text = "返回(&B)";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// FrmCamera
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(670, 395);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.hWindowControl1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.btnCloseCamera);
this.Controls.Add(this.btnGetImage);
this.Controls.Add(this.btnOpen);
this.Name = "FrmCamera";
this.Text = "二维码识别测试";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmCamera_FormClosed);
this.Load += new System.EventHandler(this.FrmCamera_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnOpen;
private System.Windows.Forms.Button btnGetImage;
private System.Windows.Forms.Button btnCloseCamera;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Timer timer1;
private HalconDotNet.HWindowControl hWindowControl1;
private System.Windows.Forms.Button btnExit;
}
}
\ No newline at end of file

using HalconDotNet;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
{
public partial class FrmCamera : FrmBase
{
private AC_SA_BoxBean store = null;
public FrmCamera(AC_SA_BoxBean store)
{
this.store = store;
InitializeComponent();
}
private void btnOpen_Click(object sender, EventArgs e)
{
HDevelopExport.CloseAllCamera();
store.KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
HDevelopExport.OpenAllCamera();
FormStatus(true);
}
private void FormStatus(bool open)
{
btnOpen.Enabled = !open;
btnCloseCamera.Enabled = open;
btnGetImage.Enabled = open;
timer1.Enabled = open;
}
private void btnGetImage_Click(object sender, EventArgs e)
{
List<string> allCodeList = new List<string>();
foreach (string cameraName in HDevelopExport.cameraNameList)
{
HObject ho_Image = HDevelopExport.GrabImage(cameraName);
List<string> codeList = HDevelopExport.GetCode(ho_Image);
allCodeList.AddRange(codeList);
}
if (allCodeList != null)
{
this.richTextBox1.Clear();
foreach (string str in allCodeList)
{
this.richTextBox1.AppendText(str);
}
}
}
private void btnCloseCamera_Click(object sender, EventArgs e)
{
store.KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
HDevelopExport.CloseAllCamera();
FormStatus(false);
}
private void FrmCamera_Load(object sender, EventArgs e)
{
FormStatus(false);
}
private void FrmCamera_FormClosed(object sender, FormClosedEventArgs e)
{
if (btnCloseCamera.Enabled.Equals(true))
{
store.KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
HDevelopExport.CloseAllCamera();
FormStatus(false);
}
}
private int preIndex = 0;
int dWidth = 0; int dHeight = 0;
private void timer1_Tick(object sender, EventArgs e)
{
preIndex++;
HObject ho_Image = null;
int index = preIndex % HDevelopExport.cameraNameList.Count;
ho_Image = HDevelopExport.GrabImage(HDevelopExport.cameraNameList[index]);
if (ho_Image != null)
{
if (dWidth <= 0)
{
HTuple width, height;
//int dWidth = 0; int dHeight = 0;
HOperatorSet.GetImageSize(ho_Image, out width, out height);
dWidth = (int)width.D;
dHeight = (int)height.D;
hWindowControl1.HalconWindow.SetPart(0, 0, dHeight, dWidth);
}
HOperatorSet.DispObj(ho_Image, hWindowControl1.HalconWindow);
List<string> codeList = HDevelopExport.GetCode(ho_Image);
if (codeList != null)
{
this.richTextBox1.Clear();
this.richTextBox1.AppendText(DateTime.Now.ToString()+ "读到二维码:" + "\r\n");
LogUtil.info("读取到的二维码列表" + "\r\n");
foreach (string str in codeList)
{
this.richTextBox1.AppendText(str + "\r\n");
LogUtil.info(str + "\r\n");
}
}
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
......@@ -51,7 +51,7 @@ namespace OnlineStore.ACSingleStore
{
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl();
control.IOName = ioValue.ElectricalDefinition + "_" + ioValue.Explain;
control.IOName = ioValue.ElectricalDefinition + "_" +ResourceCulture.GetString(ioValue.ElectricalDefinition, ioValue.Explain);
control.IOValue = 0;
control.isCanClick = false;
control.Name = "IO_" + ioValue.ProName;
......@@ -69,7 +69,7 @@ namespace OnlineStore.ACSingleStore
{
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl();
control.IOName = ioValue.ElectricalDefinition + "_" + ioValue.Explain;
control.IOName = ioValue.ElectricalDefinition + "_" + ResourceCulture.GetString(ioValue.ElectricalDefinition, ioValue.Explain);
control.IOValue = 0;
control.isCanClick = true;
//control.Location = new System.Drawing.Point(0, 25*roleindex);
......@@ -107,7 +107,7 @@ namespace OnlineStore.ACSingleStore
}
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(ex.StackTrace, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error(LOGGER, ex.StackTrace);
}
}
......
namespace OnlineStore.ACSingleStore
{
partial class FrmLanguage
{
/// <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.rbtnChina = new System.Windows.Forms.RadioButton();
this.rbtnEnglish = new System.Windows.Forms.RadioButton();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.rdDe = new System.Windows.Forms.RadioButton();
this.SuspendLayout();
//
// 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(163, 63);
this.rbtnChina.Name = "rbtnChina";
this.rbtnChina.Size = new System.Drawing.Size(60, 25);
this.rbtnChina.TabIndex = 0;
this.rbtnChina.TabStop = true;
this.rbtnChina.Text = "中文";
this.rbtnChina.UseVisualStyleBackColor = true;
//
// 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(163, 114);
this.rbtnEnglish.Name = "rbtnEnglish";
this.rbtnEnglish.Size = new System.Drawing.Size(60, 25);
this.rbtnEnglish.TabIndex = 1;
this.rbtnEnglish.TabStop = true;
this.rbtnEnglish.Text = "英文";
this.rbtnEnglish.UseVisualStyleBackColor = true;
//
// 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(229, 226);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(120, 45);
this.btnCancel.TabIndex = 279;
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(103, 226);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(120, 45);
this.btnOk.TabIndex = 278;
this.btnOk.Text = "确定";
this.btnOk.UseVisualStyleBackColor = false;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// rdDe
//
this.rdDe.AutoSize = true;
this.rdDe.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.rdDe.Location = new System.Drawing.Point(163, 165);
this.rdDe.Name = "rdDe";
this.rdDe.Size = new System.Drawing.Size(60, 25);
this.rdDe.TabIndex = 280;
this.rdDe.TabStop = true;
this.rdDe.Text = "德文";
this.rdDe.UseVisualStyleBackColor = true;
//
// FrmLanguage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(453, 300);
this.Controls.Add(this.rdDe);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.rbtnEnglish);
this.Controls.Add(this.rbtnChina);
this.Name = "FrmLanguage";
this.Text = "语言";
this.Load += new System.EventHandler(this.FrmLanguage_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.RadioButton rbtnChina;
private System.Windows.Forms.RadioButton rbtnEnglish;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.RadioButton rdDe;
}
}
\ No newline at end of file
......@@ -11,71 +11,48 @@ using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
{
public partial class FrmLogin : FrmBase
public partial class FrmLanguage : FrmBase
{
private string UserName = "admin".ToUpper();
private string UserPwd = "123456".ToUpper();
public FrmLogin()
public FrmLanguage()
{
string aa = ConfigAppSettings.GetValue(Setting_Init.UserName);
string ww = ConfigAppSettings.GetValue(Setting_Init.UserPwd);
if (!aa.Equals(""))
InitializeComponent();
}
private void FrmLanguage_Load(object sender, EventArgs e)
{
UserName = aa.ToUpper();
LanguageProcess();
if (ResourceCulture.CurrLanguage.Equals(ResourceCulture.English))
{
rbtnEnglish.Checked = true;
}
if (!ww.Equals(""))
else
{
UserPwd = ww;
rbtnChina.Checked = true;
}
InitializeComponent();
}
private void btnLogin_Click(object sender, EventArgs e)
{
string userName = txtUserName.Text.Trim();
string pwd = txtPwd.Text.Trim();
if (userName.ToUpper().Equals(UserName) && UserPwd.Equals(pwd))
private void btnCancel_Click(object sender, EventArgs e)
{
FrmStoreBox lineStore = new FrmStoreBox();
this.Hide();
lineStore.ShowDialog();
this.Close();
}
else
private void btnOk_Click(object sender, EventArgs e)
{
if (!(userName.ToUpper().Equals(UserName)))
string str = ConfigAppSettings.GetValue(Setting_Init.Default_Language);
if (rbtnEnglish.Checked)
{
MessageBox.Show("请输入正确的用户名!");
txtUserName.Text = "";
txtUserName.Focus();
str = ResourceCulture.English;
}
else
else if (rdDe.Checked)
{
MessageBox.Show("请输入正确的密码!");
txtPwd.Focus();
txtPwd.Text = "";
str = ResourceCulture.German;
}
}
}
private void FrmLogin_Load(object sender, EventArgs e)
else
{
this.AcceptButton = btnLogin;
string title = OnlineStore.Common.ConfigAppSettings.GetValue(Setting_Init.App_Title);
this.Text = title;
txtUserName.Focus();
int sizeH = this.Size.Height;
int sizeW = this.Size.Width;
int locationH=((sizeH-panel1.Size.Height)/2);
int locationW = (sizeH - panel1.Size.Width) / 2;
panel1.Size = new Size(locationW, locationH);
str = ResourceCulture.China;
}
private void btnCancel_Click(object sender, EventArgs e)
{
ResourceCulture.SetCurrentCulture(str);
ConfigAppSettings.SaveValue(Setting_Init.Default_Language, str);
this.Close();
}
}
......
namespace OnlineStore.ACSingleStore
{
partial class FrmLogin
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmLogin));
this.panel1 = new System.Windows.Forms.Panel();
this.txtPwd = new System.Windows.Forms.TextBox();
this.txtUserName = new System.Windows.Forms.TextBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnLogin = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.panel1.Controls.Add(this.txtPwd);
this.panel1.Controls.Add(this.txtUserName);
this.panel1.Controls.Add(this.btnCancel);
this.panel1.Controls.Add(this.btnLogin);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Location = new System.Drawing.Point(229, 88);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(330, 230);
this.panel1.TabIndex = 0;
//
// txtPwd
//
this.txtPwd.Anchor = System.Windows.Forms.AnchorStyles.None;
this.txtPwd.Location = new System.Drawing.Point(145, 78);
this.txtPwd.MaxLength = 100;
this.txtPwd.Name = "txtPwd";
this.txtPwd.PasswordChar = '*';
this.txtPwd.Size = new System.Drawing.Size(100, 26);
this.txtPwd.TabIndex = 5;
//
// txtUserName
//
this.txtUserName.Anchor = System.Windows.Forms.AnchorStyles.None;
this.txtUserName.Location = new System.Drawing.Point(145, 32);
this.txtUserName.MaxLength = 100;
this.txtUserName.Name = "txtUserName";
this.txtUserName.Size = new System.Drawing.Size(100, 26);
this.txtUserName.TabIndex = 4;
//
// btnCancel
//
this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.btnCancel.Location = new System.Drawing.Point(170, 148);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(84, 33);
this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "取消(&C)";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnLogin
//
this.btnLogin.Anchor = System.Windows.Forms.AnchorStyles.None;
this.btnLogin.Location = new System.Drawing.Point(72, 148);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(84, 33);
this.btnLogin.TabIndex = 2;
this.btnLogin.Text = "登录(&L)";
this.btnLogin.UseVisualStyleBackColor = true;
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(84, 78);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(51, 20);
this.label2.TabIndex = 1;
this.label2.Text = "密码:";
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(72, 41);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 20);
this.label1.TabIndex = 0;
this.label1.Text = "用户名:";
//
// FrmLogin
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(793, 397);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmLogin";
this.Text = "FrmLogin";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.FrmLogin_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox txtPwd;
private System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnLogin;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
\ No newline at end of file
......@@ -120,9 +120,6 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 16</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 16</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>390, 39</value>
</metadata>
......@@ -1262,6 +1259,9 @@
AD//////////////////AB////////////8=
</value>
</data>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 16</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>78</value>
</metadata>
......
......@@ -117,7 +117,5 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.ACSingleStore
{
public class ResourceCulture
{
public static string China = "zh-CN";
public static string English = "en-US";
public static string German = "ge-DE";
public static string CurrLanguage = "zh-CN";
public static Dictionary<string, string> defaultMap = new Dictionary<string, string>();
/// <summary>
/// Set current culture by name
/// </summary>
/// <param name="name">name</param>
public static void SetCurrentCulture(string name)
{
ResourceControl.GetStrEvent += GetString;
ResourceControl.GetStringEvent += GetString;
//UserFromControl.UserControlResource.GetStrEvent += GetString;
//UserFromControl.UserControlResource.GetStringEvent += GetString;
if (string.IsNullOrEmpty(name))
{
name = "en-US";
}
CurrLanguage = name;
Thread.CurrentThread.CurrentCulture = new CultureInfo(name);
}
private static Assembly assembly = Assembly.GetExecutingAssembly();
public static string GetString(string id,string defaultStr)
{
string strCurLanguage = "";
try
{
ResourceManager rm = new ResourceManager("OnlineStore.ACSingleStore.Properties.Resource", assembly);
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
strCurLanguage = rm.GetString(id, ci).Trim();
if (strCurLanguage.Equals("") && (!defaultStr.Equals("")))
{
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
}
}
catch (Exception ex)
{
if (defaultStr.Equals(""))
{
}
else
{
strCurLanguage = "No id:[" + id + "], please add.";
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
}
}
return strCurLanguage;
}
public static string GetString(string id, string defaultStr, params object[] param)
{
string strCurLanguage = "";
try
{
ResourceManager rm = new ResourceManager("OnlineStore.ACSingleStore.Properties.Resource", Assembly.GetExecutingAssembly());
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
strCurLanguage = rm.GetString(id, ci).Trim();
if(strCurLanguage.Equals("")&&(!defaultStr.Equals(""))){
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
}
}
catch (Exception ex)
{
if (defaultStr.Equals(""))
{
}
else
{
strCurLanguage = "No id:[" + id + "], please add.";
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
}
}
return String.Format(strCurLanguage,param);
}
private static void NoIdLog(string id, string defaultStr)
{
LogUtil.info("No id:[" + id + "], please add,use default string :" + defaultStr);
if (!defaultMap.ContainsKey(id))
{
defaultMap.Add(id, defaultStr);
}
}
public static void LogDefaultMap()
{
LogUtil.info("开始打印缺少的文字配置" + defaultMap.Count);
foreach (string key in defaultMap.Keys)
{
string value = defaultMap[key];
LogUtil.info(" 缺少文字配置[" + key + "] 默认值[" + value + "]");
}
LogUtil.info("结束打印缺少的文字配置");
}
private static string spiltStr = "_";
private static string Text = "Text";
public static string GetIdStr(string className, string controlName, string propertyName)
{
return className + spiltStr + controlName + spiltStr + propertyName;
}
public static string GetIdStr(string className, string propertyName)
{
return className + spiltStr + propertyName;
}
public static string GetTextIdStr(string className, string controlName )
{
return className + spiltStr + controlName + spiltStr + Text;
}
public static string GetTextIdStr(string className )
{
return className + spiltStr + Text;
}
/// <summary>
/// 保存成功!
/// </summary>
public static string SaveOk = "SaveOk";
/// <summary>
/// 提示
/// </summary>
public static string MsgTitle = "MsgTitle";
/// <summary>
/// 打开串口失败
/// </summary>
public static string OpenComFail = "OpenComFail";
/// <summary>
/// 请先启动料仓
/// </summary>
public static string PleaseStartStore = "PleaseStartStore";
/// <summary>
/// 定位气缸不在下降端,不能移动进出轴
/// </summary>
public static string CannotMove = "CannotMove";
/// <summary>
/// 警告
/// </summary>
public static string WarnMsg = "WarnMsg";
/// <summary>
/// 保存失败
/// </summary>
public static string SaveError = "SaveError";
/// <summary>
/// 无报警,无出入库或者重置操作时,才可以回待机点
/// </summary>
public static string CanotReset = "CanotReset";
/// <summary>
/// 请先输入正确的速度
/// </summary>
public static string PWSpeed = "PWSpeed";
/// <summary>
/// 是否确定退出
/// </summary>
public static string SureExit = "SureExit";
/// <summary>
/// AutoOut 自动出库:
/// </summary>
public static string AutoOut = "AutoOut";
/// <summary>
/// AutoIn 自动入库:
/// </summary>
public static string AutoIn = "AutoIn";
/// <summary>
/// AutoEnd 自动出入库结束
/// </summary>
public static string AutoEnd = "AutoEnd";
/// <summary>
/// 前门未关
/// </summary>
public static string DoorOpen = "DoorOpen";
/// <summary>
/// 叉子料盘检测有料,请检查
/// </summary>
public static string HasWare = "HasWare";
/// <summary>
/// 开始自动出入库
/// </summary>
public static string StartAuto = "StartAuto";
/// <summary>
/// 停止自动出入库
/// </summary>
public static string StopAuto = "StopAuto";
/// <summary>
/// 等待启动
/// </summary>
public static string WaitStart = "WaitStart";
///// <summary>
/////
///// </summary>
//public static string AutoEnd = "AutoEnd";
}
}
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.Text;
namespace OnlineStore.ACSingleStore
{
public class WCFControl
{
//public static bool isRun=false;
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static ServiceHost host = null;
//public static void OpenWCF()
//{
// if (isRun)
// {
// return;
// }
// try
// {
// if (host == null)
// {
// host = new ServiceHost(typeof(AcStoreWCF.CWSMDBox));
// }
// if (host.State != CommunicationState.Opening)
// {
// host.Open();
// }
// isRun = true;
// LogUtil.info("打开WCF服务成功");
// }
// catch (Exception ex)
// {
// LogUtil.error("打开WCF服务出错:" + ex.ToString());
// }
//}
//public static void CloseWCF()
//{
// try
// {
// isRun = false;
// if (host != null)
// {
// host.Close();
// }
// LogUtil.info("关闭WCF服务成功");
// }
// catch (Exception ex)
// {
// LogUtil.error("关闭WCF服务出错:" + ex.ToString());
// }
//}
}
}
......@@ -65,7 +65,7 @@ namespace OnlineStore.Common
/// 松下伺服波特率
/// </summary>
public static string ACBaudRate = "ACBaudRate";
public static string Default_Language = "Default_Language";
}
}
......@@ -65,6 +65,7 @@
<Compile Include="PanasonicServo\ACCMDManager.cs" />
<Compile Include="PanasonicServo\ACServerManager.cs" />
<Compile Include="PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="ResourceControl.cs" />
<Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs">
<SubType>Code</SubType>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
public class ResourceControl
{
public delegate string GetStrDelegate(string id, string defaultStr);
public static event GetStrDelegate GetStrEvent;
public delegate string GetStringDelegate(string id, string defaultStr, params object[] param);
public static event GetStringDelegate GetStringEvent;
public static string GetString(string id, string defaultStr)
{
string result = GetStrEvent?.Invoke(id, defaultStr);
return result;
}
public static string GetString(string id, string defaultStr, params object[] param)
{
string result = GetStringEvent?.Invoke(id, defaultStr, param);
return result;
}
/// <summary>
/// AutoOut 自动出库:
/// </summary>
public static string AutoOut = "AutoOut";
/// <summary>
/// AutoIn 自动入库:
/// </summary>
public static string AutoIn = "AutoIn";
/// <summary>
/// AutoEnd 自动出入库结束
/// </summary>
public static string AutoEnd = "AutoEnd";
/// <summary>
///"运行中"
/// </summary>
public static string Run = "Run";
/// <summary>
///"忙碌"
/// </summary>
public static string Busy = "Busy";
/// <summary>
///"原点返回"
/// </summary>
public static string HomeMove = "HomeMove";
/// <summary>
///"重置"
/// </summary>
public static string Reset = "Reset";
/// <summary>
///"运行中"
/// </summary>
public static string Runing = "Runing";
/// <summary>
///"等待启动"
/// </summary>
public static string Wait = "Wait";
/// <summary>
///"设备调试中"
/// </summary>
public static string Debugging = "Debugging";
/// <summary>
///"料盘入仓位完成"
/// </summary>
public static string InStoreEnd = "InStoreEnd";
/// <summary>
///"入库执行中"
/// </summary>
public static string InStoreExecute = "InStoreExecute";
/// <summary>
///"故障中"
/// </summary>
public static string InTrouble = "InTrouble";
/// <summary>
///"料盘出仓位完成"
/// </summary>
public static string OutStoreBoxEnd = "OutStoreBoxEnd";
/// <summary>
///"出库执行中"
/// </summary>
public static string OutStoreExecute = "OutStoreExecute";
/// <summary>
///"设备联机"
/// </summary>
public static string StoreOnline = "StoreOnline";
/// <summary>
///"急停中"
/// </summary>
public static string SuddenStop = "SuddenStop";
/// <summary>
///"出库完成"
/// </summary>
public static string OutMoveExecute = "OutMoveExecute";
/// <summary>
///"入库失败"
/// </summary>
public static string InStoreFailed = "InStoreFailed";
/// <summary>
///"出库失败"
/// </summary>
public static string OutStoreFailed = "OutStoreFailed";
/// <summary>
///"等待信号"
/// </summary>
public static string WaitSingle = "WaitSingle";
/// <summary>
///"超时"
/// </summary>
public static string TimeOut = "TimeOut";
/// <summary>
///"收到急停信号,报警急停"
/// </summary>
public static string inSuddenStop = "inSuddenStop";
/// <summary>
///"进出轴报警!复位失败,请检查"
/// </summary>
public static string InoutAlarm = "InoutAlarm";
/// <summary>
///"打开"
/// </summary>
public static string Open = "Open";
/// <summary>
///"失败"
/// </summary>
public static string Fail = "Fail";
/// <summary>
///"收到复位信号,自动复位"
/// </summary>
public static string AutoReset = "AutoReset";
/// <summary>
///"运动轴"
/// </summary>
public static string MoveAxis = "MoveAxis";
/// <summary>
///"报警"
/// </summary>
public static string Alarm = "Alarm";
/// <summary>
///"入库库位格式错误:"
/// </summary>
public static string InStoreError = "InStoreError";
/// <summary>
///"入库未找到库位:"
/// </summary>
public static string InStoreNoPosition = "InStoreNoPosition";
/// <summary>
///"出库格式错误:"
/// </summary>
public static string OutStoreError = "OutStoreError";
/// <summary>
///"出库未找库位:"
/// </summary>
public static string OutStoreNoPosition = "OutStoreNoPosition";
/// <summary>
///"绝对运动:"
/// </summary>
public static string AbsMove = "AbsMove";
/// <summary>
///"IO信号等待:"
/// </summary>
public static string WaitIo = "WaitIo";
/// <summary>
///"时间等待:"
/// </summary>
public static string WaitTime = "WaitTime";
/// <summary>
///"电钢目标位置:"
/// </summary>
public static string TargetPosition = "TargetPosition";
}
}
......@@ -119,7 +119,7 @@ namespace OnlineStore.DeviceLibrary
{
isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停");
WarnMsg = StoreName + "收到急停信号,报警急停";
WarnMsg = StoreName +ResourceControl.GetString(ResourceControl.inSuddenStop, "收到急停信号,报警急停");
//报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None);
......@@ -641,7 +641,7 @@ namespace OnlineStore.DeviceLibrary
//如果此时轴三还在报警,需要提示错误并等待
if (ACServerManager.GetAlarmStatus(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()) > 0)
{
WarnMsg = "进出轴报警!复位失败,请检查!";
WarnMsg =ResourceControl.GetString(ResourceControl.InoutAlarm, "进出轴报警!复位失败,请检查!");
LogUtil.error(LOGGER, "进出轴报警!复位失败,请检查!");
}
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
......@@ -739,7 +739,7 @@ namespace OnlineStore.DeviceLibrary
{
ACServerManager.ServoOff(axis.DeviceName, axis.GetAxisValue());
int alarmCode = GetAlarmCodeByAxis(axis);
WarnMsg = StoreName + "打开轴" + axis.Explain + "失败 ";
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.Open,"打开") + axis.Explain +ResourceControl.GetString(ResourceControl.Fail, "失败 ");
LogUtil.info(LOGGER, StoreName + WarnMsg);
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axis).ToString(), WarnMsg, StoreMove.MoveType);
return false;
......@@ -1023,7 +1023,7 @@ namespace OnlineStore.DeviceLibrary
{
//收到复位信号
LogUtil.info(LOGGER, "收到复位信号,自动复位");
WarnMsg = "收到复位信号,自动复位";
WarnMsg =ResourceControl.GetString(ResourceControl.AutoReset, "收到复位信号,自动复位");
Reset();
}
}
......@@ -1243,7 +1243,7 @@ namespace OnlineStore.DeviceLibrary
if (alarmIo == 1)
{
WarnMsg = StoreName + " 运动轴" + axisInfo.Explain + "报警";
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.MoveAxis," 运动轴" )+ axisInfo.Explain + ResourceControl.GetString(ResourceControl.Alarm,"报警");
info.AlarmIoValue = alarmIo;
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), WarnMsg, StoreMoveType.None);
isInAlarm = true;
......@@ -1369,7 +1369,7 @@ namespace OnlineStore.DeviceLibrary
string[] posArray = posId.Split('#');
if (!(posArray.Length == 2))
{
WarnMsg = StoreName + "入库库位格式错误:二维码【" + message + "】库位【" + posId + "】";
WarnMsg = StoreName +ResourceControl.GetString(ResourceControl.InStoreError, "入库库位格式错误:")+"【" + message + "】【" + posId + "】";
LogUtil.error(LOGGER, "服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
LogUtil.info(LOGGER, "服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
return;
......@@ -1380,7 +1380,7 @@ namespace OnlineStore.DeviceLibrary
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
WarnMsg = ResourceControl.GetString(ResourceControl.InStoreNoPosition, "入库未找到库位:") + "【" + message + "】【" + posId + "】 ";
LogUtil.error(LOGGER, "收到服务器入库命令:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
LogUtil.info(LOGGER, "收到服务器入库命令:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return;
......@@ -1509,7 +1509,7 @@ namespace OnlineStore.DeviceLibrary
{
humidity = param.Humidity;
temp = param.Temperate;
currTempStr=("当前湿度:" + humidity.ToString()+",当前温度:"+temp);
currTempStr=("" + humidity.ToString()+","+temp);
}
double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList());
float startBlowHumidity = Max_Humidity - StartBlowValue;
......@@ -1729,7 +1729,7 @@ namespace OnlineStore.DeviceLibrary
string[] posArray = posId.Split('#');
if (posArray.Length != 2)
{
WarnMsg = StoreName + "出库格式错误:库位号【" + posId + "】";
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.OutStoreError,"出库格式错误:")+"【" + posId + "】";
LogUtil.error(LOGGER, "收到服务器出库命令:库位号【" + posId + "】格式错误");
continue;
}
......@@ -1740,7 +1740,7 @@ namespace OnlineStore.DeviceLibrary
if (position == null)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = StoreName + "出库未找库位:【" + posId + "】";
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.OutStoreNoPosition, "出库未找库位:") +"【" + posId + "】";
LogUtil.error(LOGGER, "收到服务器出库命令:未找到【" + posId + "】的库位信息");
continue;
}
......
......@@ -105,24 +105,24 @@ namespace OnlineStore.DeviceLibrary
public string GetRunStr()
{
string sta = "运行中";
string sta =ResourceControl.GetString(ResourceControl.Run, "运行中");
string aa = "";
switch (storeRunStatus)
{
case StoreRunStatus.Busy:
sta = "忙碌";
sta = ResourceControl.GetString(ResourceControl.Busy, "忙碌");
break;
case StoreRunStatus.HomeMoving:
sta = "原点返回";
sta = ResourceControl.GetString(ResourceControl.HomeMove, "原点返回");
break;
case StoreRunStatus.Reset:
sta = "重置";
sta = ResourceControl.GetString(ResourceControl.Reset, "重置");
break;
case StoreRunStatus.Runing:
sta = "运行中";
sta = ResourceControl.GetString(ResourceControl.Runing, "运行中");
break;
case StoreRunStatus.Wait:
sta = "等待启动";
sta = ResourceControl.GetString(ResourceControl.Wait, "等待启动");
break;
}
if (storeRunStatus > StoreRunStatus.Wait)
......@@ -131,37 +131,37 @@ namespace OnlineStore.DeviceLibrary
switch (storeStatus)
{
case StoreStatus.Debugging:
aa = "设备调试中";
aa = ResourceControl.GetString(ResourceControl.Debugging, "设备调试中");
break;
case StoreStatus.InStoreEnd:
aa = "料盘入仓位完成";
aa = ResourceControl.GetString(ResourceControl.InStoreEnd, "料盘入仓位完成");
break;
case StoreStatus.InStoreExecute:
aa = "入库执行中";
aa = ResourceControl.GetString(ResourceControl.InStoreExecute, "入库执行中");
break;
case StoreStatus.InTrouble:
aa = "故障中";
aa = ResourceControl.GetString(ResourceControl.InTrouble, "故障中");
break;
case StoreStatus.OutStoreBoxEnd:
aa = "料盘出仓位完成";
aa = ResourceControl.GetString(ResourceControl.OutStoreBoxEnd, "料盘出仓位完成");
break;
case StoreStatus.OutStoreExecute:
aa = "出库执行中";
aa = ResourceControl.GetString(ResourceControl.OutStoreExecute, "出库执行中");
break;
case StoreStatus.StoreOnline:
aa = "设备联机";
aa = ResourceControl.GetString(ResourceControl.StoreOnline, "设备联机");
break;
case StoreStatus.SuddenStop:
aa = "急停中";
aa = ResourceControl.GetString(ResourceControl.SuddenStop, "急停中");
break;
case StoreStatus.OutMoveExecute:
aa = "出库完成";
aa = ResourceControl.GetString(ResourceControl.OutMoveExecute, "出库完成");
break;
case StoreStatus.InStoreFaild:
aa = "入库失败(" + WarnMsg + ")";
aa = ResourceControl.GetString(ResourceControl.InStoreFailed, "入库失败")+"(" + WarnMsg + ")";
break;
case StoreStatus.OutStoreFaild:
aa = "出库失败(" + WarnMsg + ")";
aa = ResourceControl.GetString(ResourceControl.OutStoreFailed, "出库失败")+"(" + WarnMsg + ")";
break;
}
if (!aa.Equals(""))
......
......@@ -234,36 +234,36 @@ namespace OnlineStore.DeviceLibrary
{
if (IsHomeMove)
{
return "轴【" + AxisInfo.DisplayStr + "】原点返回";
return "【" + AxisInfo.DisplayStr + "】"+ResourceControl.GetString(ResourceControl.HomeMove,"原点返回");
}
else
{
return "轴【" + AxisInfo.DisplayStr + "】绝对运动【" + TargetPosition + "】";
return "【" + AxisInfo.DisplayStr + "】"+ResourceControl.GetString(ResourceControl.AbsMove,"绝对运动")+"【" + TargetPosition + "】";
}
}
else if (WaitType == 2)
{
return "IO信号等待,IO类型【" + IoType + "】,等待值【" + IoValue + "】";
return ResourceControl.GetString(ResourceControl.WaitIo, "IO信号等待") +"【" + IoType + "】=【" + IoValue + "】";
}
else if (WaitType == 3)
{
return "时间等待:【" + TimeMSeconds + "】毫秒";
return ResourceControl.GetString(ResourceControl.WaitTime,"时间等待:")+"【" + TimeMSeconds + "】";
}
else if (WaitType == 4)
{
return "电钢目标位置:【" + TargetPosition + "】 ";
return ResourceControl.GetString(ResourceControl.TargetPosition, "电钢目标位置:") +"【" + TargetPosition + "】 ";
}
else if (WaitType == 5)
{
return "硕科电机目标位置:【" + TargetPosition + "】 ";
return ResourceControl.GetString(ResourceControl.TargetPosition, "电钢目标位置:") + "【" + TargetPosition + "】 ";
}
else if (WaitType == 6)
{
return "轴【" + AxisInfo.DisplayStr + "】ORG信号:【" + IoValue + "】 ";
return "【" + AxisInfo.DisplayStr + "】ORG:【" + IoValue + "】 ";
}
else
{
return "Wait位置类型:WaitType=【" + WaitType + "】";
return "WaitType=【" + WaitType + "】";
}
}
/// <summary>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
class CSVResourceControl
{
public delegate string GetStrDelegate(string id, string defaultStr);
public static event GetStrDelegate GetStrEvent;
public delegate string GetStringDelegate(string id, string defaultStr, params object[] param);
public static event GetStringDelegate GetStringEvent;
public static string GetString(string id, string defaultStr)
{
string result = GetStrEvent?.Invoke(id, defaultStr);
return result;
}
public static string GetString(string id, string defaultStr, params object[] param)
{
string result = GetStringEvent?.Invoke(id, defaultStr, param);
return result;
}
}
}
......@@ -48,6 +48,7 @@
<ItemGroup>
<Compile Include="CSVExection.cs" />
<Compile Include="position\ACSAStorePosition.cs" />
<Compile Include="CSVResourceControl.cs" />
<Compile Include="storeConfig\ConfigItemBase.cs" />
<Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\config\AC_SA_Config.cs" />
......
......@@ -153,7 +153,7 @@ namespace OnlineStore.LoadCSVLibrary
public string DisplayStr
{
get {
return Explain + "(" + ProName + ")";
return CSVResourceControl.GetString(ProName, Explain) + "(" + ProName + ")";
}
set
{
......@@ -244,7 +244,7 @@ namespace OnlineStore.LoadCSVLibrary
{
get
{
return ElectricalDefinition + "_" + Explain + "(" + ProName+")";
return ElectricalDefinition + "_" + CSVResourceControl.GetString(ElectricalDefinition,Explain) + "(" + ProName+")";
}
set
{
......
namespace UserFromControl
{
partial class AxisShowSControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.txtIoStatus = new System.Windows.Forms.TextBox();
this.txtMontion = new System.Windows.Forms.TextBox();
this.txtPosition = new System.Windows.Forms.TextBox();
this.txtCommand = new System.Windows.Forms.TextBox();
this._Label3_0 = new System.Windows.Forms.Label();
this._Label1_0 = new System.Windows.Forms.Label();
this.box = new System.Windows.Forms.GroupBox();
this.box.SuspendLayout();
this.SuspendLayout();
//
// txtIoStatus
//
this.txtIoStatus.AcceptsReturn = true;
this.txtIoStatus.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtIoStatus.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtIoStatus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtIoStatus.ForeColor = System.Drawing.Color.GreenYellow;
this.txtIoStatus.Location = new System.Drawing.Point(10, 120);
this.txtIoStatus.MaxLength = 0;
this.txtIoStatus.Name = "txtIoStatus";
this.txtIoStatus.ReadOnly = true;
this.txtIoStatus.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtIoStatus.Size = new System.Drawing.Size(160, 23);
this.txtIoStatus.TabIndex = 9;
this.txtIoStatus.Text = "0";
this.txtIoStatus.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtMontion
//
this.txtMontion.AcceptsReturn = true;
this.txtMontion.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtMontion.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtMontion.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtMontion.ForeColor = System.Drawing.Color.GreenYellow;
this.txtMontion.Location = new System.Drawing.Point(10, 85);
this.txtMontion.MaxLength = 0;
this.txtMontion.Name = "txtMontion";
this.txtMontion.ReadOnly = true;
this.txtMontion.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtMontion.Size = new System.Drawing.Size(160, 23);
this.txtMontion.TabIndex = 7;
this.txtMontion.Text = "0";
this.txtMontion.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtPosition
//
this.txtPosition.AcceptsReturn = true;
this.txtPosition.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtPosition.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtPosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtPosition.ForeColor = System.Drawing.Color.GreenYellow;
this.txtPosition.Location = new System.Drawing.Point(10, 50);
this.txtPosition.MaxLength = 0;
this.txtPosition.Name = "txtPosition";
this.txtPosition.ReadOnly = true;
this.txtPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtPosition.Size = new System.Drawing.Size(160, 23);
this.txtPosition.TabIndex = 5;
this.txtPosition.Text = "0";
this.txtPosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtCommand
//
this.txtCommand.AcceptsReturn = true;
this.txtCommand.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtCommand.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtCommand.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtCommand.ForeColor = System.Drawing.Color.GreenYellow;
this.txtCommand.Location = new System.Drawing.Point(10, 15);
this.txtCommand.MaxLength = 0;
this.txtCommand.Name = "txtCommand";
this.txtCommand.ReadOnly = true;
this.txtCommand.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtCommand.Size = new System.Drawing.Size(160, 23);
this.txtCommand.TabIndex = 3;
this.txtCommand.Text = "0";
this.txtCommand.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// _Label3_0
//
this._Label3_0.BackColor = System.Drawing.SystemColors.Control;
this._Label3_0.Cursor = System.Windows.Forms.Cursors.Default;
this._Label3_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Label3_0.Location = new System.Drawing.Point(5, 85);
this._Label3_0.Name = "_Label3_0";
this._Label3_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Label3_0.Size = new System.Drawing.Size(53, 12);
this._Label3_0.TabIndex = 6;
this._Label3_0.Text = "Motion Status";
this._Label3_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
this._Label3_0.Visible = false;
//
// _Label1_0
//
this._Label1_0.BackColor = System.Drawing.SystemColors.Control;
this._Label1_0.Cursor = System.Windows.Forms.Cursors.Default;
this._Label1_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Label1_0.Location = new System.Drawing.Point(5, 21);
this._Label1_0.Name = "_Label1_0";
this._Label1_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Label1_0.Size = new System.Drawing.Size(53, 12);
this._Label1_0.TabIndex = 2;
this._Label1_0.Text = "Command";
this._Label1_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
this._Label1_0.Visible = false;
//
// box
//
this.box.BackColor = System.Drawing.SystemColors.Control;
this.box.Controls.Add(this.txtIoStatus);
this.box.Controls.Add(this.txtMontion);
this.box.Controls.Add(this.txtPosition);
this.box.Controls.Add(this.txtCommand);
this.box.Controls.Add(this._Label3_0);
this.box.Controls.Add(this._Label1_0);
this.box.ForeColor = System.Drawing.SystemColors.ControlText;
this.box.Location = new System.Drawing.Point(3, 1);
this.box.Name = "box";
this.box.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.box.Size = new System.Drawing.Size(178, 152);
this.box.TabIndex = 2;
this.box.TabStop = false;
this.box.Text = "Axis 0";
//
// AxisShowSControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.box);
this.MaximumSize = new System.Drawing.Size(10000, 10000);
this.MinimumSize = new System.Drawing.Size(10, 10);
this.Name = "AxisShowSControl";
this.Size = new System.Drawing.Size(188, 158);
this.Load += new System.EventHandler(this.AxisShowControl_Load);
this.box.ResumeLayout(false);
this.box.PerformLayout();
this.ResumeLayout(false);
}
#endregion
public System.Windows.Forms.TextBox txtIoStatus;
public System.Windows.Forms.TextBox txtMontion;
public System.Windows.Forms.TextBox txtPosition;
public System.Windows.Forms.TextBox txtCommand;
public System.Windows.Forms.Label _Label3_0;
public System.Windows.Forms.Label _Label1_0;
public System.Windows.Forms.GroupBox box;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace UserFromControl
{
public partial class AxisShowSControl : UserControl
{
public int AxisNo { get; set; }
public int CommandValue { get; set; }
public int PositionValue { get; set; }
public int MontionValue { get; set; }
public int IoStatusValue { get; set; }
public void BingData(int axisNO, int command, int position, int io, int montion )
{
this.AxisNo = axisNO;
this.CommandValue = command;
this.PositionValue = position;
this.MontionValue = montion;
this.IoStatusValue = io;
}
public void ShowData()
{
box.Text = "Axis " + AxisNo;
txtCommand.Text = CommandValue.ToString();
string ioStatus = Convert.ToString(IoStatusValue, 2).PadLeft(9, '0');
txtIoStatus.Text = ioStatus;
String monIoStr = Convert.ToString(MontionValue, 2).PadLeft(9, '0');
txtMontion.Text = monIoStr;
txtPosition.Text = PositionValue.ToString();
}
public AxisShowSControl()
{
InitializeComponent();
}
private void AxisShowControl_Load(object sender, EventArgs e)
{
}
}
}
......@@ -44,12 +44,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AxisShowControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="AxisShowControl.Designer.cs">
<DependentUpon>AxisShowControl.cs</DependentUpon>
</Compile>
<Compile Include="ImageManager.cs" />
<Compile Include="IOStatusControl.cs">
<SubType>UserControl</SubType>
......@@ -69,12 +63,6 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="AxisShowSControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="AxisShowSControl.Designer.cs">
<DependentUpon>AxisShowSControl.cs</DependentUpon>
</Compile>
<Compile Include="IOTextControl.cs">
<SubType>UserControl</SubType>
</Compile>
......@@ -84,9 +72,6 @@
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AxisShowControl.resx">
<DependentUpon>AxisShowControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="IOStatusControl.resx">
<DependentUpon>IOStatusControl.cs</DependentUpon>
</EmbeddedResource>
......@@ -97,9 +82,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="AxisShowSControl.resx">
<DependentUpon>AxisShowSControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="IOTextControl.resx">
<DependentUpon>IOTextControl.cs</DependentUpon>
</EmbeddedResource>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!