浏览代码

中英文添加

刘彬 1 月之前
父节点
当前提交
ebccba2620

+ 21 - 0
App.xaml.cs

@@ -1,14 +1,19 @@
 using LampInspectionMachine.Core;
 using LampInspectionMachine.Log4xml;
 using LampInspectionMachine.Model;
+using LampInspectionMachine.Properties;
+using LampInspectionMachine.Resources.Language;
 using LampInspectionMachine.Views;
 using log4net.Config;
 using Prism.Ioc;
 using Prism.Unity;
+using System;
 using System.ComponentModel;
+using System.Globalization;
 using System.IO;
 using System.Threading;
 using System.Windows;
+using WPFLocalizeExtension.Engine;
 
 namespace LampInspectionMachine
 {
@@ -51,6 +56,22 @@ namespace LampInspectionMachine
             mutex = new System.Threading.Mutex(true, "OnlyRun_CRNS");
             if (mutex.WaitOne(0, false))
             {
+                try
+                {
+                    string language= FileHelper.ReadFile(FilePath.LanguageConfigurationPath);
+                    if ( language == "en" )
+                    {
+                        var culture = new CultureInfo("en");
+                        App.Current.Dispatcher.Thread.CurrentCulture = culture;
+                        App.Current.Dispatcher.Thread.CurrentUICulture = culture;
+                        LocalizeDictionary.Instance.Culture = culture;
+                        LampInspectionMachine.Resources.Language.Resources.Culture = culture;
+                    }
+                }
+                catch (Exception ex ) 
+                {
+                    FileHelper.WriteFile("en",FilePath.LanguageConfigurationPath);
+                }
                 base.OnStartup(e);
             }
             else

+ 30 - 30
Core/Management.cs

@@ -163,7 +163,7 @@ namespace LampInspectionMachine.Core
                 Thread.Sleep(1000);
             }
         }
-      
+
 
         /// <summary>
         /// 获取相机列表
@@ -173,10 +173,10 @@ namespace LampInspectionMachine.Core
             CameraService = new CameraService();
             CamConfigs = FileHelper.ReadApplicationConfiguration();
             CameraList = FindLoadCamera();
-           
-            if (CamConfigs.Count == 0)
+
+            if ( CamConfigs.Count == 0 )
             {
-                CamConfigs.Add(new CameraInfo() { CameraName="相机1", Id=new Guid(), SerialNumber="", VppIndex=0, VppFileName = "Cam1.vpp" });
+                CamConfigs.Add(new CameraInfo() { CameraName = "相机1", Id = new Guid(), SerialNumber = "", VppIndex = 0, VppFileName = "Cam1.vpp" });
                 CamConfigs.Add(new CameraInfo() { CameraName = "相机2", Id = new Guid(), SerialNumber = "", VppIndex = 1, VppFileName = "Cam2.vpp" });
                 CamConfigs.Add(new CameraInfo() { CameraName = "相机3", Id = new Guid(), SerialNumber = "", VppIndex = 2, VppFileName = "Cam3.vpp" });
                 CamConfigs.Add(new CameraInfo() { CameraName = "相机4", Id = new Guid(), SerialNumber = "", VppIndex = 3, VppFileName = "Cam4.vpp" });
@@ -185,52 +185,52 @@ namespace LampInspectionMachine.Core
                 CamConfigs.Add(new CameraInfo() { CameraName = "相机7", Id = new Guid(), SerialNumber = "", VppIndex = 6, VppFileName = "Cam7.vpp" });
                 CamConfigs.Add(new CameraInfo() { CameraName = "相机8", Id = new Guid(), SerialNumber = "", VppIndex = 7, VppFileName = "Cam8.vpp" });
             }
-            LogHelper.Info("加载配置文件完成");
+            LogHelper.Info(Resources.Language.Resources.加载配置文件完成);
         }
 
 
         public void SaveCameraDevice()
         {
             FileHelper.SaveApplicationConfiguration(CamConfigs);
-            LogHelper.Info("保存配置完成");
+            LogHelper.Info(Resources.Language.Resources.保存配置完成);
         }
         /// <summary>
         /// 初始化相机管理
         /// </summary>
-        public void InitTemplates(TipService tipService,Management management)
+        public void InitTemplates(TipService tipService, Management management)
         {
-            tipService.ShowMsg("相机模板加载2%");
+            tipService.ShowMsg($"{Resources.Language.Resources.相机模板加载}2 %");
             for ( int i = 0; i < CamConfigs.Count; i++ )
             {
-               
+
                 CogToolBlock cogToolBlock = (CogToolBlock)CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + $"\\Vpp\\{CamConfigs[i].VppFileName}");
                 VisionProManager vision=new VisionProManager();
                 ICamera myCamera;
-                myCamera = CreateCamera(CamConfigs[i]);
-                if (myCamera!=null&& myCamera.IsConnected) 
+                myCamera = CreateCamera(CamConfigs[ i ]);
+                if ( myCamera != null && myCamera.IsConnected )
                 {
 
-                    if (myCamera.CheckImageCallbackEventIsHas(vision.CamCallBack))
-                    myCamera.ImageCallbackEvent -= vision.CamCallBack;
+                    if ( myCamera.CheckImageCallbackEventIsHas(vision.CamCallBack) )
+                        myCamera.ImageCallbackEvent -= vision.CamCallBack;
                     if ( !myCamera.CheckGrabImageCallbackEventIsHas(vision.ImageCallback) )
                         myCamera.GrabImageCallbackEvent += vision.ImageCallback;
                     myCamera.CameraConnectChangedEvent += vision.CameraConnectChangedEvent;
                     vision.IsConnected = true;
-                    myCamera.SetTriggerMode(true,0);
+                    myCamera.SetTriggerMode(true, 0);
                     myCamera.StartTriggerGrabbing();
                 }
-                vision.Camera= myCamera;
-                vision.PlcData.PlcToPcCodeIndex = (uint)(100 + i);
-                vision.PlcData.PcToPlcCompleted = (uint)(200 + i);
-                vision.PlcData.PcToPlcResult = (uint)(300 + i);
-                vision.PlcData.PcToPlcCodeIndex= (uint)(400 + i);
+                vision.Camera = myCamera;
+                vision.PlcData.PlcToPcCodeIndex = ( uint ) ( 100 + i );
+                vision.PlcData.PcToPlcCompleted = ( uint ) ( 200 + i );
+                vision.PlcData.PcToPlcResult = ( uint ) ( 300 + i );
+                vision.PlcData.PcToPlcCodeIndex = ( uint ) ( 400 + i );
                 vision.CogToolBlock = cogToolBlock;
                 vision.CameraInfo = CamConfigs[ i ];
-                vision.Management=management;
+                vision.Management = management;
                 VisionProManagers.Add(vision);
-                tipService.ShowMsg($"相机模板加载{(i+1)*10+2}%");
+                tipService.ShowMsg($"{Resources.Language.Resources.相机模板加载}{( i + 1 ) * 10 + 2}%");
             }
-            LogHelper.Info("模板加载完成");
+            LogHelper.Info(Resources.Language.Resources.模板加载完成);
             tipService.Tcolse();
 
         
@@ -244,17 +244,17 @@ namespace LampInspectionMachine.Core
             if ( CurrCamera.IsConnected )
             {
                 CurrCamera.StopGrabbing();
-                LogHelper.Info($"软触发配置写入");
+                LogHelper.Info(Resources.Language.Resources.软触发配置写入);
                 CurrCamera.SetTriggerMode(false, 7);
                 if ( !CurrCamera.CheckImageCallbackEventIsHas(Currvision.CamCallBack) )
                     CurrCamera.ImageCallbackEvent += Currvision.CamCallBack;
                 CurrCamConfig.TriggerMode = false;
-                LogHelper.Info($"软触发取图");
+                LogHelper.Info(Resources.Language.Resources.软触发取图);
                 CurrCamera.Grab();
             }
             else 
             {
-                System.Windows.Forms.MessageBox.Show("相机未打开");
+                System.Windows.Forms.MessageBox.Show(Resources.Language.Resources.相机未打开);
             }
         }
 
@@ -274,12 +274,12 @@ namespace LampInspectionMachine.Core
 
                 if (myCamera.CheckGrabImageCallbackEventIsHas(Currvision.ImageCallback))
                     myCamera.GrabImageCallbackEvent -= Currvision.ImageCallback;
-                LogHelper.Info($"连续采集启动");
+                LogHelper.Info(Resources.Language.Resources.连续采集启动);
                 CurrCamera.StartGrabbing();
             }
             else
             {
-                System.Windows.Forms.MessageBox.Show("相机未打开");
+                System.Windows.Forms.MessageBox.Show(Resources.Language.Resources.相机未打开);
             }
         }
 
@@ -388,7 +388,7 @@ namespace LampInspectionMachine.Core
         {
             if ( CurrCamera != null && CurrCamera.IsConnected )
             {
-                LogHelper.Info($"硬触发模式 启动");
+                LogHelper.Info(Resources.Language.Resources.硬触发模式启动);
                 CurrCamera.ImageCallbackEvent -= Currvision.CamCallBack;
                 CurrCamera.SetTriggerMode(true, 0);
                 CurrCamConfig.TriggerMode = true;
@@ -397,7 +397,7 @@ namespace LampInspectionMachine.Core
             else 
             {
 
-                System.Windows.Forms.MessageBox.Show("相机未打开");
+                System.Windows.Forms.MessageBox.Show(Resources.Language.Resources.相机未打开);
             }
         }
         /// <summary>
@@ -454,7 +454,7 @@ namespace LampInspectionMachine.Core
             else
             {
 
-                System.Windows.Forms.MessageBox.Show("未查询到设备!", "提示", MessageBoxButtons.OK);
+                System.Windows.Forms.MessageBox.Show(Resources.Language.Resources.未查询到设备, Resources.Language.Resources.提示, MessageBoxButtons.OK);
                 return null;
             }
         }

+ 3 - 3
Core/VisionProManager.cs

@@ -203,8 +203,8 @@ namespace LampInspectionMachine.Core
                 }
                 catch (Exception ex)
                 {
-
-                    LogHelper.Info("Plc交互出错");
+                    
+                    LogHelper.Info(Resources.Language.Resources.Plc交互出错);
                 }
             }
            
@@ -243,7 +243,7 @@ namespace LampInspectionMachine.Core
                         {
                             IsNgCount++;
                         }
-                        LogHelper.SwitchCameraInfo(Camera.Name, Camera.Name + res.Id.ToString() + $"\r\n产品码:{res.Code},耗时:{res.ProcessingTime} 结果;{res.Res} 回复完成");
+                        LogHelper.SwitchCameraInfo(Camera.Name, Camera.Name  + $"\r\n{Resources.Language.Resources.产品码}:{res.Code},{Resources.Language.Resources.耗时}:{res.ProcessingTime}{Resources.Language.Resources.结果};{res.Res} {Resources.Language.Resources.回复完成}");
                     }
                 }
                 Thread.Sleep(5);

+ 18 - 0
LampInspectionMachine.csproj

@@ -184,6 +184,7 @@
     <Reference Include="System.Drawing.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>packages\System.Drawing.Common.8.0.0\lib\net462\System.Drawing.Common.dll</HintPath>
     </Reference>
+    <Reference Include="System.Management" />
     <Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
     </Reference>
@@ -223,6 +224,12 @@
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
     <Reference Include="WindowsFormsIntegration" />
+    <Reference Include="WPFLocalizeExtension, Version=3.10.0.0, Culture=neutral, PublicKeyToken=c726e0262981a1eb, processorArchitecture=MSIL">
+      <HintPath>packages\WPFLocalizeExtension.3.10.0\lib\net452\WPFLocalizeExtension.dll</HintPath>
+    </Reference>
+    <Reference Include="XAMLMarkupExtensions, Version=2.1.3.0, Culture=neutral, PublicKeyToken=c726e0262981a1eb, processorArchitecture=MSIL">
+      <HintPath>packages\XAMLMarkupExtensions.2.1.3\lib\net48\XAMLMarkupExtensions.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <ApplicationDefinition Include="App.xaml">
@@ -257,8 +264,14 @@
     <Compile Include="Model\ResultsPlcInfo.cs" />
     <Compile Include="Model\ShowRender.cs" />
     <Compile Include="Model\Users.cs" />
+    <Compile Include="Resources\Language\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
     <Compile Include="ValueConverters\BoolToColorConverter.cs" />
     <Compile Include="ValueConverters\EnumToBoolConverter.cs" />
+    <Compile Include="ValueConverters\LanguageToResources.cs" />
     <Compile Include="ViewModels\CameraViewModel.cs" />
     <Compile Include="ViewModels\MainWindowViewModel.cs" />
     <Compile Include="ViewModels\MenuViewModel.cs" />
@@ -313,6 +326,11 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <EmbeddedResource Include="Resources\Language\Resources.en.resx" />
+    <EmbeddedResource Include="Resources\Language\Resources.resx">
+      <Generator>PublicResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
     <None Include="Log4xml\log4net.config">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>

+ 7 - 0
ResXManager.config.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Values xmlns="urn:tom-englert.de/Configuration/1/0">
+  <Value Key="NeutralResourcesLanguage">zh-Hans</Value>
+  <Value Key="AutoCreateNewLanguageFiles">True</Value>
+  <Value Key="ConfirmAddLanguageFile">True</Value>
+  <Value Key="PrefixTranslations">False</Value>
+</Values>

+ 495 - 0
Resources/Language/Resources.Designer.cs

@@ -0,0 +1,495 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace LampInspectionMachine.Resources.Language {
+    using System;
+    
+    
+    /// <summary>
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    public class Resources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources() {
+        }
+        
+        /// <summary>
+        ///   返回此类使用的缓存的 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        public static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LampInspectionMachine.Resources.Language.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        public static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Plc交互出错 的本地化字符串。
+        /// </summary>
+        public static string Plc交互出错 {
+            get {
+                return ResourceManager.GetString("Plc交互出错", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 产品码 的本地化字符串。
+        /// </summary>
+        public static string 产品码 {
+            get {
+                return ResourceManager.GetString("产品码", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 保存 的本地化字符串。
+        /// </summary>
+        public static string 保存 {
+            get {
+                return ResourceManager.GetString("保存", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 保存失败 的本地化字符串。
+        /// </summary>
+        public static string 保存失败 {
+            get {
+                return ResourceManager.GetString("保存失败", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 保存完成 的本地化字符串。
+        /// </summary>
+        public static string 保存完成 {
+            get {
+                return ResourceManager.GetString("保存完成", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 保存配置完成 的本地化字符串。
+        /// </summary>
+        public static string 保存配置完成 {
+            get {
+                return ResourceManager.GetString("保存配置完成", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 关闭 的本地化字符串。
+        /// </summary>
+        public static string 关闭 {
+            get {
+                return ResourceManager.GetString("关闭", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 切换相机调试 的本地化字符串。
+        /// </summary>
+        public static string 切换相机调试 {
+            get {
+                return ResourceManager.GetString("切换相机调试", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 切换运行界面 的本地化字符串。
+        /// </summary>
+        public static string 切换运行界面 {
+            get {
+                return ResourceManager.GetString("切换运行界面", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 初始化 的本地化字符串。
+        /// </summary>
+        public static string 初始化 {
+            get {
+                return ResourceManager.GetString("初始化", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 加载配置文件完成 的本地化字符串。
+        /// </summary>
+        public static string 加载配置文件完成 {
+            get {
+                return ResourceManager.GetString("加载配置文件完成", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 单张图片 的本地化字符串。
+        /// </summary>
+        public static string 单张图片 {
+            get {
+                return ResourceManager.GetString("单张图片", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 单张采集 的本地化字符串。
+        /// </summary>
+        public static string 单张采集 {
+            get {
+                return ResourceManager.GetString("单张采集", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 回复完成 的本地化字符串。
+        /// </summary>
+        public static string 回复完成 {
+            get {
+                return ResourceManager.GetString("回复完成", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 图片轮询 的本地化字符串。
+        /// </summary>
+        public static string 图片轮询 {
+            get {
+                return ResourceManager.GetString("图片轮询", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 开始采集 的本地化字符串。
+        /// </summary>
+        public static string 开始采集 {
+            get {
+                return ResourceManager.GetString("开始采集", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 提示 的本地化字符串。
+        /// </summary>
+        public static string 提示 {
+            get {
+                return ResourceManager.GetString("提示", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 曝光写入 的本地化字符串。
+        /// </summary>
+        public static string 曝光写入 {
+            get {
+                return ResourceManager.GetString("曝光写入", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 未查询到设备 的本地化字符串。
+        /// </summary>
+        public static string 未查询到设备 {
+            get {
+                return ResourceManager.GetString("未查询到设备", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 模板加载完成 的本地化字符串。
+        /// </summary>
+        public static string 模板加载完成 {
+            get {
+                return ResourceManager.GetString("模板加载完成", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 清除计数 的本地化字符串。
+        /// </summary>
+        public static string 清除计数 {
+            get {
+                return ResourceManager.GetString("清除计数", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 灯检 的本地化字符串。
+        /// </summary>
+        public static string 灯检 {
+            get {
+                return ResourceManager.GetString("灯检", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机 的本地化字符串。
+        /// </summary>
+        public static string 相机 {
+            get {
+                return ResourceManager.GetString("相机", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_1NG: 的本地化字符串。
+        /// </summary>
+        public static string 相机_1NG {
+            get {
+                return ResourceManager.GetString("相机_1NG", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_1OK: 的本地化字符串。
+        /// </summary>
+        public static string 相机_1OK {
+            get {
+                return ResourceManager.GetString("相机_1OK", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_2NG: 的本地化字符串。
+        /// </summary>
+        public static string 相机_2NG {
+            get {
+                return ResourceManager.GetString("相机_2NG", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_2OK: 的本地化字符串。
+        /// </summary>
+        public static string 相机_2OK {
+            get {
+                return ResourceManager.GetString("相机_2OK", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_3NG: 的本地化字符串。
+        /// </summary>
+        public static string 相机_3NG {
+            get {
+                return ResourceManager.GetString("相机_3NG", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_3OK: 的本地化字符串。
+        /// </summary>
+        public static string 相机_3OK {
+            get {
+                return ResourceManager.GetString("相机_3OK", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_4NG: 的本地化字符串。
+        /// </summary>
+        public static string 相机_4NG {
+            get {
+                return ResourceManager.GetString("相机_4NG", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_4OK: 的本地化字符串。
+        /// </summary>
+        public static string 相机_4OK {
+            get {
+                return ResourceManager.GetString("相机_4OK", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_5NG: 的本地化字符串。
+        /// </summary>
+        public static string 相机_5NG {
+            get {
+                return ResourceManager.GetString("相机_5NG", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机_5OK: 的本地化字符串。
+        /// </summary>
+        public static string 相机_5OK {
+            get {
+                return ResourceManager.GetString("相机_5OK", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机未打开 的本地化字符串。
+        /// </summary>
+        public static string 相机未打开 {
+            get {
+                return ResourceManager.GetString("相机未打开", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 相机模板加载 的本地化字符串。
+        /// </summary>
+        public static string 相机模板加载 {
+            get {
+                return ResourceManager.GetString("相机模板加载", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 硬触发 的本地化字符串。
+        /// </summary>
+        public static string 硬触发 {
+            get {
+                return ResourceManager.GetString("硬触发", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 硬触发模式启动 的本地化字符串。
+        /// </summary>
+        public static string 硬触发模式启动 {
+            get {
+                return ResourceManager.GetString("硬触发模式启动", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 程序启动 的本地化字符串。
+        /// </summary>
+        public static string 程序启动 {
+            get {
+                return ResourceManager.GetString("程序启动", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 结果 的本地化字符串。
+        /// </summary>
+        public static string 结果 {
+            get {
+                return ResourceManager.GetString("结果", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 耗时 的本地化字符串。
+        /// </summary>
+        public static string 耗时 {
+            get {
+                return ResourceManager.GetString("耗时", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 视觉界面 的本地化字符串。
+        /// </summary>
+        public static string 视觉界面 {
+            get {
+                return ResourceManager.GetString("视觉界面", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 软触发 的本地化字符串。
+        /// </summary>
+        public static string 软触发 {
+            get {
+                return ResourceManager.GetString("软触发", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 软触发取图 的本地化字符串。
+        /// </summary>
+        public static string 软触发取图 {
+            get {
+                return ResourceManager.GetString("软触发取图", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 软触发配置写入 的本地化字符串。
+        /// </summary>
+        public static string 软触发配置写入 {
+            get {
+                return ResourceManager.GetString("软触发配置写入", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 运行流程 的本地化字符串。
+        /// </summary>
+        public static string 运行流程 {
+            get {
+                return ResourceManager.GetString("运行流程", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 运行界面 的本地化字符串。
+        /// </summary>
+        public static string 运行界面 {
+            get {
+                return ResourceManager.GetString("运行界面", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 连续采集启动 的本地化字符串。
+        /// </summary>
+        public static string 连续采集启动 {
+            get {
+                return ResourceManager.GetString("连续采集启动", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 采集方式 的本地化字符串。
+        /// </summary>
+        public static string 采集方式 {
+            get {
+                return ResourceManager.GetString("采集方式", resourceCulture);
+            }
+        }
+    }
+}

+ 261 - 0
Resources/Language/Resources.en.resx

@@ -0,0 +1,261 @@
+<?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>
+  <data name="运行界面" xml:space="preserve">
+    <value>Run the interface</value>
+  </data>
+  <data name="软触发" xml:space="preserve">
+    <value>Soft trigger</value>
+  </data>
+  <data name="硬触发" xml:space="preserve">
+    <value>Hard Trigger</value>
+  </data>
+  <data name="视觉界面" xml:space="preserve">
+    <value>Visual interface</value>
+  </data>
+  <data name="灯检" xml:space="preserve">
+    <value>Visual inspection</value>
+  </data>
+  <data name="相机" xml:space="preserve">
+    <value>Cameras</value>
+  </data>
+  <data name="采集方式" xml:space="preserve">
+    <value>Acquisition mode</value>
+  </data>
+  <data name="曝光写入" xml:space="preserve">
+    <value>Exposure Write</value>
+  </data>
+  <data name="初始化" xml:space="preserve">
+    <value>Initializer</value>
+  </data>
+  <data name="关闭" xml:space="preserve">
+    <value>Close</value>
+  </data>
+  <data name="开始采集" xml:space="preserve">
+    <value>Start Acquisition</value>
+  </data>
+  <data name="单张采集" xml:space="preserve">
+    <value>Leaflet Gathering</value>
+  </data>
+  <data name="运行流程" xml:space="preserve">
+    <value>Run the process</value>
+  </data>
+  <data name="保存" xml:space="preserve">
+    <value>Saved</value>
+  </data>
+  <data name="相机_1OK" xml:space="preserve">
+    <value>Camera 1OK</value>
+  </data>
+  <data name="相机_1NG" xml:space="preserve">
+    <value>Camera 1NG</value>
+  </data>
+  <data name="相机_2OK" xml:space="preserve">
+    <value>Camera 2OK</value>
+  </data>
+  <data name="相机_3OK" xml:space="preserve">
+    <value>Camera 3ok</value>
+  </data>
+  <data name="相机_4OK" xml:space="preserve">
+    <value>Camera 4ok</value>
+  </data>
+  <data name="相机_5OK" xml:space="preserve">
+    <value>Camera 5OK</value>
+  </data>
+  <data name="相机_2NG" xml:space="preserve">
+    <value>Camera 2NG</value>
+  </data>
+  <data name="相机_3NG" xml:space="preserve">
+    <value>Camera 3NG</value>
+  </data>
+  <data name="相机_4NG" xml:space="preserve">
+    <value>Camera 4NG</value>
+  </data>
+  <data name="相机_5NG" xml:space="preserve">
+    <value>Camera 5NG</value>
+  </data>
+  <data name="程序启动" xml:space="preserve">
+    <value>Program started</value>
+  </data>
+  <data name="切换相机调试" xml:space="preserve">
+    <value>Switch camera debugging</value>
+  </data>
+  <data name="切换运行界面" xml:space="preserve">
+    <value>Switch the running interface</value>
+  </data>
+  <data name="保存完成" xml:space="preserve">
+    <value>Saved</value>
+  </data>
+  <data name="保存失败" xml:space="preserve">
+    <value>Failed to save task</value>
+  </data>
+  <data name="加载配置文件完成" xml:space="preserve">
+    <value>Loading configuration file complete</value>
+  </data>
+  <data name="保存配置完成" xml:space="preserve">
+    <value>Configuration saved</value>
+  </data>
+  <data name="相机模板加载" xml:space="preserve">
+    <value>Camera template loaded</value>
+  </data>
+  <data name="模板加载完成" xml:space="preserve">
+    <value>Template loaded</value>
+  </data>
+  <data name="软触发配置写入" xml:space="preserve">
+    <value>Soft Trigger Configuration Write</value>
+  </data>
+  <data name="软触发取图" xml:space="preserve">
+    <value>Soft Trigger Diagramming</value>
+  </data>
+  <data name="相机未打开" xml:space="preserve">
+    <value>Camera is not on</value>
+  </data>
+  <data name="连续采集启动" xml:space="preserve">
+    <value>Continuous Acquisition Started</value>
+  </data>
+  <data name="硬触发模式启动" xml:space="preserve">
+    <value>Hard trigger mode activated</value>
+  </data>
+  <data name="未查询到设备" xml:space="preserve">
+    <value>Device not queried</value>
+  </data>
+  <data name="提示" xml:space="preserve">
+    <value>Tip</value>
+  </data>
+  <data name="Plc交互出错" xml:space="preserve">
+    <value>Plc interaction error</value>
+  </data>
+  <data name="产品码" xml:space="preserve">
+    <value>Product Code</value>
+  </data>
+  <data name="耗时" xml:space="preserve">
+    <value>Time consumption</value>
+  </data>
+  <data name="回复完成" xml:space="preserve">
+    <value>Reply completed</value>
+  </data>
+  <data name="结果" xml:space="preserve">
+    <value>Result</value>
+  </data>
+  <data name="图片轮询" xml:space="preserve">
+    <value>Picture polling</value>
+  </data>
+  <data name="单张图片" xml:space="preserve">
+    <value>Single Image</value>
+  </data>
+</root>

+ 264 - 0
Resources/Language/Resources.resx

@@ -0,0 +1,264 @@
+<?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>
+  <data name="视觉界面" xml:space="preserve">
+    <value>视觉界面</value>
+  </data>
+  <data name="运行界面" xml:space="preserve">
+    <value>运行界面</value>
+  </data>
+  <data name="灯检" xml:space="preserve">
+    <value>灯检</value>
+  </data>
+  <data name="相机" xml:space="preserve">
+    <value>相机</value>
+  </data>
+  <data name="采集方式" xml:space="preserve">
+    <value>采集方式</value>
+  </data>
+  <data name="软触发" xml:space="preserve">
+    <value>软触发</value>
+  </data>
+  <data name="硬触发" xml:space="preserve">
+    <value>硬触发</value>
+  </data>
+  <data name="曝光写入" xml:space="preserve">
+    <value>曝光写入</value>
+  </data>
+  <data name="初始化" xml:space="preserve">
+    <value>初始化</value>
+  </data>
+  <data name="关闭" xml:space="preserve">
+    <value>关闭</value>
+  </data>
+  <data name="开始采集" xml:space="preserve">
+    <value>开始采集</value>
+  </data>
+  <data name="单张采集" xml:space="preserve">
+    <value>单张采集</value>
+  </data>
+  <data name="运行流程" xml:space="preserve">
+    <value>运行流程</value>
+  </data>
+  <data name="保存" xml:space="preserve">
+    <value>保存</value>
+  </data>
+  <data name="相机_1OK" xml:space="preserve">
+    <value>相机_1OK:</value>
+  </data>
+  <data name="相机_1NG" xml:space="preserve">
+    <value>相机_1NG:</value>
+  </data>
+  <data name="相机_2OK" xml:space="preserve">
+    <value>相机_2OK:</value>
+  </data>
+  <data name="相机_3OK" xml:space="preserve">
+    <value>相机_3OK:</value>
+  </data>
+  <data name="相机_4OK" xml:space="preserve">
+    <value>相机_4OK:</value>
+  </data>
+  <data name="相机_5OK" xml:space="preserve">
+    <value>相机_5OK:</value>
+  </data>
+  <data name="相机_2NG" xml:space="preserve">
+    <value>相机_2NG:</value>
+  </data>
+  <data name="相机_3NG" xml:space="preserve">
+    <value>相机_3NG:</value>
+  </data>
+  <data name="相机_4NG" xml:space="preserve">
+    <value>相机_4NG:</value>
+  </data>
+  <data name="相机_5NG" xml:space="preserve">
+    <value>相机_5NG:</value>
+  </data>
+  <data name="程序启动" xml:space="preserve">
+    <value>程序启动</value>
+  </data>
+  <data name="切换相机调试" xml:space="preserve">
+    <value>切换相机调试</value>
+  </data>
+  <data name="切换运行界面" xml:space="preserve">
+    <value>切换运行界面</value>
+  </data>
+  <data name="保存完成" xml:space="preserve">
+    <value>保存完成</value>
+  </data>
+  <data name="保存失败" xml:space="preserve">
+    <value>保存失败</value>
+  </data>
+  <data name="加载配置文件完成" xml:space="preserve">
+    <value>加载配置文件完成</value>
+  </data>
+  <data name="保存配置完成" xml:space="preserve">
+    <value>保存配置完成</value>
+  </data>
+  <data name="相机模板加载" xml:space="preserve">
+    <value>相机模板加载</value>
+  </data>
+  <data name="模板加载完成" xml:space="preserve">
+    <value>模板加载完成</value>
+  </data>
+  <data name="软触发配置写入" xml:space="preserve">
+    <value>软触发配置写入</value>
+  </data>
+  <data name="软触发取图" xml:space="preserve">
+    <value>软触发取图</value>
+  </data>
+  <data name="相机未打开" xml:space="preserve">
+    <value>相机未打开</value>
+  </data>
+  <data name="连续采集启动" xml:space="preserve">
+    <value>连续采集启动</value>
+  </data>
+  <data name="硬触发模式启动" xml:space="preserve">
+    <value>硬触发模式启动</value>
+  </data>
+  <data name="未查询到设备" xml:space="preserve">
+    <value>未查询到设备</value>
+  </data>
+  <data name="提示" xml:space="preserve">
+    <value>提示</value>
+  </data>
+  <data name="Plc交互出错" xml:space="preserve">
+    <value>Plc交互出错</value>
+  </data>
+  <data name="产品码" xml:space="preserve">
+    <value>产品码</value>
+  </data>
+  <data name="耗时" xml:space="preserve">
+    <value>耗时</value>
+  </data>
+  <data name="结果" xml:space="preserve">
+    <value>结果</value>
+  </data>
+  <data name="回复完成" xml:space="preserve">
+    <value>回复完成</value>
+  </data>
+  <data name="图片轮询" xml:space="preserve">
+    <value>图片轮询</value>
+  </data>
+  <data name="单张图片" xml:space="preserve">
+    <value>单张图片</value>
+  </data>
+  <data name="清除计数" xml:space="preserve">
+    <value>清除计数</value>
+  </data>
+</root>

+ 28 - 0
ValueConverters/LanguageToResources.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace LampInspectionMachine.ValueConverters
+{
+    public class LanguageToResources : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ( value != null ) 
+            {
+                return LampInspectionMachine.Resources.Language.Resources.ResourceManager.GetString(value.ToString());
+            }
+           
+            return null;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 1 - 1
ViewModels/CameraViewModel.cs

@@ -122,7 +122,7 @@ namespace LampInspectionMachine.ViewModels
         {
             System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
             {
-                string str = log.Msg.Trim();
+                string str = log.Msg.Trim().Replace("相机",Resources.Language.Resources.相机);
                  Logs.Add(str);
                 if (Logs.Count > 100)
                 {

+ 3 - 3
ViewModels/WorkRunViewModel.cs

@@ -89,7 +89,7 @@ namespace LampInspectionMachine.ViewModels
                 {
                     Logs.Clear();
                 }
-                string str = log.Msg.Trim();
+                string str = log.Msg.Trim().Replace("相机",Resources.Language.Resources.相机); ;
                 Logs.Add(str);    
                 
             }));
@@ -142,8 +142,8 @@ namespace LampInspectionMachine.ViewModels
             }
             catch (Exception ex)
             {
-                LogHelper.Error("切运行界面出错" + ex.Message);
-                MessageBox.Show("切运行界面出错"+ex.Message);
+                LogHelper.Error("切运行界面出错" + ex.Message);
+                MessageBox.Show("切运行界面出错"+ex.Message);
             }
         }
 

+ 19 - 13
Views/CameraView.xaml

@@ -10,13 +10,19 @@
              xmlns:prism="http://prismlibrary.com/"
              xmlns:valueConvert="clr-namespace:LampInspectionMachine.ValueConverters"
              prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:c="clr-namespace:LampInspectionMachine.ValueConverters"
              mc:Ignorable="d"
              FontFamily="微软雅黑"
+             xmlns:lex="http://wpflocalizeextension.codeplex.com"
+             lex:LocalizeDictionary.DesignCulture="zh-CN"
+             lex:ResxLocalizationProvider.DefaultAssembly="LampInspectionMachine"
+             lex:ResxLocalizationProvider.DefaultDictionary="Resources"
              FontSize="10"
              d:DesignHeight="800"
              d:DesignWidth="800"
              d:Background="White">
     <UserControl.Resources>
+        <c:LanguageToResources x:Key="languageToResources" />
         <Style x:Key="buttonborder"
                TargetType="Border">
             <Setter Property="BorderThickness"
@@ -299,7 +305,7 @@
             </Grid.ColumnDefinitions>
             <Grid>
                 <StackPanel >
-                    <TextBlock Text="{Binding CanmeraName}" FontSize="20" VerticalAlignment="Center"/>
+                    <TextBlock Text="{Binding CanmeraName,Converter={StaticResource languageToResources}}" FontSize="20" VerticalAlignment="Center"/>
                     <Grid>
                         <Grid.RowDefinitions>
                             <RowDefinition Height="Auto" />
@@ -313,7 +319,7 @@
                                 Margin="50,15,0,0"
                                 Orientation="Vertical"
                                 VerticalAlignment="Center">
-                            <GroupBox Header="相机">
+                            <GroupBox Header="{lex:Loc 相机}">
 
                                 <ComboBox x:Name="combox"
                                   Width="190"
@@ -327,13 +333,13 @@
                                 Margin="50,5,0,0"
                                 Orientation="Horizontal"
                                 VerticalAlignment="Center">
-                            <GroupBox Header="采集方式">
+                            <GroupBox Header="{lex:Loc 采集方式}">
                                 <StackPanel Orientation="Horizontal">
-                                    <RadioButton  Content="软触发"
+                                    <RadioButton  Content="{lex:Loc 软触发}"
                                               IsChecked="{Binding Management.CurrCamConfig.TriggerMode,Converter={StaticResource EnumToBoolConverter},ConverterParameter=软触发}"
                                               GroupName="SoftTrigger"
                                               Margin="10" />
-                                    <RadioButton  Content="硬触发"
+                                    <RadioButton  Content="{lex:Loc 硬触发}"
                                               IsChecked="{Binding Management.CurrCamConfig.TriggerMode,Converter={StaticResource EnumToBoolConverter},ConverterParameter=硬触发}"
                                               GroupName="SoftTrigger"
                                               Margin="30,10,40,0" />
@@ -345,7 +351,7 @@
                                 Margin="50,5,0,0"
                                 Orientation="Horizontal"
                                 VerticalAlignment="Center">
-                            <GroupBox Header="曝光">
+                            <GroupBox Header="{lex:Loc 曝光}">
                                 <StackPanel Orientation="Horizontal">
                                     <TextBox Width="190" Text="{Binding  Management.CurrCamConfig.ExpouseTime}"/>
                                     <Border Background="#0A85D9"
@@ -353,7 +359,7 @@
                                                 BorderThickness="1"
                                                 Margin="10,5,3,5"
                                                 CornerRadius="8">
-                                        <Button Content="曝光写入"
+                                        <Button Content="{lex:Loc 曝光写入}"
                                                 Background="Transparent"
                                                 Foreground="White"
                                                 Margin="2" 
@@ -379,7 +385,7 @@
                                     BorderThickness="1"
                                     Margin="10,5,3,5"
                                     CornerRadius="8">
-                                    <Button Content="初始化"
+                                    <Button Content="{lex:Loc 初始化}"
                                         Background="Transparent"
                                         Foreground="White"
                                         Margin="2" 
@@ -393,7 +399,7 @@
                                     BorderThickness="1"
                                     Margin="40,5,3,5"
                                     CornerRadius="8">
-                                    <Button Content="关闭"
+                                    <Button Content="{lex:Loc 关闭}"
                                         Background="Transparent"
                                         Foreground="White"
                                         Margin="2"
@@ -419,7 +425,7 @@
                                     BorderThickness="1"
                                     Margin="10,5,3,5"
                                     CornerRadius="8">
-                                    <Button Content="开始采集"
+                                    <Button Content="{lex:Loc 开始采集}"
                                         Background="Transparent"
                                         Foreground="White"
                                         Margin="2"
@@ -433,7 +439,7 @@
                                     BorderThickness="1"
                                     Margin="40,5,3,5"
                                     CornerRadius="8">
-                                    <Button Content="单张采集"
+                                    <Button Content="{lex:Loc 单张采集}"
                                         Background="Transparent"
                                         Foreground="White"
                                         Margin="2"
@@ -459,7 +465,7 @@
                                     BorderThickness="1"
                                     Margin="10,5,3,5"
                                     CornerRadius="8">
-                                    <Button Content="图片轮询"
+                                    <Button Content="{lex:Loc 图片轮询}"
                                         Background="Transparent"
                                         Foreground="White"
                                         Margin="2"
@@ -473,7 +479,7 @@
                                     BorderThickness="1"
                                     Margin="40,5,3,5"
                                     CornerRadius="8">
-                                    <Button Content="单张图片"
+                                    <Button Content="{lex:Loc 单张图片}"
                                         Background="Transparent"
                                         Foreground="White"
                                         Margin="2"

+ 10 - 6
Views/MainWindow.xaml

@@ -6,10 +6,14 @@
         xmlns:local="clr-namespace:LampInspectionMachine"
         xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
         xmlns:prism="http://prismlibrary.com/"
+        xmlns:lex="http://wpflocalizeextension.codeplex.com"
+        lex:LocalizeDictionary.DesignCulture="zh-CN"
+        lex:ResxLocalizationProvider.DefaultAssembly="LampInspectionMachine"
+        lex:ResxLocalizationProvider.DefaultDictionary="Resources"
         prism:ViewModelLocator.AutoWireViewModel="True"
         mc:Ignorable="d"
         WindowStyle="None"
-        Title="包装"
+        Title="{lex:Loc 灯检}"
         Height="450"
         FontWeight="Bold"
         FontFamily="微软雅黑"
@@ -79,7 +83,7 @@
                   VerticalAlignment="Center">
                 <StackPanel Orientation="Horizontal">
 
-                    <TextBlock Text="灯检"
+                    <TextBlock Text="{lex:Loc 灯检}"
                                FontSize="26"
                                Margin="30,20,0,0"
                                FontWeight="Bold" />
@@ -98,19 +102,19 @@
                                VerticalAlignment="Bottom" />-->
                     <Border Style="{StaticResource buttonborder}">
 
-                        <Button Content="权限登录"
+                        <!--<Button Content="权限登录"
                                 VerticalAlignment="Top"
                                 Command="{Binding OpenRoleLoginViewCommand}"
                                 Padding="5"
                                 BorderBrush="Transparent"
                                 FontSize="15"
                                 WindowChrome.IsHitTestVisibleInChrome="True"
-                                Background="Transparent" />
+                                Background="Transparent" />-->
 
                     </Border>
                     <Border Style="{StaticResource buttonborder}">
 
-                        <Button Content="视觉界面"
+                        <Button Content="{lex:Loc 视觉界面}"
                                 VerticalAlignment="Top"
                                 Padding="5"
                                 BorderBrush="Transparent"
@@ -123,7 +127,7 @@
                     </Border>
                     <Border Style="{StaticResource buttonborder}">
 
-                        <Button Content="运行界面"
+                        <Button Content="{lex:Loc 运行界面}"
                                 VerticalAlignment="Top"
                                 Padding="5"
                                 BorderBrush="Transparent"

+ 15 - 11
Views/WorkRunView.xaml

@@ -5,6 +5,10 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:local="clr-namespace:LampInspectionMachine.Views"
              xmlns:prism="http://prismlibrary.com/"
+             xmlns:lex="http://wpflocalizeextension.codeplex.com"
+             lex:LocalizeDictionary.DesignCulture="zh-CN"
+             lex:ResxLocalizationProvider.DefaultAssembly="LampInspectionMachine"
+             lex:ResxLocalizationProvider.DefaultDictionary="Resources"
              xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              xmlns:Viewlocal="clr-namespace:LampInspectionMachine.ViewModels"
              xmlns:cognexWF1="clr-namespace:Cognex.VisionPro;assembly=Cognex.VisionPro.Controls"
@@ -95,37 +99,37 @@
                     Grid.RowSpan="3"
                     Grid.Row="0">
             <StackPanel Orientation="Horizontal" Margin="20,0,0,0">
-                <TextBlock Text="相机1_OK:" Margin="5" Foreground="Green" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机1_OK}" Margin="5" Foreground="Green" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[0].IsOkCount}" Margin="5" Foreground="Green" FontSize="18" MinWidth="80" MaxWidth="100"/>
-                <TextBlock Text="相机1_NG:" Margin="5" Foreground="Red" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机1_NG}" Margin="5" Foreground="Red" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[0].IsNgCount}" Margin="5" Foreground="Red" FontSize="18"/>
             </StackPanel>
 
             <StackPanel Orientation="Horizontal" Margin="20,0,0,0">
-                <TextBlock Text="相机2_OK:" Margin="5" Foreground="Green" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机2_OK}" Margin="5" Foreground="Green" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[1].IsOkCount}" Margin="5" Foreground="Green" FontSize="18" MinWidth="80" MaxWidth="100"/>
-                <TextBlock Text="相机2_NG:" Margin="5" Foreground="Red" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机2_NG}" Margin="5" Foreground="Red" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[1].IsNgCount}" Margin="5" Foreground="Red" FontSize="18"/>
             </StackPanel>
 
             <StackPanel Orientation="Horizontal" Margin="20,0,0,0">
-                <TextBlock Text="相机3_OK:" Margin="5" Foreground="Green" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机3_OK}" Margin="5" Foreground="Green" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[2].IsOkCount}" Margin="5" Foreground="Green" FontSize="18" MinWidth="80" MaxWidth="100"/>
-                <TextBlock Text="相机3_NG:" Margin="5" Foreground="Red" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机3_NG}" Margin="5" Foreground="Red" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[2].IsNgCount}" Margin="5" Foreground="Red" FontSize="18"/>
             </StackPanel>
 
             <StackPanel Orientation="Horizontal" Margin="20,0,0,0">
-                <TextBlock Text="相机4_OK:" Margin="5" Foreground="Green" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机4_OK}" Margin="5" Foreground="Green" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[3].IsOkCount}" Margin="5" Foreground="Green" FontSize="18" MinWidth="80" MaxWidth="100"/>
-                <TextBlock Text="相机4_NG:" Margin="5" Foreground="Red" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机4_NG}" Margin="5" Foreground="Red" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[3].IsNgCount}" Margin="5" Foreground="Red" FontSize="18"/>
             </StackPanel>
 
             <StackPanel Orientation="Horizontal" Margin="20,0,0,0">
-                <TextBlock Text="相机5_OK:" Margin="5" Foreground="Green" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机5_OK}" Margin="5" Foreground="Green" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[4].IsOkCount}" Margin="5" Foreground="Green" FontSize="18" MinWidth="80" MaxWidth="100"/>
-                <TextBlock Text="相机5_NG:" Margin="5" Foreground="Red" FontSize="18"/>
+                <TextBlock Text="{lex:Loc 相机5_NG}" Margin="5" Foreground="Red" FontSize="18"/>
                 <TextBlock Text="{Binding Management.VisionProManagers[4].IsNgCount}" Margin="5" Foreground="Red" FontSize="18"/>
             </StackPanel>
             <Border Background="#0A85D9"
@@ -136,7 +140,7 @@
                     HorizontalAlignment="Right"
                     Margin="0,0,0,0"
                     CornerRadius="8">
-                <Button Content="清除计数"
+                <Button Content="{lex:Loc 清除计数}"
                   Background="Transparent"
                   Foreground="White"
                   Margin="2"

+ 2 - 0
packages.config

@@ -25,4 +25,6 @@
   <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
   <package id="Unity.Abstractions" version="5.11.7" targetFramework="net48" />
   <package id="Unity.Container" version="5.11.11" targetFramework="net48" />
+  <package id="WPFLocalizeExtension" version="3.10.0" targetFramework="net48" />
+  <package id="XAMLMarkupExtensions" version="2.1.3" targetFramework="net48" />
 </packages>