瀏覽代碼

添加项目文件。

刘彬 1 年之前
父節點
當前提交
26bdabc254
共有 54 個文件被更改,包括 6387 次插入 和 0 次删除
  1. 54 0
      App.config
  2. 9 0
      App.xaml
  3. 44 0
      App.xaml.cs
  4. 59 0
      Cameralibs/CameraBrand.cs
  5. 130 0
      Cameralibs/CameraService.cs
  6. 14 0
      Cameralibs/CameraType.cs
  7. 485 0
      Cameralibs/HKCamera/MvCamera.cs
  8. 138 0
      Cameralibs/ICamera.cs
  9. 690 0
      Core/Management.cs
  10. 40 0
      Core/TipService.cs
  11. 42 0
      Core/VisionProManager.cs
  12. 114 0
      DataBase/SqlSugarHelper.cs
  13. 139 0
      HttpService/HttpWebResponseUtility.cs
  14. 352 0
      LampInspectionMachine.csproj
  15. 31 0
      LampInspectionMachine.sln
  16. 78 0
      Log4xml/LogHelper.cs
  17. 252 0
      Log4xml/log4net.config
  18. 67 0
      Model/AppData.cs
  19. 84 0
      Model/CameraInfo.cs
  20. 49 0
      Model/ProjectData.cs
  21. 76 0
      Model/Users.cs
  22. 53 0
      Properties/AssemblyInfo.cs
  23. 63 0
      Properties/Resources.Designer.cs
  24. 117 0
      Properties/Resources.resx
  25. 26 0
      Properties/Settings.Designer.cs
  26. 7 0
      Properties/Settings.settings
  27. 54 0
      ValueConverters/EnumToBoolConverter.cs
  28. 198 0
      ViewModels/CameraViewModel.cs
  29. 107 0
      ViewModels/MainWindowViewModel.cs
  30. 64 0
      ViewModels/MenuViewModel.cs
  31. 20 0
      ViewModels/ProductViewModel.cs
  32. 175 0
      ViewModels/RoleLoginViewModel.cs
  33. 47 0
      ViewModels/SettingViewModel.cs
  34. 55 0
      ViewModels/VisionProViewModel.cs
  35. 77 0
      ViewModels/WorkRunViewModel.cs
  36. 445 0
      Views/CameraView.xaml
  37. 37 0
      Views/CameraView.xaml.cs
  38. 112 0
      Views/LoadingView.xaml
  39. 42 0
      Views/LoadingView.xaml.cs
  40. 173 0
      Views/MainWindow.xaml
  41. 76 0
      Views/MainWindow.xaml.cs
  42. 190 0
      Views/MenuView.xaml
  43. 15 0
      Views/MenuView.xaml.cs
  44. 433 0
      Views/ProductView.xaml
  45. 15 0
      Views/ProductView.xaml.cs
  46. 347 0
      Views/RoleLoginView.xaml
  47. 20 0
      Views/RoleLoginView.xaml.cs
  48. 303 0
      Views/SettingView.xaml
  49. 15 0
      Views/SettingView.xaml.cs
  50. 20 0
      Views/VisionProView.xaml
  51. 40 0
      Views/VisionProView.xaml.cs
  52. 52 0
      Views/WorkRunView.xaml
  53. 15 0
      Views/WorkRunView.xaml.cs
  54. 27 0
      packages.config

+ 54 - 0
App.config

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
+  </startup>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Prism" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-8.1.97.5141" newVersion="8.1.97.5141" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Prism.Wpf" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-8.1.97.5141" newVersion="8.1.97.5141" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Unity.Container" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.11.9.0" newVersion="5.11.9.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.0.119.0" newVersion="1.0.119.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+  <entityFramework>
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
+    </providers>
+  </entityFramework>
+  <system.data>
+    <DbProviderFactories>
+      <remove invariant="System.Data.SQLite.EF6" />
+      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
+    <remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
+  </system.data>
+</configuration>

+ 9 - 0
App.xaml

@@ -0,0 +1,9 @@
+<prism:PrismApplication  x:Class="LampInspectionMachine.App"
+                         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                         xmlns:local="clr-namespace:LampInspectionMachine"
+                         xmlns:prism="http://prismlibrary.com/">
+    <Application.Resources>
+
+    </Application.Resources>
+</prism:PrismApplication>

+ 44 - 0
App.xaml.cs

@@ -0,0 +1,44 @@
+using LampInspectionMachine.Core;
+using LampInspectionMachine.Log4xml;
+using LampInspectionMachine.Model;
+using LampInspectionMachine.Views;
+using log4net.Config;
+using Prism.Ioc;
+using Prism.Unity;
+using System.ComponentModel;
+using System.IO;
+using System.Windows;
+
+namespace LampInspectionMachine
+{
+    /// <summary>
+    /// App.xaml 的交互逻辑
+    /// </summary>
+    public partial class App : PrismApplication
+    {
+        protected override Window CreateShell()
+        {
+
+
+            XmlConfigurator.Configure(new FileInfo("Log4xml/log4net.config"));
+            LogHelper.Info("程序启动");
+            return Container.Resolve<MainWindow>();
+        }
+
+        protected override void RegisterTypes(IContainerRegistry containerRegistry)
+        {
+            containerRegistry.RegisterForNavigation<RoleLoginView>("RoleLoginView");
+            containerRegistry.RegisterForNavigation<MenuView>("MenuView");
+            containerRegistry.RegisterForNavigation<ProductView>("ProductView");
+            containerRegistry.RegisterForNavigation<SettingView>("SettingView");
+            containerRegistry.RegisterForNavigation<WorkRunView>("WorkRunView");
+            containerRegistry.RegisterForNavigation<VisionProView>("VisionProView");
+            containerRegistry.RegisterForNavigation<VisionProView>("VisionProView");
+            containerRegistry.RegisterSingleton<AppData>();
+            containerRegistry.RegisterSingleton<Management>();
+            containerRegistry.RegisterForNavigation<CameraView>("CameraView"); 
+        }
+
+
+    }
+}

+ 59 - 0
Cameralibs/CameraBrand.cs

@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.Cameralibs
+{
+    public enum CameraBrand
+    {
+        /// <summary>
+        /// 海康相机
+        /// </summary>
+        [Description("海康相机(MVS)")]
+        HikRobot_MVS = 0,
+        /// <summary>
+        /// 巴斯勒相机
+        /// </summary>
+        [Description("巴斯勒相机(Pylon)")]
+        Basler_Pylon = 1,
+    }
+
+    public enum TriggerSource
+    {
+        /// <summary>
+        /// 软触发
+        /// </summary>
+        [Description("软触发")]
+        Software,
+        /// <summary>
+        /// 线路0
+        /// </summary>
+        [Description("线路0")]
+        Line0,
+        /// <summary>
+        /// 线路1
+        /// </summary>
+        [Description("线路1")]
+        Line1,
+        /// <summary>
+        /// 线路2
+        /// </summary>
+        [Description("线路2")]
+        Line2,
+        /// <summary>
+        /// 线路3
+        /// </summary>
+        [Description("线路3")]
+        Line3,
+
+    }
+
+    public enum TriggerPolarity
+    {
+        RisingEdge,
+        FallingEdge
+    }
+}

+ 130 - 0
Cameralibs/CameraService.cs

@@ -0,0 +1,130 @@
+using LampInspectionMachine.Cameralibs.HKCamera;
+using LampInspectionMachine.Model;
+using MvCamCtrl.NET;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.Cameralibs
+{
+    public class CameraService
+    {
+        private readonly Dictionary<Guid, ICamera> _CameraCollection;
+
+        public CameraService()
+        {
+            _CameraCollection = new Dictionary<Guid, ICamera>();
+        }
+
+        public List<string> GetDeviceEnum() 
+        {
+            GC.Collect();
+            List<CCameraInfo> m_ltDeviceList = new List<CCameraInfo>();
+            int nRet = CSystem.EnumDevices(CSystem.MV_GIGE_DEVICE | CSystem.MV_USB_DEVICE, ref m_ltDeviceList);
+            if ( 0 != nRet )
+            {
+                throw new Exception("Enumerate devices fail!");
+            }
+            List<string> listsn = new List<string>();
+            MyCamera.MV_CC_DEVICE_INFO device = default(MyCamera.MV_CC_DEVICE_INFO);
+            for ( int i = 0; i < m_ltDeviceList.Count; i++ )
+            {
+                if ( m_ltDeviceList[ i ].nTLayerType == CSystem.MV_GIGE_DEVICE )
+                {
+                    CGigECameraInfo gigeInfo = (CGigECameraInfo)m_ltDeviceList[i];
+                    listsn.Add(gigeInfo.chSerialNumber);
+                }
+                else if ( m_ltDeviceList[ i ].nTLayerType == CSystem.MV_USB_DEVICE )
+                {
+                    CGigECameraInfo usbInfo = (CGigECameraInfo)m_ltDeviceList[i];
+                    listsn.Add(usbInfo.chSerialNumber);
+                }
+
+            
+
+            }
+
+            return listsn;
+
+
+        }
+        public bool CreateCamera(Guid id ,CameraInfo cameraInfo)
+        {
+            ICamera  camera = new MvCamera(id, cameraInfo.SerialNumber);
+            
+
+            if ( _CameraCollection.ContainsKey(id) )
+            {
+                var currenCamera = _CameraCollection[id];
+                currenCamera.CloseDevice();
+            }
+            else
+            {
+                _CameraCollection.Add(id, camera);
+            }
+            return true;
+        }
+
+        public Task<bool> CreateCameraAsync(Guid id, CameraInfo cameraInfo)
+        {
+            ICamera camera= new MvCamera(id, cameraInfo.SerialNumber);
+            if ( _CameraCollection.ContainsKey(id) )
+            {
+                var currenCamera = _CameraCollection[id];
+                currenCamera.CloseDevice();
+            }
+            else
+            {
+                _CameraCollection.Add(id, camera);
+            }
+            return Task.FromResult(true);
+        }
+
+        public ICamera GetCamera(Guid id)
+        {
+            return _CameraCollection[ id ];
+        }
+
+        public Task<ICamera> GetCameraAsync(Guid id)
+        {
+            return Task.FromResult(_CameraCollection[ id ]);
+        }
+
+        public void UnRegisterCamera(Guid id)
+        {
+            if ( _CameraCollection.ContainsKey(id) )
+            {
+                var camera = _CameraCollection[id];
+                camera.CloseDevice();
+            }
+        }
+
+        public Task UnRegisterCameraAsync(Guid id)
+        {
+            if ( _CameraCollection.ContainsKey(id) )
+            {
+                var camera = _CameraCollection[id];
+                camera.CloseDevice();
+            }
+            return Task.CompletedTask;
+        }
+
+        public void Dispose()
+        {
+            foreach ( var camera in _CameraCollection )
+            {
+                try
+                {
+                    camera.Value.CloseDevice();
+                }
+                catch ( Exception )
+                {
+
+                }
+            }
+        }
+    }
+}

+ 14 - 0
Cameralibs/CameraType.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.Cameralibs
+{
+    public enum CameraType
+    {
+        GIGE=1,
+        USB=4,
+    }
+}

+ 485 - 0
Cameralibs/HKCamera/MvCamera.cs

@@ -0,0 +1,485 @@
+using Cognex.VisionPro;
+using MvCamCtrl.NET;
+using SqlSugar.DistributedSystem.Snowflake;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Data.SqlTypes;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using static MvCamCtrl.NET.MyCamera;
+
+namespace LampInspectionMachine.Cameralibs.HKCamera
+{
+    public class MvCamera : ICamera, INotifyPropertyChanged
+    {
+        #region 字段
+        private Thread m_hReceiveThread;
+        #endregion
+
+        #region 属性
+
+        public CameraBrand CameraBrand { get => CameraBrand.HikRobot_MVS; }
+
+        public string Name { get; private set; }
+        public Guid ID { get; private set; }
+        public string ManufacturerName { get; private set; }
+
+        public string ModelName { get; private set; }
+
+        public string SerialNumber { get; private set; }
+
+        public CameraType CameraType { get; private set; }
+
+        MvCameraAcqTool.MvCameraAcqTool mvCameraAcq;
+
+        public MyCamera.MV_CC_DEVICE_INFO CameraInfo { get; private set; }
+
+        public UInt32 ImageWidth { get; private set; }
+
+        public UInt32 ImageHeight { get; private set; }
+
+        public MvCamCtrl.NET.MvGvspPixelType PixelType { get; private set; }
+
+        private bool _IsGrabbing;
+
+        /// <summary>
+        /// 正在采集
+        /// </summary>
+        public bool IsGrabbing
+        {
+            get { return _IsGrabbing; }
+            private set { SetProperty(ref _IsGrabbing, value); }
+        }
+
+        private ICogImage _Image;
+
+        public ICogImage Image
+        {
+            get { return _Image; }
+            private set { SetProperty(ref _Image, value); }
+        }
+
+        public bool IsConnected { get; private set; }
+
+        private bool IsHaveCamera = false;
+
+        /// <summary>
+        /// 采集用时
+        /// </summary>
+        public TimeSpan TotalTime { get; private set; }
+
+        /// <summary>
+        /// 错误信息
+        /// </summary>
+        public string ErrorMessage { get; private set; }
+        #endregion
+
+        #region 事件
+        public event Action<ICogImage,TimeSpan,string> ImageCallbackEvent;
+        public event Action<Guid, bool> CameraConnectChangedEvent;
+        #endregion
+
+        public MvCamera(Guid _ID, string _SerialNumber)
+        {
+            ID = _ID;
+            SerialNumber = _SerialNumber;
+            mvCameraAcq = new MvCameraAcqTool.MvCameraAcqTool();
+            MyCamera.MV_CC_DEVICE_INFO_LIST stDeviceList = default(MyCamera.MV_CC_DEVICE_INFO_LIST);
+            mvCameraAcq.EnumDeivce(ref stDeviceList);
+            MyCamera.MV_CC_DEVICE_INFO device = default(MyCamera.MV_CC_DEVICE_INFO);
+            for ( int i = 0; i < stDeviceList.nDeviceNum; i++ )
+            {
+                device = ( MyCamera.MV_CC_DEVICE_INFO ) Marshal.PtrToStructure(stDeviceList.pDeviceInfo[ i ], typeof(MyCamera.MV_CC_DEVICE_INFO));
+                if ( device.nTLayerType == CSystem.MV_GIGE_DEVICE )
+                {
+                    MV_GIGE_DEVICE_INFO stGigEDeviceInfo = (MV_GIGE_DEVICE_INFO)MyCamera.ByteToStruct(device.SpecialInfo.stGigEInfo, typeof(MV_GIGE_DEVICE_INFO));
+                    if ( string.Equals(stGigEDeviceInfo.chSerialNumber, _SerialNumber) )
+                    {
+                        ManufacturerName = stGigEDeviceInfo.chManufacturerName;
+                        ModelName = stGigEDeviceInfo.chModelName;
+                        SerialNumber = stGigEDeviceInfo.chSerialNumber;
+                        CameraType = CameraType.GIGE;
+                        CameraInfo = device;
+                        IsHaveCamera = true;
+                        break;
+                    }
+                }
+                else if ( device.nTLayerType == CSystem.MV_USB_DEVICE )
+                {
+                    MV_USB3_DEVICE_INFO usbInfo = (MV_USB3_DEVICE_INFO)MyCamera.ByteToStruct(device.SpecialInfo.stUsb3VInfo, typeof(MV_USB3_DEVICE_INFO));
+                    if ( string.Equals(usbInfo.chSerialNumber, _SerialNumber) )
+                    {
+                        ManufacturerName = usbInfo.chManufacturerName;
+                        ModelName = usbInfo.chModelName;
+                        SerialNumber = usbInfo.chSerialNumber;
+                        CameraType = CameraType.USB;
+                        CameraInfo = device;
+                        IsHaveCamera = true;
+                        break;
+                    }
+                }
+            }
+            IsConnected = false;
+        }
+
+        #region 方法
+
+        public  List<string> GetListEnum()
+        {
+            GC.Collect();
+            mvCameraAcq = new MvCameraAcqTool.MvCameraAcqTool();
+            MyCamera.MV_CC_DEVICE_INFO_LIST stDeviceList = default(MyCamera.MV_CC_DEVICE_INFO_LIST);
+            mvCameraAcq.EnumDeivce(ref stDeviceList);
+
+            List<string> listsn = new List<string>();
+            MyCamera.MV_CC_DEVICE_INFO device = default(MyCamera.MV_CC_DEVICE_INFO);
+            for ( int i = 0; i < stDeviceList.nDeviceNum; i++ )
+            {
+                device = ( MyCamera.MV_CC_DEVICE_INFO ) Marshal.PtrToStructure(stDeviceList.pDeviceInfo[ i ], typeof(MyCamera.MV_CC_DEVICE_INFO));
+
+                if ( device.nTLayerType == CSystem.MV_GIGE_DEVICE )
+                {
+                    MV_GIGE_DEVICE_INFO stGigEDeviceInfo = (MV_GIGE_DEVICE_INFO)MyCamera.ByteToStruct(device.SpecialInfo.stGigEInfo, typeof(MV_GIGE_DEVICE_INFO));
+                    listsn.Add(stGigEDeviceInfo.chSerialNumber);
+
+                }
+                else if ( device.nTLayerType == CSystem.MV_USB_DEVICE )
+                {
+                    MV_USB3_DEVICE_INFO usbInfo = (MV_USB3_DEVICE_INFO)MyCamera.ByteToStruct(device.SpecialInfo.stUsb3VInfo, typeof(MV_USB3_DEVICE_INFO));
+                    listsn.Add(usbInfo.chSerialNumber);
+                }
+            }
+
+            return listsn;
+        }
+
+        /// <summary>
+        /// 打开相机
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public bool OpenDevice()
+        {
+            if ( !IsHaveCamera )
+            {
+                mvCameraAcq = new MvCameraAcqTool.MvCameraAcqTool();
+                MyCamera.MV_CC_DEVICE_INFO_LIST stDeviceList = default(MyCamera.MV_CC_DEVICE_INFO_LIST);
+                mvCameraAcq.EnumDeivce(ref stDeviceList);
+                MyCamera.MV_CC_DEVICE_INFO device = default(MyCamera.MV_CC_DEVICE_INFO);
+                for ( int i = 0; i < stDeviceList.nDeviceNum; i++ )
+                {
+                    device = ( MyCamera.MV_CC_DEVICE_INFO ) Marshal.PtrToStructure(stDeviceList.pDeviceInfo[ i ], typeof(MyCamera.MV_CC_DEVICE_INFO));
+                    if ( device.nTLayerType == CSystem.MV_GIGE_DEVICE )
+                    {
+                        MV_GIGE_DEVICE_INFO stGigEDeviceInfo = (MV_GIGE_DEVICE_INFO)MyCamera.ByteToStruct(device.SpecialInfo.stGigEInfo, typeof(MV_GIGE_DEVICE_INFO));
+                        if ( string.Equals(stGigEDeviceInfo.chSerialNumber, SerialNumber) )
+                        {
+                            ManufacturerName = stGigEDeviceInfo.chManufacturerName;
+                            ModelName = stGigEDeviceInfo.chModelName;
+                            SerialNumber = stGigEDeviceInfo.chSerialNumber;
+                            CameraType = CameraType.GIGE;
+                            CameraInfo = device;
+                            IsHaveCamera = true;
+                            break;
+                        }
+                    }
+                    else if ( device.nTLayerType == CSystem.MV_USB_DEVICE )
+                    {
+                        MV_USB3_DEVICE_INFO usbInfo = (MV_USB3_DEVICE_INFO)MyCamera.ByteToStruct(device.SpecialInfo.stUsb3VInfo, typeof(MV_USB3_DEVICE_INFO));
+                        if ( string.Equals(usbInfo.chSerialNumber, SerialNumber) )
+                        {
+                            ManufacturerName = usbInfo.chManufacturerName;
+                            ModelName = usbInfo.chModelName;
+                            SerialNumber = usbInfo.chSerialNumber;
+                            CameraType = CameraType.USB;
+                            CameraInfo = device;
+                            IsHaveCamera = true;
+                            break;
+                        }
+                    }
+                }
+                if ( !IsHaveCamera )
+                {
+                    throw new Exception("没有发现相机");
+                }
+            }
+
+            mvCameraAcq.OpenDevice(CameraInfo);
+            mvCameraAcq.AutoExposure = false;
+            mvCameraAcq.TriggerMode = false;
+            if ( !IsConnected )
+            {
+                CameraConnectChangedEvent?.Invoke(ID, true);
+            }
+            IsConnected = mvCameraAcq.bIsOpened;
+            return IsConnected;
+        }
+        /// <summary>
+        /// 关闭相机
+        /// </summary>
+        public void CloseDevice()
+        {
+            // ch:关闭设备 | en:Close Device
+            mvCameraAcq.CloseDevice();
+        }
+
+        public void SetTriggerModeOn() 
+        {
+            mvCameraAcq.TriggerMode = true;
+        }
+        public void SetTriggerModeOff()
+        {
+            mvCameraAcq.TriggerMode = false;
+
+        }
+        public void SetTriggerSoftware(int value = 7)
+        {
+              // 设置触发源为Line0
+            mvCameraAcq.TriggerSoftware =value ;
+            CCamera.RegisterImageCallBackEx(, IntPtr.Zero);
+        }
+
+        /// <summary>
+        /// 采集图像
+        /// </summary>
+        /// <returns></returns>
+        public ICogImage Grab()
+        {
+            Stopwatch sw = Stopwatch.StartNew();
+            for ( int i = 0; i < 5; i++ )
+            {
+                try
+                {
+                    if ( !mvCameraAcq.bIsOpened )
+                    {
+                        OpenDevice();
+                    }
+                    mvCameraAcq.Run();
+                    if ( mvCameraAcq.RunStatus.Result == CogToolResultConstants.Accept )
+                    {
+                        ErrorMessage = "";
+                        Image = mvCameraAcq.OutputImage;
+                        if ( !IsConnected )
+                        {
+                            IsConnected = true;
+                            CameraConnectChangedEvent?.Invoke(ID, true);
+                        }
+                        TotalTime = sw.Elapsed;
+                       
+                        return Image;
+                    }
+                    else
+                    {
+                        ErrorMessage = mvCameraAcq.RunStatus.Message;
+                        CloseDevice();
+                        OpenDevice();
+                    }
+                }
+                catch ( Exception ex )
+                {
+                    CloseDevice();
+                    OpenDevice();
+                    ErrorMessage = ex.Message;
+                }
+            }
+            if ( IsConnected )
+            {
+                IsConnected = false;
+                CameraConnectChangedEvent?.Invoke(ID, false);
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 开始采集图像
+        /// </summary>
+        public void StartGrabbing()
+        {
+            if ( IsGrabbing )
+                return;
+            IsGrabbing = true;
+            m_hReceiveThread = new Thread(GetStreamThreadProc) { IsBackground = true };
+            m_hReceiveThread.Start();
+        }
+
+        /// <summary>
+        /// 停止采集图像
+        /// </summary>
+        public void StopGrabbing()
+        {
+            try
+            {
+                if ( IsGrabbing )
+                {
+                    IsGrabbing = false;
+                    Thread.Sleep(1000);
+                    if ( m_hReceiveThread != null )
+                    {
+                        m_hReceiveThread.Abort();
+                        m_hReceiveThread = null;
+                    }
+                }
+            }
+            catch ( Exception )
+            {
+
+            }
+        }
+
+        /// <summary>
+        /// 设置曝光时间
+        /// </summary>
+        /// <param name="ExposureTime"></param>
+        /// <returns></returns>
+        public bool SetExposureTime(float ExposureTime)
+        {
+            if ( !mvCameraAcq.bIsOpened )
+                return false;
+            mvCameraAcq.ExposureTime = ( double ) ExposureTime;
+            return true;
+        }
+
+        /// <summary>
+        /// 获取曝光时间
+        /// </summary>
+        /// <returns></returns>
+        public float GetExposureTime()
+        {
+            if ( !mvCameraAcq.bIsOpened )
+                return 0;
+            return ( float ) mvCameraAcq.ExposureTime;
+        }
+
+        /// <summary>
+        /// 设置增益
+        /// </summary>
+        /// <param name="Gain"></param>
+        /// <returns></returns>
+        public bool SetGain(float Gain)
+        {
+            if ( !mvCameraAcq.bIsOpened )
+                return false;
+            mvCameraAcq.AnalogGain = ( double ) Gain;
+            return true;
+        }
+
+        /// <summary>
+        /// 获取增益
+        /// </summary>
+        /// <returns></returns>
+        public float GetGain()
+        {
+            if ( !mvCameraAcq.bIsOpened )
+                return 0;
+            return ( float ) mvCameraAcq.AnalogGain;
+        }
+
+        private void GetStreamThreadProc()
+        {
+            while ( IsGrabbing )
+            {
+                try
+                {
+                    Grab();
+                  //  ImageCallbackEvent?.Invoke(Image, TotalTime, ErrorMessage);
+                }
+                catch ( Exception )
+                {
+
+                }
+                Thread.Sleep(10);
+            }
+            IsGrabbing = false;
+        }
+        #endregion
+
+        #region 属性通知
+        /// <summary>
+        /// Occurs when a property value changes.
+        /// </summary>
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        /// <summary>
+        /// Checks if a property already matches a desired value. Sets the property and
+        /// notifies listeners only when necessary.
+        /// </summary>
+        /// <typeparam name="T">Type of the property.</typeparam>
+        /// <param name="storage">Reference to a property with both getter and setter.</param>
+        /// <param name="value">Desired value for the property.</param>
+        /// <param name="propertyName">Name of the property used to notify listeners. This
+        /// value is optional and can be provided automatically when invoked from compilers that
+        /// support CallerMemberName.</param>
+        /// <returns>True if the value was changed, false if the existing value matched the
+        /// desired value.</returns>
+        protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
+        {
+            if ( EqualityComparer<T>.Default.Equals(storage, value) ) return false;
+
+            storage = value;
+            RaisePropertyChanged(propertyName);
+
+            return true;
+        }
+
+        /// <summary>
+        /// Checks if a property already matches a desired value. Sets the property and
+        /// notifies listeners only when necessary.
+        /// </summary>
+        /// <typeparam name="T">Type of the property.</typeparam>
+        /// <param name="storage">Reference to a property with both getter and setter.</param>
+        /// <param name="value">Desired value for the property.</param>
+        /// <param name="propertyName">Name of the property used to notify listeners. This
+        /// value is optional and can be provided automatically when invoked from compilers that
+        /// support CallerMemberName.</param>
+        /// <param name="onChanged">Action that is called after the property value has been changed.</param>
+        /// <returns>True if the value was changed, false if the existing value matched the
+        /// desired value.</returns>
+        protected virtual bool SetProperty<T>(ref T storage, T value, Action onChanged, [CallerMemberName] string propertyName = null)
+        {
+            if ( EqualityComparer<T>.Default.Equals(storage, value) ) return false;
+
+            storage = value;
+            onChanged?.Invoke();
+            RaisePropertyChanged(propertyName);
+
+            return true;
+        }
+
+        /// <summary>
+        /// Raises this object's PropertyChanged event.
+        /// </summary>
+        /// <param name="propertyName">Name of the property used to notify listeners. This
+        /// value is optional and can be provided automatically when invoked from compilers
+        /// that support <see cref="CallerMemberNameAttribute"/>.</param>
+        protected void RaisePropertyChanged([CallerMemberName] string propertyName = null)
+        {
+            OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
+        }
+
+        /// <summary>
+        /// Raises this object's PropertyChanged event.
+        /// </summary>
+        /// <param name="args">The PropertyChangedEventArgs</param>
+        protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
+        {
+            PropertyChanged?.Invoke(this, args);
+        }
+
+        public bool CheckImageCallbackEvent(Action<ICogImage, TimeSpan, string> CamCallBack)
+        {
+            if ( ImageCallbackEvent==null||!ImageCallbackEvent.GetInvocationList().Contains(CamCallBack) ) 
+            {
+                return true;
+            }
+            return false;
+        }
+        #endregion
+    }
+}

+ 138 - 0
Cameralibs/ICamera.cs

@@ -0,0 +1,138 @@
+using Cognex.VisionPro;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.Cameralibs
+{
+    public interface ICamera
+    {
+        string Name { get; }
+
+        Guid ID { get; }
+
+        /// <summary>
+        /// 相机品牌
+        /// </summary>
+        CameraBrand CameraBrand { get; }
+
+        /// <summary>
+        /// 厂商名
+        /// </summary>
+        string ManufacturerName { get; }
+
+        /// <summary>
+        /// 相机型号
+        /// </summary>
+        string ModelName { get; }
+
+        /// <summary>
+        /// 相机序列号
+        /// </summary>
+        string SerialNumber { get; }
+
+        /// <summary>
+        /// 相机类型
+        /// </summary>
+        CameraType CameraType { get; }
+
+        /// <summary>
+        /// 正在采集图像
+        /// </summary>
+        bool IsGrabbing { get; }
+
+        /// <summary>
+        /// 相机图像
+        /// </summary>
+        ICogImage Image { get; }
+
+        bool IsConnected { get; }
+
+        /// <summary>
+        /// 采集用时
+        /// </summary>
+        TimeSpan TotalTime { get; }
+
+        /// <summary>
+        /// 错误信息
+        /// </summary>
+        string ErrorMessage { get; }
+
+        List<string> GetListEnum();
+
+        /// <summary>
+        /// 打开相机
+        /// </summary>
+        /// <returns></returns>
+        bool OpenDevice();
+
+        /// <summary>
+        /// 关闭相机
+        /// </summary>
+        void CloseDevice();
+
+        void SetTriggerModeOn();
+        
+            
+        
+       void SetTriggerModeOff();
+
+      void  SetTriggerSoftware(int value = 7);
+
+
+        /// <summary>
+        /// 采集单张图片
+        /// </summary>
+        /// <returns></returns>
+        ICogImage Grab();
+
+    /// <summary>
+    /// 开始实时采集图像
+    /// </summary>
+    void StartGrabbing();
+
+    /// <summary>
+    /// 停止实时采集图像
+    /// </summary>
+    void StopGrabbing();
+
+    /// <summary>
+    /// 设置曝光时间
+    /// </summary>
+    /// <param name="ExposureTime"></param>
+    /// <returns></returns>
+    bool SetExposureTime(float ExposureTime);
+
+    /// <summary>
+    /// 获取曝光时间
+    /// </summary>
+    /// <returns></returns>
+    float GetExposureTime();
+
+    /// <summary>
+    /// 设置增益
+    /// </summary>
+    /// <param name="Gain"></param>
+    /// <returns></returns>
+    bool SetGain(float Gain);
+
+    /// <summary>
+    /// 获取增益
+    /// </summary>
+    /// <returns></returns>
+    float GetGain();
+
+    /// <summary>
+    /// 图像回调
+    /// </summary>
+    event Action<ICogImage,TimeSpan,string> ImageCallbackEvent;
+    /// <summary>
+    /// 相机连接状态变更时
+    /// </summary>
+    event Action<Guid, bool> CameraConnectChangedEvent;
+
+     bool CheckImageCallbackEvent(Action<ICogImage, TimeSpan, string> action);
+    }
+}

+ 690 - 0
Core/Management.cs

@@ -0,0 +1,690 @@
+using Cognex.VisionPro;
+using Cognex.VisionPro.QuickBuild;
+using LampInspectionMachine.Cameralibs;
+using LampInspectionMachine.Model;
+using MvCamCtrl.NET;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Prism.Mvvm;
+using static Cognex.VisionPro.QuickBuild.CogJobManager;
+using LampInspectionMachine.Log4xml;
+using Cognex.VisionPro.ImageFile;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Web;
+using System.ComponentModel;
+using System.Windows.Media.Media3D;
+using LampInspectionMachine.ViewModels;
+using System.Collections.Concurrent;
+using System.Threading;
+using System.Windows.Controls;
+using LampInspectionMachine.Views;
+using System.Windows.Media.Imaging;
+using System.Windows.Media;
+using System.Windows;
+using System.Runtime.InteropServices;
+using SqlSugar.DistributedSystem.Snowflake;
+using System.Windows.Threading;
+using System.Windows.Ink;
+using System.Data.SqlClient;
+using System.Xml.Linq;
+using System.Drawing.Imaging;
+using System.IO.Packaging;
+using Cognex.VisionPro.ToolBlock;
+using System.Windows.Markup;
+using System.Diagnostics;
+using LampInspectionMachine.Cameralibs.HKCamera;
+using Newtonsoft.Json.Linq;
+using OpenCvSharp.Dnn;
+
+namespace LampInspectionMachine.Core
+{
+    public class Management : BindableBase
+    {
+
+        private bool isConnected = false;
+
+
+        private CogJobManager myJobManager;
+        private List<CogJob> myJobs = new List<CogJob>();
+        private List<CogJobIndependent> myIndependentJobs = new List<CogJobIndependent>();
+        private CameraView cameraView;
+        private ICogImage image = new CogImage8Grey();
+        private WriteableBitmap writeable;
+
+        public WriteableBitmap Writeable { get => writeable; set { SetProperty(ref writeable, value); } }
+        public ICogImage Image
+        {
+            get => image;
+            set
+            {
+                SetProperty(ref image, value);
+            }
+        }
+
+        // 使用泛型委托
+        public event EventHandler<ICogImage> PropertyChanged;
+
+        // 或者自定义委托
+        public delegate void ChangeEventHandler(ICogImage e);
+        public event ChangeEventHandler OnChange;
+
+
+
+
+        public CameraService CameraService { get; set; }
+
+        public CogJobManager MyJobManager { get => myJobManager; set => myJobManager = value; }
+        public List<CogJob> MyJobs { get => myJobs; set => myJobs = value; }
+        public List<CogJobIndependent> MyIndependentJobs { get => myIndependentJobs; set => myIndependentJobs = value; }
+
+
+        public CogJobManagerEdit MyJobManagerEdit { get => myJobManagerEdit; set => myJobManagerEdit = value; }
+
+        /// <summary>
+        /// 相机列表
+        /// </summary>
+        public ObservableCollection<string> CameraList { get => _CameraList; set { SetProperty(ref _CameraList, value); } }
+
+
+        /// <summary>
+        /// 当前相机配置
+        /// </summary>
+        public CameraInfo CurrCamConfig { get => _CurrCamConfig; set { SetProperty(ref _CurrCamConfig, value); } }
+
+        /// <summary>
+        /// 相机配置列表
+        /// </summary>
+        public ObservableCollection<CameraInfo> CamConfigs { get => _CamConfigs; set { SetProperty(ref _CamConfigs, value); } }
+
+
+
+
+
+        public bool IsTriggerModel { get => _isTriggerModel; set { SetProperty(ref _isTriggerModel, value); } }
+
+        public ICamera MyCamera { get => myCamera; set { SetProperty(ref myCamera, value); } }
+
+
+        /// <summary>
+        /// 相机对应模板工具
+        /// </summary>
+        public List<CogToolBlock> CamTemplateS { get => _CamTemplateS; set => _CamTemplateS = value; }
+
+
+        public event Action<int> ToolBlockSwitched;
+        /// <summary>
+        /// 当前选中相机的SN
+        /// </summary>
+        public string CurrCameraSn { get => _CurrCameraSn; set { SetProperty(ref _CurrCameraSn, value); } }
+
+        private  ObservableCollection<CameraInfo> _CamConfigs=new ObservableCollection<CameraInfo>();
+
+        private List<CogToolBlock> _CamTemplateS=new  List<CogToolBlock>();
+
+        private CogToolBlock cogToolBlock1;
+
+        private CameraInfo _CurrCamConfig=null;
+        private ICamera myCamera;
+        private  bool _isTriggerModel=false;
+
+
+        /// <summary>
+        /// 当前需要显示的工程文件
+        /// </summary>
+        private CogJobManagerEdit myJobManagerEdit;
+
+        private ObservableCollection<string>  _CameraList=new ObservableCollection<string>();
+
+        private string _CurrCameraSn="";
+
+        public Stopwatch stopwatch=new Stopwatch();
+
+        public Management()
+        {
+
+        }
+
+
+
+
+        /// <summary>
+        /// 获取相机列表
+        /// </summary>
+        public void LoadCameraDevice()
+        {
+            CameraService = new CameraService();
+            CameraList = FindLoadCamera();
+            if ( CamConfigs.Count == 0 )
+            {
+
+                CamConfigs.Add(new CameraInfo() { VppFileName = "Cam1.vpp" });
+                CamConfigs.Add(new CameraInfo() { VppFileName = "Cam2.vpp" });
+                CamConfigs.Add(new CameraInfo() { VppFileName = "Cam3.vpp" });
+                CamConfigs.Add(new CameraInfo() { VppFileName = "Cam4.vpp" });
+                CamConfigs.Add(new CameraInfo() { VppFileName = "Cam5.vpp" });
+                CamConfigs.Add(new CameraInfo() { VppFileName = "Cam6.vpp" });
+
+
+            }
+        }
+
+
+        public void SaveCameraDevice()
+        {
+
+
+        }
+        /// <summary>
+        /// 初始化模板
+        /// </summary>
+        public void InitTemplates(TipService tipService)
+        {
+
+
+            tipService.ShowMsg("相机模板加载2%");
+            CogToolBlock cogToolBlock = ( CogToolBlock ) CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + "\\Vpp\\Cam1.vpp");
+            CamTemplateS.Add(cogToolBlock);
+            //tipService.ShowMsg("相机模板加载10%");
+            //cogToolBlock = ( CogToolBlock ) CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + "\\Vpp\\Cam2.vpp");
+            //CamTemplateS.Add(cogToolBlock);
+            //tipService.ShowMsg("相机模板加载26%");
+            //cogToolBlock = ( CogToolBlock ) CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + "\\Vpp\\Cam3.vpp");
+            //CamTemplateS.Add(cogToolBlock);
+            //tipService.ShowMsg("相机模板加载39%");
+            //cogToolBlock = ( CogToolBlock ) CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + "\\Vpp\\Cam4.vpp");
+            //CamTemplateS.Add(cogToolBlock);
+            //tipService.ShowMsg("相机模板加载52%");
+            //cogToolBlock = ( CogToolBlock ) CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + "\\Vpp\\Cam5.vpp");
+            //CamTemplateS.Add(cogToolBlock);
+            //tipService.ShowMsg("相机模板加载65%");
+            //cogToolBlock = ( CogToolBlock ) CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + "\\Vpp\\Cam6.vpp");
+            //CamTemplateS.Add(cogToolBlock);
+            //tipService.ShowMsg("相机模板加载78%");
+            //cogToolBlock = ( CogToolBlock ) CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + "\\Vpp\\Cam7.vpp");
+            //CamTemplateS.Add(cogToolBlock);
+            //tipService.ShowMsg("相机模板加载91%");
+            //cogToolBlock = ( CogToolBlock ) CogSerializer.LoadObjectFromFile(Environment.CurrentDirectory + "\\Vpp\\Cam8.vpp");
+            //CamTemplateS.Add(cogToolBlock);
+            //tipService.ShowMsg("相机模板加载99%");
+            tipService.Tcolse();
+        }
+
+        /// <summary>
+        /// 单张采集
+        /// </summary>
+        public void SoftTrigger()
+        {
+            if ( isConnected )
+            {
+                MyCamera.StopGrabbing();
+                LogHelper.Info($"软触发配置写入");
+                MyCamera.SetTriggerModeOff();
+                CurrCamConfig.TriggerMode = false;
+                MyCamera.SetTriggerSoftware();
+                if ( !MyCamera.CheckImageCallbackEvent(CamCallBack) )
+                    MyCamera.ImageCallbackEvent -= CamCallBack;
+                if ( MyCamera.CheckImageCallbackEvent(CamVisionProCallBack) )
+                    MyCamera.ImageCallbackEvent += CamVisionProCallBack;
+                LogHelper.Info($"软触发取图");
+
+                MyCamera.Grab();
+            }
+        }
+
+
+        /// <summary>
+        /// 连续采集写入
+        /// </summary>
+        public void SoftTrigger__Continue()
+        {
+            MyCamera.SetTriggerModeOff();
+            CurrCamConfig.TriggerMode = false;
+            MyCamera.SetTriggerSoftware();
+            if ( MyCamera.CheckImageCallbackEvent(CamCallBack) )
+                MyCamera.ImageCallbackEvent += CamCallBack;
+            if ( !MyCamera.CheckImageCallbackEvent(CamVisionProCallBack) )
+                MyCamera.ImageCallbackEvent -= CamVisionProCallBack;
+            LogHelper.Info($"连续采集启动");
+            MyCamera.StartGrabbing();
+        }
+
+
+        public void SetHardTrigger_CallBack()
+        {
+            LogHelper.Info($"硬触发模式 启动");
+            MyCamera.SetTriggerModeOn();
+            CurrCamConfig.TriggerMode = true;
+            MyCamera.SetTriggerSoftware(0);
+            if ( !MyCamera.CheckImageCallbackEvent(CamCallBack) )
+                MyCamera.ImageCallbackEvent -= CamCallBack;
+            if ( MyCamera.CheckImageCallbackEvent(CamVisionProCallBack) )
+                MyCamera.ImageCallbackEvent += CamVisionProCallBack;
+            MyCamera.StartGrabbing();
+        }
+        /// <summary>
+        /// 查找相机
+        /// </summary>
+        public ObservableCollection<string> FindLoadCamera()
+        {
+            List<string> listsn = CameraService.GetDeviceEnum();
+            if ( listsn.Count > 0 )
+            {
+                ObservableCollection<string> strings=new ObservableCollection<string>();
+                for ( int i = 0; i < listsn.Count; i++ )
+                {
+                    strings.Add(listsn[ i ]);
+                }
+                return strings;
+            }
+            else
+            {
+
+                System.Windows.Forms.MessageBox.Show("未查询到设备!", "提示", MessageBoxButtons.OK);
+                return null;
+            }
+        }
+
+        public void InitCamera(string name)
+        {
+            // 初始化相机
+            if ( isConnected && myCamera != null )
+            {
+                myCamera.CloseDevice();
+                myCamera = null;
+            }
+            Guid guid= new Guid();
+            CameraService.CreateCamera(guid, new CameraInfo() { SerialNumber = name });
+            myCamera = CameraService.GetCamera(guid);
+            bool res = myCamera.OpenDevice();
+
+            if ( !res )
+            {
+                myCamera.CloseDevice();
+                myCamera = null;
+                isConnected = false;
+            }
+            else
+            {
+                isConnected = true;
+            }
+
+        }
+        public void InitCameras()
+        {
+            CameraService = new CameraService();
+            foreach ( var item in CamConfigs )
+            {
+                try
+                {
+                    CameraService.CreateCamera(item.Id, item);
+                    CameraService.GetCamera(item.Id).CameraConnectChangedEvent += Management_CameraConnectChangedEvent;
+                    if ( CameraService.GetCamera(item.Id).OpenDevice() )
+                    {
+
+
+                    }
+                    else
+                    {
+
+                    }
+                }
+                catch ( Exception ex )
+                {
+
+                }
+
+            }
+
+        }
+
+
+        public void CloseCamera()
+        {
+            myCamera?.StopGrabbing();
+            myCamera?.CloseDevice();
+            myCamera = null;
+            isConnected = false;
+
+
+
+        }
+
+
+        /// <summary>
+        ///图像显示
+        /// </summary>
+        /// <param name="img"></param>
+        private void CamCallBack(ICogImage image, TimeSpan totaltime, string errormessage)
+        {
+            try
+            {
+                // Console.WriteLine(stopwatch.ElapsedMilliseconds.ToString());
+                Image = image;
+                //stopwatch.Restart();
+            }
+            finally
+            {
+
+            }
+
+        }
+
+        /// <summary>
+        ///图像显示
+        /// </summary>
+        /// <param name="img"></param>
+        private void MainCamCallBack(ICogImage image, TimeSpan totaltime, string errormessage)
+        {
+            try
+            {
+                // Console.WriteLine(stopwatch.ElapsedMilliseconds.ToString());
+                Image = image;
+                //stopwatch.Restart();
+            }
+            finally
+            {
+
+            }
+
+        }
+
+        // 将海康相机帧数据转换为CogImage8Grey灰度图像
+        public static ICogImage ConvertToCogImage(IntPtr pData, ref MyCamera.MV_FRAME_OUT_INFO_EX pFrameInfo)
+        {
+
+            // 验证像素格式(支持MONO8/RGB8转灰度)
+            if ( pFrameInfo.enPixelType != MvCamCtrl.NET.MyCamera.MvGvspPixelType.PixelType_Gvsp_Mono8 &&
+                pFrameInfo.enPixelType != MvCamCtrl.NET.MyCamera.MvGvspPixelType.PixelType_Gvsp_RGB8_Packed )
+            {
+                throw new ArgumentException("Unsupported pixel format");
+            }
+
+            // 创建CogImage8Grey对象
+            CogImage8Grey cogImage = new CogImage8Grey();
+            int width = (int)pFrameInfo.nWidth;
+            int height = (int)pFrameInfo.nHeight;
+
+            // 分配内存并复制数据
+            cogImage.Allocate(width, height);
+
+            // 获取8位灰度图像像素内存区域
+            ICogImage8PixelMemory pixelMemory = (cogImage).Get8GreyPixelMemory(
+    CogImageDataModeConstants.ReadWrite,
+    0, 0,
+    cogImage.Width, cogImage.Height);
+            IntPtr destPtr = pixelMemory.Scan0;  // 获取像素数据指针
+
+            // IntPtr destPtr = cogImage.GetPixelData(CogImageDataModeConstants.ReadWrite);
+
+            if ( pFrameInfo.enPixelType == MvCamCtrl.NET.MyCamera.MvGvspPixelType.PixelType_Gvsp_Mono8 )
+            {
+                // 直接拷贝MONO8数据
+                SafeMemoryCopy(destPtr, pData,  width * height );
+            }
+            else // RGB转灰度
+            {
+                byte[] rgbBuffer = new byte[width * height * 3];
+                Marshal.Copy(pData, rgbBuffer, 0, rgbBuffer.Length);
+
+                unsafe
+                {
+                    byte* pDest = (byte*)destPtr.ToPointer();
+                    for ( int i = 0; i < rgbBuffer.Length; i += 3 )
+                    {
+                        // RGB转灰度公式:0.299*R + 0.587*G + 0.114*B
+                        *pDest++ = ( byte ) ( 0.299 * rgbBuffer[ i ] +
+                                         0.587 * rgbBuffer[ i + 1 ] +
+                                         0.114 * rgbBuffer[ i + 2 ] );
+                    }
+                }
+            }
+            return cogImage;
+        }
+
+        // 将海康相机帧数据转换为CogImage24PlanarColor彩色图像
+        public static ICogImage ConvertToColorCogImage(IntPtr pData, ref MyCamera.MV_FRAME_OUT_INFO_EX pFrameInfo)
+        {
+            if ( pFrameInfo.enPixelType != MvCamCtrl.NET.MyCamera.MvGvspPixelType.PixelType_Gvsp_RGB8_Packed )
+            {
+                throw new ArgumentException("Only RGB8 format supported for color conversion");
+            }
+
+            CogImage24PlanarColor cogColorImage = new CogImage24PlanarColor();
+            int width = (int)pFrameInfo.nWidth;
+            int height = (int)pFrameInfo.nHeight;
+
+            // 分配内存
+            cogColorImage.Allocate(width, height);
+
+            // 获取三个颜色平面指针
+
+            CogImage8Grey red= cogColorImage.GetPlane(CogImagePlaneConstants.Red);
+            CogImage8Grey green= cogColorImage.GetPlane(CogImagePlaneConstants.Green);
+            CogImage8Grey blue= cogColorImage.GetPlane(CogImagePlaneConstants.Blue);
+
+
+
+            IntPtr redPtr = cogColorImage.GetPlane(CogImagePlaneConstants.Red).Get8GreyPixelMemory(
+    CogImageDataModeConstants.ReadWrite,
+    0, 0,
+    red.Width, red.Height).Scan0;  // 获取像素数据指针
+            IntPtr greenPtr =cogColorImage.GetPlane(CogImagePlaneConstants.Green).Get8GreyPixelMemory(
+    CogImageDataModeConstants.ReadWrite,
+    0, 0,
+    red.Width, red.Height).Scan0; ;
+            IntPtr bluePtr =cogColorImage.GetPlane(CogImagePlaneConstants.Blue).Get8GreyPixelMemory(
+    CogImageDataModeConstants.ReadWrite,
+    0, 0,
+    red.Width, red.Height).Scan0; ;
+
+            // 转换RGB数据到平面格式
+            byte[] rgbBuffer = new byte[width * height * 3];
+            Marshal.Copy(pData, rgbBuffer, 0, rgbBuffer.Length);
+
+            unsafe
+            {
+                byte* pRed = (byte*)redPtr.ToPointer();
+                byte* pGreen = (byte*)greenPtr.ToPointer();
+                byte* pBlue = (byte*)bluePtr.ToPointer();
+
+                for ( int i = 0; i < rgbBuffer.Length; i += 3 )
+                {
+                    *pRed++ = rgbBuffer[ i ];     // R
+                    *pGreen++ = rgbBuffer[ i + 1 ]; // G
+                    *pBlue++ = rgbBuffer[ i + 2 ];  // B
+                }
+            }
+            return cogColorImage;
+        }
+
+        // 使用示例(在回调函数中调用)
+        private void ImageCallback(IntPtr pData, ref MyCamera.MV_FRAME_OUT_INFO_EX pFrameInfo, IntPtr pUser)
+        {
+            ICogImage resultImage;
+            if ( pFrameInfo.enPixelType == MvCamCtrl.NET.MyCamera.MvGvspPixelType.PixelType_Gvsp_Mono8 )
+            {
+                resultImage = ConvertToCogImage(pData, ref pFrameInfo);
+            }
+            else
+            {
+                resultImage = ConvertToColorCogImage(pData, ref pFrameInfo);
+            }
+
+            // 将图像传递给VisionPro处理工具
+            Image = resultImage;
+        }
+
+
+
+        /// <summary>
+        /// 视觉处理
+        /// </summary>
+        /// <param name="data"></param>
+        private void CamVisionProCallBack(ICogImage image, TimeSpan totaltime, string errormessage)
+        {
+            try
+            {
+
+                cogToolBlock1.Inputs[ 0 ].Value = image;
+                cogToolBlock1.Run();
+                Image = ( ICogImage ) cogToolBlock1.Outputs[ 6 ].Value;
+            }
+            finally
+            {
+
+            }
+
+        }
+
+        /// <summary>
+        /// WriteableBitmap转Bitmap图像
+        /// </summary>
+        /// <param name="wBitmap"></param>
+        /// <returns></returns>
+        public static Bitmap SafeConvert(WriteableBitmap wb)
+        {
+            Bitmap bmp = new Bitmap(wb.PixelWidth, wb.PixelHeight);
+            using ( var ms = new System.IO.MemoryStream() )
+            {
+                var encoder = new PngBitmapEncoder();
+                encoder.Frames.Add(BitmapFrame.Create(wb));
+                encoder.Save(ms);
+                bmp = ( Bitmap ) System.Drawing.Image.FromStream(ms);
+            }
+            return bmp;
+        }
+
+        // 使用Windows API实现内存拷贝(支持重叠内存区域)
+        [DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = false)]
+        private static extern void RtlMoveMemory(IntPtr dest, IntPtr src, uint length);
+
+        // 安全封装方法(带参数校验)
+        public static void SafeMemoryCopy(IntPtr dest, IntPtr src, int byteCount)
+        {
+            if ( dest == IntPtr.Zero || src == IntPtr.Zero )
+                throw new ArgumentNullException("指针参数不能为null");
+
+            if ( byteCount <= 0 )
+                throw new ArgumentOutOfRangeException("字节数必须大于0");
+
+            RtlMoveMemory(dest, src, ( uint ) byteCount);
+        }
+        /// <summary>
+        /// 将WriteableBitmap转换为CogImage8Grey(自动处理彩色转灰度)
+        /// </summary>
+        public CogImage8Grey WriteableBitmapToCogImage8Grey(WriteableBitmap wbitmap)
+        {
+
+            int width = wbitmap.PixelWidth;
+            int height = wbitmap.PixelHeight;
+            CogImage8Grey image = new CogImage8Grey(width, height);
+
+            // 获取原始图像数据
+            int bytesPerPixel = (wbitmap.Format.BitsPerPixel + 7) / 8;
+            int stride = (width * bytesPerPixel + 3) & ~3;
+            byte[] pixels = new byte[height * stride];
+            wbitmap.CopyPixels(pixels, stride, 0);
+
+            // 获取CogImage8Grey的原始内存
+            byte[] cogPixels = new byte[width * height];
+            unsafe
+            {
+                fixed ( byte* srcPtr = pixels, dstPtr = cogPixels )
+                {
+                    byte* src = srcPtr;
+                    byte* dst = dstPtr;
+
+                    for ( int y = 0; y < height; y++ )
+                    {
+                        byte* srcRow = src + y * stride;
+                        for ( int x = 0; x < width; x++ )
+                        {
+                            byte* pixel = srcRow + x * bytesPerPixel;
+                            *dst++ = ( byte ) ( pixel[ 0 ] * 0.11 + pixel[ 1 ] * 0.59 + pixel[ 2 ] * 0.3 );
+                        }
+                    }
+                }
+
+
+            }
+            var pixelMemory = image.Get8GreyPixelMemory(CogImageDataModeConstants.Write, 0, 0,image.Width, image.Height);
+            IntPtr scan0 = pixelMemory.Scan0;
+            // Marshal.Copy(cogPixels, 0, scan0, cogPixels.Length);
+
+            for ( int y = 0; y < height; y++ )
+            {
+                IntPtr destPtr = pixelMemory.Scan0 + y * pixelMemory.Stride;
+                Marshal.Copy(cogPixels, y * width, destPtr, width);
+            }
+
+            return image;
+        }
+
+        private static byte[] ConvertToGrayscale(WriteableBitmap wb)
+        {
+            int width = wb.PixelWidth;
+            int height = wb.PixelHeight;
+            byte[] grayData = new byte[width * height];
+            int stride = wb.BackBufferStride; // 使用实际步长
+
+            // 锁定并复制像素数据
+            wb.Lock();
+            IntPtr buffer = wb.BackBuffer;
+            byte[] pixelData = new byte[stride * height];
+            System.Runtime.InteropServices.Marshal.Copy(pixelData, 0, buffer, pixelData.Length);
+            wb.Unlock();
+
+
+            return pixelData;
+        }
+        public void OnSwitchToolBlock(int index)
+        {
+            cogToolBlock1 = CamTemplateS[ index ];
+            ToolBlockSwitched?.Invoke(index); // 触发事件,传递索引参数。
+        }
+
+        /// <summary>
+        /// 相机连接或者断开时
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="state"></param>
+        private void Management_CameraConnectChangedEvent(Guid id, bool state)
+        {
+            // var sta = Status.FirstOrDefault(s => s.ID == id);
+            //  var camera = DeviceConfig.Cameras.FirstOrDefault(c => c.Id == id);
+            //if ( sta != null && camera != null )
+            //{
+            //    if ( state )
+            //    {
+            //        App.Current.Dispatcher.Invoke(new Action(() =>
+            //        {
+            //            sta.Message = $"{camera.CameraName}{connected}";
+            //            sta.Background = new SolidColorBrush(Colors.Green);
+            //        }));
+
+            //    }
+            //    else
+            //    {
+            //        App.Current.Dispatcher.Invoke(new Action(() =>
+            //        {
+            //            sta.Message = $"{camera.CameraName}{disconnected1}";
+            //            sta.Background = new SolidColorBrush(Colors.Red);
+            //        }));
+            //    }
+            //}
+        }
+
+
+
+    }
+
+
+
+
+
+}

+ 40 - 0
Core/TipService.cs

@@ -0,0 +1,40 @@
+using LampInspectionMachine.Views;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.Core
+{
+    public  class TipService
+    {
+
+        LoadingView loadingView=new LoadingView();
+
+         
+        public TipService() 
+        {
+            Tshow();
+        }
+        public void Tshow()
+        {
+            
+                loadingView.Show();
+
+        }
+
+        public   void  Tcolse()
+        {
+            loadingView.Dispatcher.BeginInvoke(new Action(() => loadingView.Close()));
+
+
+        }
+
+        public void ShowMsg(string msg)
+        {
+            loadingView.Dispatcher.BeginInvoke(new Action(() => loadingView.Str=msg));
+        }
+
+    }
+}

+ 42 - 0
Core/VisionProManager.cs

@@ -0,0 +1,42 @@
+using Cognex.VisionPro;
+using Cognex.VisionPro.ImageFile;
+using Cognex.VisionPro.QuickBuild;
+using Cognex.VisionPro.ToolBlock;
+using LampInspectionMachine.Cameralibs;
+using LampInspectionMachine.Log4xml;
+using LampInspectionMachine.Model;
+using MvCamCtrl.NET;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Drawing;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace LampInspectionMachine.Core
+{
+    public class VisionProManager
+    {
+
+        
+       
+       
+       
+
+
+     
+    }
+
+
+
+
+
+
+}

+ 114 - 0
DataBase/SqlSugarHelper.cs

@@ -0,0 +1,114 @@
+using LampInspectionMachine.Model;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.DataBase
+{
+    public class SqlSugarHelper
+    {
+
+        public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
+        {
+            ConnectionString = "datasource=Project.db",//连接符字串
+            DbType = DbType.Sqlite,//数据库类型
+            IsAutoCloseConnection = true //不设成true要手动close
+        },
+         db =>
+         {
+
+             db.Aop.OnLogExecuting = (sql, pars) =>
+             {
+
+
+                 Console.WriteLine(UtilMethods.GetNativeSql(sql, pars));
+
+
+             };
+
+         });
+
+
+        public static void CreataDatabase()
+        {
+
+            //建库
+            Db.DbMaintenance.CreateDatabase("ProjectData");
+            CreataDataTable();
+        }
+
+
+        public static void CreataDataTable()
+        {
+            //建表 
+            Db.CodeFirst.InitTables<ProjectData>();
+
+            //Db.CodeFirst.InitTables<SettingModel>();
+
+          
+        }
+
+      
+
+        public static List<ProjectData> QueryablePage(int pagenumber)
+        {
+            return Db.Queryable<ProjectData>().ToPageList(pagenumber, 50);
+        }
+        public static List<ProjectData> QueryableTake()
+        {
+            //查询 
+            return Db.Queryable<ProjectData>().Take(30).OrderBy(it => it.id, OrderByType.Desc).ToList();
+        }
+
+   
+        public static List<ProjectData> QueryableProjectData()
+        {
+            //查询 
+            return Db.Queryable<ProjectData>().ToList();
+        }
+
+        
+
+        public static List<ProjectData> QueryableBySn(string sn)
+        {
+            //条件查询
+            return Db.Queryable<ProjectData>().Where(it => it.orderId == sn).ToList();
+        }
+        
+
+      
+      
+        public static void Insertable(ProjectData data)
+        {
+
+            //插入
+            Db.Insertable(data).ExecuteCommand();
+        }
+        public static void Updateable(ProjectData data)
+        {
+
+            //更新
+           // Db.Updateable(data).ExecuteCommand(); //注意  需要条件
+        }
+    
+
+       
+
+       
+
+      
+        public static void Updateable()
+        {
+
+            //删除
+            Db.Deleteable<ProjectData>().Where(it => it.id == 1).ExecuteCommand();
+        }
+
+
+
+
+    }
+}

+ 139 - 0
HttpService/HttpWebResponseUtility.cs

@@ -0,0 +1,139 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net.Security;
+using System.Net;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.HttpService
+{
+    /// <summary>  
+    /// 有关HTTP请求的辅助类  
+    /// </summary>  
+    public class HttpWebResponseUtility
+    {
+        private static readonly string DefaultUserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
+        /// <summary>  
+        /// 创建GET方式的HTTP请求  
+        /// </summary>  
+        /// <param name="url">请求的URL</param>  
+        /// <param name="timeout">请求的超时时间</param>  
+        /// <param name="userAgent">请求的客户端浏览器信息,可以为空</param>  
+        /// <param name="cookies">随同HTTP请求发送的Cookie信息,如果不需要身份验证可以为空</param>  
+        /// <returns></returns>  
+        public static HttpWebResponse CreateGetHttpResponse(string url, int? timeout, string userAgent, CookieCollection cookies)
+        {
+            if ( string.IsNullOrEmpty(url) )
+            {
+                throw new ArgumentNullException("url");
+            }
+            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
+            request.Method = "GET";
+            request.UserAgent = DefaultUserAgent;
+            if ( !string.IsNullOrEmpty(userAgent) )
+            {
+                request.UserAgent = userAgent;
+            }
+            if ( timeout.HasValue )
+            {
+                request.Timeout = timeout.Value;
+            }
+            if ( cookies != null )
+            {
+                request.CookieContainer = new CookieContainer();
+                request.CookieContainer.Add(cookies);
+            }
+            return request.GetResponse() as HttpWebResponse;
+        }
+        /// <summary>  
+        /// 创建POST方式的HTTP请求  
+        /// </summary>  
+        /// <param name="url">请求的URL</param>  
+        /// <param name="parameters">随同请求POST的参数名称及参数值字典</param>  
+        /// <param name="timeout">请求的超时时间</param>  
+        /// <param name="userAgent">请求的客户端浏览器信息,可以为空</param>  
+        /// <param name="requestEncoding">发送HTTP请求时所用的编码</param>  
+        /// <param name="cookies">随同HTTP请求发送的Cookie信息,如果不需要身份验证可以为空</param>  
+        /// <returns></returns>  
+        public static HttpWebResponse CreatePostHttpResponse(string url, IDictionary<string, string> parameters, int? timeout, string userAgent, Encoding requestEncoding, CookieCollection cookies)
+        {
+            if ( string.IsNullOrEmpty(url) )
+            {
+                throw new ArgumentNullException("url");
+            }
+            if ( requestEncoding == null )
+            {
+                throw new ArgumentNullException("requestEncoding");
+            }
+            HttpWebRequest request=null;
+            //如果是发送HTTPS请求  
+            if ( url.StartsWith("https", StringComparison.OrdinalIgnoreCase) )
+            {
+                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
+                request = WebRequest.Create(url) as HttpWebRequest;
+                request.ProtocolVersion = HttpVersion.Version10;
+            }
+            else
+            {
+                request = WebRequest.Create(url) as HttpWebRequest;
+            }
+            request.Method = "POST";
+            request.ContentType = "application/x-www-form-urlencoded";
+
+            if ( !string.IsNullOrEmpty(userAgent) )
+            {
+                request.UserAgent = userAgent;
+            }
+            else
+            {
+                request.UserAgent = DefaultUserAgent;
+            }
+
+            if ( timeout.HasValue )
+            {
+                request.Timeout = timeout.Value;
+            }
+            if ( cookies != null )
+            {
+                request.CookieContainer = new CookieContainer();
+                request.CookieContainer.Add(cookies);
+            }
+            //如果需要POST数据  
+            if ( !( parameters == null || parameters.Count == 0 ) )
+            {
+                StringBuilder buffer = new StringBuilder();
+                int i = 0;
+                foreach ( string key in parameters.Keys )
+                {
+                    if ( i > 0 )
+                    {
+                        buffer.AppendFormat("&{0}={1}", key, parameters[ key ]);
+                    }
+                    else
+                    {
+                        buffer.AppendFormat("{0}={1}", key, parameters[ key ]);
+                    }
+                    i++;
+                }
+                byte[] data = requestEncoding.GetBytes(buffer.ToString());
+                using ( Stream stream = request.GetRequestStream() )
+                {
+                    stream.Write(data, 0, data.Length);
+                }
+            }
+            return request.GetResponse() as HttpWebResponse;
+        }
+
+        private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
+        {
+            return true; //总是接受  
+        }
+
+
+
+
+    }
+}

+ 352 - 0
LampInspectionMachine.csproj

@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="packages\OpenCvSharp4.runtime.win.4.10.0.20241108\build\net48\OpenCvSharp4.runtime.win.props" Condition="Exists('packages\OpenCvSharp4.runtime.win.4.10.0.20241108\build\net48\OpenCvSharp4.runtime.win.props')" />
+  <Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{3719CDFC-4396-4749-8A54-E848CEA07CEA}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>LampInspectionMachine</RootNamespace>
+    <AssemblyName>LampInspectionMachine</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <LangVersion>7.3</LangVersion>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <LangVersion>7.3</LangVersion>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Cognex.VisionPro, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.Controls, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.Controls.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.Core, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.Display.Controls, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.Display.Controls.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.ImageFile, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.ImageFile.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.QuickBuild.Controls, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.QuickBuild.Controls.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.QuickBuild.Core, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.QuickBuild.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.ToolGroup, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.ToolGroup.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.ToolGroup.Controls, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Program Files\Cognex\VisionPro\ReferencedAssemblies\Cognex.VisionPro.ToolGroup.Controls.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
+    <Reference Include="log4net, Version=3.0.4.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
+      <HintPath>packages\log4net.3.0.4\lib\net462\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>packages\Microsoft.Xaml.Behaviors.Wpf.1.1.31\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
+    </Reference>
+    <Reference Include="MvCamCtrl.Net, Version=0.0.0.0, Culture=neutral, PublicKeyToken=01e3fc1d84d12cbf, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>bin\Debug\MvCamCtrl.Net.dll</HintPath>
+    </Reference>
+    <Reference Include="MvCameraAcqTool, Version=1.0.1.0, Culture=neutral, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>bin\Debug\MvCameraAcqTool.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>packages\OpenCvSharp4.4.10.0.20241108\lib\net48\OpenCvSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>packages\OpenCvSharp4.Extensions.4.10.0.20241108\lib\net48\OpenCvSharp.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="Prism, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
+      <HintPath>packages\Prism.Core.8.1.97\lib\net47\Prism.dll</HintPath>
+    </Reference>
+    <Reference Include="Prism.Unity.Wpf, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
+      <HintPath>packages\Prism.Unity.8.1.97\lib\net47\Prism.Unity.Wpf.dll</HintPath>
+    </Reference>
+    <Reference Include="Prism.Wpf, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
+      <HintPath>packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll</HintPath>
+    </Reference>
+    <Reference Include="SqlSugar, Version=5.1.4.188, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>packages\SqlSugar.5.1.4.188\lib\SqlSugar.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
+      <HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
+      <HintPath>packages\System.Data.SQLite.EF6.1.0.119.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
+      <HintPath>packages\System.Data.SQLite.Linq.1.0.119.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Drawing" />
+    <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.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>
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security" />
+    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Web" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="Unity.Abstractions, Version=5.11.7.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
+      <HintPath>packages\Unity.Abstractions.5.11.7\lib\net48\Unity.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Unity.Container, Version=5.11.11.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
+      <HintPath>packages\Unity.Container.5.11.11\lib\net48\Unity.Container.dll</HintPath>
+    </Reference>
+    <Reference Include="Cognex.VisionPro.QuickBuild" />
+    <Reference Include="Cognex.VisionPro.QuickBuild.Controls" />
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="WindowsFormsIntegration" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </ApplicationDefinition>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Cameralibs\CameraBrand.cs" />
+    <Compile Include="Cameralibs\CameraService.cs" />
+    <Compile Include="Cameralibs\CameraType.cs" />
+    <Compile Include="Cameralibs\HKCamera\MvCamera.cs" />
+    <Compile Include="Cameralibs\ICamera.cs" />
+    <Compile Include="Core\Management.cs" />
+    <Compile Include="Core\TipService.cs" />
+    <Compile Include="Core\VisionProManager.cs" />
+    <Compile Include="DataBase\SqlSugarHelper.cs" />
+    <Compile Include="HttpService\HttpWebResponseUtility.cs" />
+    <Compile Include="Log4xml\LogHelper.cs" />
+    <Compile Include="Model\AppData.cs" />
+    <Compile Include="Model\CameraInfo.cs" />
+    <Compile Include="Model\ProjectData.cs" />
+    <Compile Include="Model\Users.cs" />
+    <Compile Include="ValueConverters\EnumToBoolConverter.cs" />
+    <Compile Include="ViewModels\CameraViewModel.cs" />
+    <Compile Include="ViewModels\MainWindowViewModel.cs" />
+    <Compile Include="ViewModels\MenuViewModel.cs" />
+    <Compile Include="ViewModels\ProductViewModel.cs" />
+    <Compile Include="ViewModels\RoleLoginViewModel.cs" />
+    <Compile Include="ViewModels\SettingViewModel.cs" />
+    <Compile Include="ViewModels\VisionProViewModel.cs" />
+    <Compile Include="ViewModels\WorkRunViewModel.cs" />
+    <Compile Include="Views\CameraView.xaml.cs">
+      <DependentUpon>CameraView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\LoadingView.xaml.cs">
+      <DependentUpon>LoadingView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\MainWindow.xaml.cs">
+      <DependentUpon>MainWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\MenuView.xaml.cs">
+      <DependentUpon>MenuView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\ProductView.xaml.cs">
+      <DependentUpon>ProductView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\RoleLoginView.xaml.cs">
+      <DependentUpon>RoleLoginView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\SettingView.xaml.cs">
+      <DependentUpon>SettingView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\VisionProView.xaml.cs">
+      <DependentUpon>VisionProView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\WorkRunView.xaml.cs">
+      <DependentUpon>WorkRunView.xaml</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <None Include="Log4xml\log4net.config" />
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Cameralibs\BaslerCamera\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Page Include="Views\CameraView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\LoadingView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\MainWindow.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\MenuView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\ProductView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\RoleLoginView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\SettingView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Views\VisionProView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\WorkRunView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
+    <Error Condition="!Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
+    <Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
+    <Error Condition="!Exists('packages\OpenCvSharp4.runtime.win.4.10.0.20241108\build\net48\OpenCvSharp4.runtime.win.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\OpenCvSharp4.runtime.win.4.10.0.20241108\build\net48\OpenCvSharp4.runtime.win.props'))" />
+  </Target>
+  <Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
+  <Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
+</Project>

+ 31 - 0
LampInspectionMachine.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34728.123
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LampInspectionMachine", "LampInspectionMachine.csproj", "{3719CDFC-4396-4749-8A54-E848CEA07CEA}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x64 = Debug|x64
+		Release|Any CPU = Release|Any CPU
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Debug|x64.ActiveCfg = Debug|x64
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Debug|x64.Build.0 = Debug|x64
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Release|x64.ActiveCfg = Release|x64
+		{3719CDFC-4396-4749-8A54-E848CEA07CEA}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {CEA61AD8-CE7B-4291-9A66-0AD992DDC7E7}
+	EndGlobalSection
+EndGlobal

+ 78 - 0
Log4xml/LogHelper.cs

@@ -0,0 +1,78 @@
+using System;
+
+
+namespace LampInspectionMachine.Log4xml
+{
+    public class LogHelper
+    {
+
+
+
+
+
+
+        public delegate void LogChangHandler(Log log);
+
+        public static LogChangHandler logChangHandler;
+        // #region 执行日志
+        private static readonly log4net.ILog infologger = log4net.LogManager.GetLogger("LogInfo");
+        /// <summary>
+        /// 普通日志
+        /// </summary>
+        /// <param name="message">日志内容</param>
+        public static void Info(string message)
+        {
+            // 可以改成type typeof(类)
+            if ( infologger.IsInfoEnabled )
+            {
+                infologger.Info(message);
+                logChangHandler?.Invoke(new Log() { Time = DateTime.Now.ToString("yyyy-MM-dd:HH:mm:ss"), Msg = message });
+            }
+        }
+        private static log4net.ILog alarmlog4net =log4net.LogManager.GetLogger("AlarmLogInfo");
+        /// <summary>
+        /// 警告日志
+        /// </summary>
+        /// <param name="message">警告日志</param>
+        public static void Warn(string message)
+        {
+
+            if ( alarmlog4net.IsWarnEnabled )
+            {
+                alarmlog4net.Warn(message);
+            }
+
+        }
+        private static log4net.ILog Errlog4net =log4net.LogManager.GetLogger("ErrLogInfo");
+        /// <summary>
+        /// 错误日志
+        /// </summary>
+        /// <param name="message">错误日志</param>
+        public static void Error(string message)
+        {
+
+            if ( Errlog4net.IsInfoEnabled )
+            {
+                Errlog4net.Error(message);
+            }
+
+        }
+
+
+    }
+
+
+    public class Log
+    {
+
+        private string time;
+        private string msg;
+
+        public string Time { get => time; set => time = value; }
+        public string Msg { get { return time + " " + msg; } set => msg = value; }
+
+    }
+
+
+
+}

+ 252 - 0
Log4xml/log4net.config

@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="utf-8" ?>
+      <configuration>
+		<configSections>
+			<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
+		</configSections>
+		<log4net>
+			<!-- Agv日志文件-->
+			<appender name="InfoFileAppender" type="log4net.Appender.RollingFileAppender">
+				<!-- RollingFileAppender以FileAppender为基础 -->
+				<File value="Log\InfoLog" />
+				<!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
+				<param name="AppendToFile" value="true" />
+				<!-- 指定是追加到还是覆盖掉已有的日志文件 -->
+				<!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
+				<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
+				<!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
+				<param name="RollingStyle" value="Composite" />
+				<!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
+				<StaticLogFileName value="false" />
+				<DatePattern value="yyyy\\MM\\dd\\yyyy-MM-dd'.txt'" />
+				<MaxSizeRollBackups value="-1" />
+				<!-- 最多个数为-1无限个-->
+				<MaximumFileSize value="2MB" />
+				<layout type="log4net.Layout.PatternLayout">
+					<conversionPattern value="时间:%date___描述:%message%newline" />
+
+				</layout>
+			</appender>
+
+			<!-- 报警日志文件 -->
+			<appender name="AlarmInfoFileAppender" type="log4net.Appender.RollingFileAppender">
+				<!-- RollingFileAppender以FileAppender为基础 -->
+				<File value="Log\AlarmInfo" />
+				<!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
+				<param name="AppendToFile" value="true" />
+				<!-- 指定是追加到还是覆盖掉已有的日志文件 -->
+				<!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
+				<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
+				<!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
+				<param name="RollingStyle" value="Composite" />
+				<!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
+				<StaticLogFileName value="false" />
+				<DatePattern value="yyyy\\MM\\dd\\CSV_yyyy-MM-dd'.txt'" />
+				<MaxSizeRollBackups value="-1" />
+				<!-- 最多个数为-1无限个-->
+				<MaximumFileSize value="2MB" />
+				<layout type="log4net.Layout.PatternLayout">
+					<conversionPattern value="时间:%date___描述:%message%newline" />
+				</layout>
+			</appender>
+
+			<!-- 运行错误日志文件 -->
+			<appender name="ErrFileAppender" type="log4net.Appender.RollingFileAppender">
+				<!-- RollingFileAppender以FileAppender为基础 -->
+				<File value="Log\ErrInfo" />
+				<!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
+				<param name="AppendToFile" value="true" />
+				<!-- 指定是追加到还是覆盖掉已有的日志文件 -->
+				<!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
+				<param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
+				<!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
+				<param name="RollingStyle" value="Composite" />
+				<!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
+				<StaticLogFileName value="false" />
+				<DatePattern value="yyyy\\MM\\dd\\CSV_yyyy-MM-dd'.txt'" />
+				<MaxSizeRollBackups value="-1" />
+				<!-- 最多个数为-1无限个-->
+				<MaximumFileSize value="2MB" />
+				<layout type="log4net.Layout.PatternLayout">
+					<conversionPattern value="时间:%date___描述:%message%newline" />
+				</layout>
+			</appender>
+
+
+			<logger name="LogInfo">
+				<level value="INFO" />
+				<appender-ref ref="InfoFileAppender" />
+			</logger>
+
+			<logger name="AlarmLogInfo">
+				<level value="WARN" />
+				<appender-ref ref="AlarmInfoFileAppender" />
+			</logger>
+
+			<logger name="ErrLogInfo">
+				<level value="ERROR" />
+				<appender-ref ref="ErrFileAppender" />
+			</logger>
+		</log4net>
+	</configuration>
+
+
+
+
+
+
+
+
+
+
+
+
+<!-- log4net-警告的信息级别区分 -->
+<!--<appender name="AspNetTraceAppender" type="log4net.Appender.AspNetTraceAppender" >
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->
+<!-- log4net-消息缓冲区配置(将日志信息进行缓存,达到10条时把日志输出,只有WARN及更高级别时才会被记录 ) -->
+<!--<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" >
+<bufferSize value="5"/>
+<lossy value="true" />
+<evaluator type="log4net.Core.LevelEvaluator">
+<threshold value="WARN"/>
+</evaluator>
+<appender-ref ref="ConsoleAppender" />
+</appender>-->
+<!--log4net-ERROR消息打印到控制台_红底白字-->
+<!--<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
+<mapping>
+<level value="ERROR" />
+<foreColor value="White" />
+<backColor value="Red, HighIntensity" />
+</mapping>
+<mapping>
+<level value="WARN" />
+<foreColor value="Yellow" />
+</mapping>
+<mapping>
+<level value="INFO" />
+<foreColor value="White" />
+</mapping>
+<mapping>
+<level value="DEBUG" />
+<backColor value="Green" />
+</mapping>
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->
+<!-- log4net-将日志消息定向到控制台错误流 -->
+<!--<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
+<target value="Console.Error" />
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->
+<!-- log4net-将日志写入本地机器的应用程序事件日志中 -->
+<!--<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
+<applicationName value="MyApp" />
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->
+<!-- 向指定网络sink发送日志 -->
+<!--<appender name="RemotingAppender" type="log4net.Appender.RemotingAppender" >
+<sink value="tcp://localhost:8085/LoggingSink" />
+<lossy value="true" />
+<bufferSize value="95" />
+<onlyFixPartialEventData value="true" />
+<evaluator type="log4net.Core.LevelEvaluator">
+<threshold value="ERROR"/>
+</evaluator>
+</appender>-->
+<!-- 向指定邮箱发送日志 -->
+<!--<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender,log4net">
+<to value="***@qq.com" />
+<from value="840937370@qq.com" />
+<username value="840937370@qq.com" />
+-->
+<!--为客户端授权码-->
+<!--
+<password value="***********" />
+<subject value="B2P主控中心Error警告" />
+<smtpHost value="SMTPServer.qq.com" />
+<bufferSize value="512" />
+-->
+<!-- 大小超过512发送一次-->
+<!--
+<lossy value="true" />
+<evaluator type="log4net.Core.LevelEvaluator,log4net">
+<threshold value="WARN" />
+</evaluator>
+<layout type="log4net.Layout.PatternLayout,log4net">
+<conversionPattern value="
+%n【log4net的HostName】%property{log4net:HostName} ::
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:%property{NDC}
+%n【错误描述】%message
+%newlineLogger: %logger%newlineThread: %thread%newlineDate: %date%newlineNDC:
+%n【错误详情】%newline%newline" />
+</layout>
+</appender>-->
+<!-- 使用SmtpPickupDir时的配置-->
+<!--<appender name="SmtpPickupDirAppender" type="log4net.Appender.SmtpPickupDirAppender">
+<to value="to@domain.com" />
+<from value="from@domain.com" />
+<subject value="test logging message" />
+<pickupDir value="C:\SmtpPickup" />
+<bufferSize value="512" />
+<lossy value="true" />
+<evaluator type="log4net.Core.LevelEvaluator">
+<threshold value="WARN"/>
+</evaluator>
+<layout type="log4net.Layout.PatternLayout">
+<conversionPattern value="%n==========
+%n【日志级别】%-5level
+%n【记录时间】%date
+%n【线程ID】[%thread]
+%n【出错文件】%F
+%n【出错行号】%L
+%n【出错的类】%logger 属性:[%property{NDC}]
+%n【错误描述】%message
+%n【错误详情】%newline" />
+</layout>
+</appender>-->

+ 67 - 0
Model/AppData.cs

@@ -0,0 +1,67 @@
+using LampInspectionMachine.DataBase;
+using LampInspectionMachine.Log4xml;
+using Newtonsoft.Json;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Web.Security;
+using System.Windows.Controls;
+
+namespace LampInspectionMachine.Model
+{
+    public class AppData : BindableBase
+    {
+        private List<Users> _DefaultUsers = new List<Users>()
+        {
+         new Users()  {    Id=  0, Role = Roles.操作员,  Password = "246135" },
+          new Users() {   Id = 0,   Role = Roles.工程师, Password = "246135" },
+         new Users() { Id = 0,  Role = Roles.管理员, Password = "246135"}
+        };
+       
+
+        private Users _CurrentUser;
+
+        /// <summary>
+        /// 当前权限登录用户
+        /// </summary>
+        public Users CurrentUser { get => _CurrentUser; set => _CurrentUser = value; }
+
+
+       
+
+
+       
+        public List<Users> DefaultUsers { get => _DefaultUsers; set => _DefaultUsers = value; }
+        /// <summary>
+        /// 当前配置
+        /// </summary>
+     //   public SettingModel Setting_Model { get => _settingModel; set => _settingModel = value; }
+       
+
+        //private  SettingModel _settingModel=new SettingModel();
+
+        public ManualResetEvent APPExitEvent=new ManualResetEvent(true);
+        public ManualResetEvent DelayEvent=new ManualResetEvent(false);
+
+
+
+
+        public AppData()
+        {
+            //加载配置信息
+            //List<SettingModel> settingModels= SqlSugarHelper.QueryableSettingModel();
+            //if( settingModels!=null&& settingModels.Count!=0)
+            //Setting_Model = settingModels[ 0 ];
+
+           
+
+        }
+       
+    }
+}

+ 84 - 0
Model/CameraInfo.cs

@@ -0,0 +1,84 @@
+using LampInspectionMachine.Cameralibs;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.Model
+{
+    public class CameraInfo : BindableBase
+    {
+        private Guid _Id;
+
+        public Guid Id
+        {
+            get { return _Id; }
+            set { SetProperty(ref _Id, value); }
+        }
+       
+        private string _SerialNumber;
+        /// <summary>
+        /// 相机序列号
+        /// </summary>
+        public string SerialNumber
+        {
+            get { return _SerialNumber; }
+            set { SetProperty(ref _SerialNumber, value); }
+        }
+
+
+        private bool triggerMode;
+
+        private TriggerSource triggeSource;
+
+        private TriggerPolarity triggerPolarity;
+
+        private ulong expouseTime;
+
+        private ushort triggerFilter;
+
+        private ushort triggerDelay;
+
+        private float gain;
+
+        private string _Sn;
+
+        private string _VppFileName;
+
+
+        public bool TriggerMode { get => triggerMode; set { SetProperty(ref triggerMode, value); } }
+        public TriggerSource TriggeSource { get => triggeSource; set { SetProperty(ref triggeSource, value); } }
+        public TriggerPolarity TriggerPolarity { get => triggerPolarity; set { SetProperty(ref triggerPolarity, value); } }
+        public ulong ExpouseTime { get => expouseTime; set { SetProperty(ref expouseTime, value); } }
+        public ushort TriggerFilter { get => triggerFilter; set { SetProperty(ref triggerFilter, value); } }
+        public ushort TriggerDelay { get => triggerDelay; set { SetProperty(ref triggerDelay, value); } }
+
+        public float Gain { get => gain; set { SetProperty(ref gain, value); } }
+
+        public string Sn { get => _Sn; set { SetProperty(ref _Sn, value); } }
+        public string VppFileName { get => _VppFileName; set { SetProperty(ref _VppFileName, value); } }
+
+        public CameraInfo Copy()
+        {
+
+
+            return new CameraInfo()
+            {
+                ExpouseTime = ExpouseTime,
+                Gain = Gain,
+                Sn = Sn,
+                TriggerDelay = TriggerDelay,
+                TriggerFilter = TriggerFilter,
+                TriggerPolarity = TriggerPolarity,
+                TriggeSource = TriggeSource,
+                VppFileName = VppFileName,
+                TriggerMode = TriggerMode,
+
+            };
+        }
+
+
+    }
+}

+ 49 - 0
Model/ProjectData.cs

@@ -0,0 +1,49 @@
+using Prism.Mvvm;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.Model
+{
+    public class ProjectData : BindableBase
+    {
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int id { get; set; }
+        /// <summary>
+        /// 员工
+        /// </summary>
+        public string userId { get; set; }
+        /// <summary>
+        /// 设备名称
+        /// </summary>
+        public string deviceId { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string recordId { get; set; }
+
+        /// <summary>
+        /// 订单编号
+        /// </summary>
+        public string orderId { get; set; }
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime creationTime { get; set; }
+        /// <summary>
+        /// json订单信息
+        /// </summary>
+        public string orderJson { get; set; }
+
+        /// <summary>
+        /// json上传信息
+        /// </summary>
+        public string productionRecords { get; set; }
+
+    }
+}

+ 76 - 0
Model/Users.cs

@@ -0,0 +1,76 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LampInspectionMachine.Model
+{
+    public class Users : BindableBase
+    {
+
+
+        public Users()
+        {
+
+        }
+
+        private int id;
+
+        private Roles role= Roles.操作员;
+
+        private string password;
+
+
+        public int Id { get => id; set { SetProperty(ref id, value); } }
+        public Roles Role { get => role; set { SetProperty(ref role, value); } }
+        public string Password { get => password; set { SetProperty(ref password, value); } }
+
+        public string CheckPwd(string pwd)
+        {
+            bool flag = false;
+            StringBuilder pwdstr1 = new StringBuilder();
+            StringBuilder pwdstr2 = new StringBuilder();
+            for ( int i = 0; i < pwd.Length; i++ )
+            {
+                if ( flag )
+                {
+                    pwdstr1.Append(pwd[ i ]);
+                    flag = false;
+                }
+                else
+                {
+                    pwdstr2.Append(pwd[ i ]);
+                    flag = true;
+                }
+
+            }
+            return pwdstr1.ToString() + pwdstr2.ToString();
+        }
+
+        public bool CheckUserLogin(Users user, AppData appData)
+        {
+
+            Users users = new Users()
+            {
+                Id=0,
+                Role= user.Role,
+                Password=this.CheckPwd(user.Password),
+            };
+            appData.CurrentUser = appData.DefaultUsers.Find(t => t.Role == users.Role && t.Password == users.Password);
+            if ( appData.CurrentUser != null )
+            {
+                return true;
+            }
+            return false;
+        }
+    }
+
+    public enum Roles
+    {
+        操作员,
+        工程师,
+        管理员
+    }
+}

+ 53 - 0
Properties/AssemblyInfo.cs

@@ -0,0 +1,53 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("LampInspectionMachine")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("LampInspectionMachine")]
+[assembly: AssemblyCopyright("Copyright ©  2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+//若要开始生成可本地化的应用程序,请设置
+//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
+//在 <PropertyGroup> 中。例如,如果你使用的是美国英语。
+//使用的是美国英语,请将 <UICulture> 设置为 en-US。  然后取消
+//对以下 NeutralResourceLanguage 特性的注释。  更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+                                     //(未在页面中找到资源时使用,
+                                     //或应用程序资源字典中找到时使用)
+    ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+                                              //(未在页面中找到资源时使用,
+                                              //、应用程序或任何主题专用资源字典中找到时使用)
+)]
+
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 63 - 0
Properties/Resources.Designer.cs

@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace LampInspectionMachine.Properties {
+    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()]
+    internal 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)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LampInspectionMachine.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?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.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: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" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </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" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 26 - 0
Properties/Settings.Designer.cs

@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace LampInspectionMachine.Properties {
+    
+    
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+        
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+        
+        public static Settings Default {
+            get {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 54 - 0
ValueConverters/EnumToBoolConverter.cs

@@ -0,0 +1,54 @@
+using LampInspectionMachine.Cameralibs;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace LampInspectionMachine.ValueConverters
+{
+    public class EnumToBoolConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ( value == null ) return false;
+
+            if ( (bool)value== true&&  parameter ?.ToString()=="软触发" )
+            {
+                return false;
+
+            }
+
+            if ( ( bool ) value == false && parameter?.ToString() == "硬触发" )
+            {
+                return false;
+
+            }
+
+            return true;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ( value == null ) return false;
+
+            if ( ( bool ) value == true && parameter?.ToString() == "软触发" )
+            {
+                return false;
+
+            }
+
+            if ( ( bool ) value == false && parameter?.ToString() == "硬触发" )
+            {
+                return false;
+
+            }
+
+            return true;
+
+        }
+    }
+}

+ 198 - 0
ViewModels/CameraViewModel.cs

@@ -0,0 +1,198 @@
+using Cognex.VisionPro.ToolBlock;
+using Cognex.VisionPro;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using LampInspectionMachine.Views;
+using Prism.Commands;
+using System.Windows;
+using LampInspectionMachine.Core;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Regions;
+using Prism.Mvvm;
+using System.Configuration;
+using System.Drawing.Design;
+using System.Windows.Forms.Integration;
+using System.Threading;
+using System.Windows.Interop;
+using LampInspectionMachine.Model;
+
+namespace LampInspectionMachine.ViewModels
+{
+    public class CameraViewModel : BindableBase, IConfirmNavigationRequest
+    {
+        IContainerProvider _container;
+        private Management management;
+        private int index;
+
+        public Management Management { get => management; set { SetProperty(ref management, value); } }
+
+        public CameraViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            _container = container;
+            Management = _container.Resolve<Management>();
+
+        }
+
+
+        private DelegateCommand _SoftTriggerCommand;
+        /// <summary>
+        /// 开始采集
+        /// </summary>
+        public DelegateCommand SoftTriggerCommand =>
+            _SoftTriggerCommand ?? ( _SoftTriggerCommand = new DelegateCommand(OnSoftTrigger) );
+
+
+        private DelegateCommand _SoftTrigger_ContinueCommand;
+        /// <summary>
+        /// 开始采集
+        /// </summary>
+        public DelegateCommand SoftTrigger_ContinueCommand =>
+            _SoftTrigger_ContinueCommand ?? ( _SoftTrigger_ContinueCommand = new DelegateCommand(OnSoftTrigger__Continue) );
+
+
+        private DelegateCommand _CameraInifCommand;
+        /// <summary>
+        /// 相机初始化
+        /// </summary>
+        public DelegateCommand CameraInifCommand =>
+            _CameraInifCommand ?? ( _CameraInifCommand = new DelegateCommand(OnCameraInit) );
+
+
+        private DelegateCommand _CameraCloseCommand;
+        /// <summary>
+        /// 相机关闭
+        /// </summary>
+        public DelegateCommand CameraCloseCommand =>
+            _CameraCloseCommand ?? ( _CameraCloseCommand = new DelegateCommand(OnCameraClose) );
+
+
+
+
+        private void OnSoftTrigger()
+        {
+            
+            
+            Management.SoftTrigger();
+        }
+        private void OnSoftTrigger__Continue()
+        {
+            Management.SoftTrigger__Continue();
+        }
+
+
+        private void OnCameraInit()
+        {
+
+            Management.InitCamera(Management.CurrCameraSn);
+
+        }
+        /// <summary>
+        /// 接收参数
+        /// </summary>
+        /// <param name="navigationContext"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            if ( navigationContext.Parameters.ContainsKey("Index") )
+            {
+                 index= Convert.ToInt32(navigationContext.Parameters.GetValue<string>("Index"));
+                if ( Management.CameraList!=null )
+                {
+                    if( index < Management.CameraList.Count )
+                    Management.CurrCameraSn = Management.CameraList[ index ];
+                    if ( index < Management.CamConfigs.Count )
+                        Management.CurrCamConfig = Management.CamConfigs[ index ].Copy() ;
+                }
+            }
+        }
+        private void OnCameraClose()
+        {
+
+
+            Management.CloseCamera();
+        }
+
+        public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
+        {
+            if ( Management.CurrCamConfig != null ) 
+            {
+                Management.CamConfigs[ index ]= Management.CurrCamConfig.Copy();
+            }
+            continuationCallback(true);
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+
+        }
+    }
+
+
+    public static class CogDisplayBinder
+    {
+        public static readonly DependencyProperty ImageSourceProperty =
+        DependencyProperty.RegisterAttached(
+            "ImageSource",
+            typeof(ICogImage),
+            typeof(CogDisplayBinder),
+            new FrameworkPropertyMetadata(
+                null,
+                FrameworkPropertyMetadataOptions.None,
+                OnImageSourceChanged));
+
+
+        public static ICogImage GetImageSource(WindowsFormsHost host) =>
+            ( ICogImage ) host.GetValue(ImageSourceProperty);
+
+        public static void SetImageSource(WindowsFormsHost host, ICogImage value) =>
+            host.SetValue(ImageSourceProperty, value);
+
+        public static void OnImageSourceChanged(
+            DependencyObject d,
+            DependencyPropertyChangedEventArgs e)
+        {
+            if ( d is WindowsFormsHost host &&
+                host.Child is CogRecordDisplay display )
+            {
+                if ( e.NewValue is ICogImage newImage )
+                {
+
+                    // 跨线程安全更新
+                    host.Dispatcher.Invoke(() =>
+                    {
+
+                        try
+                        {
+                            display.Image = newImage;
+                            display.Fit(true);
+                        }
+                        catch
+                        {
+
+                        }
+
+
+
+                    });
+
+
+                }
+                else
+                {
+                    host.Dispatcher.Invoke(() => display.Image = null);
+                }
+            }
+        }
+    }
+
+}

+ 107 - 0
ViewModels/MainWindowViewModel.cs

@@ -0,0 +1,107 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Regions;
+using LampInspectionMachine.Views;
+using LampInspectionMachine.DataBase;
+using System.Windows;
+using LampInspectionMachine.Model;
+using LampInspectionMachine.Core;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip;
+using System.Windows.Interop;
+
+namespace LampInspectionMachine.ViewModels
+{
+    public class MainWindowViewModel : BindableBase
+    {
+        private AppData _appData;
+        private Management management;
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+
+
+        public DelegateCommand LoadedCommand { get; set; }
+
+        public DelegateCommand ClosedCommand { get; set; }
+
+        public MainWindowViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            SqlSugarHelper.CreataDatabase();
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+            _appData = _container.Resolve<AppData>();
+            management = _container.Resolve<Management>();
+            management.LoadCameraDevice();
+
+            LoadedCommand = new DelegateCommand(OnLoad);
+            ClosedCommand = new DelegateCommand(OnClose);
+        }
+       
+
+        private DelegateCommand _OpenMenuViewCommand;
+        public DelegateCommand OpenMenuViewCommand =>
+            _OpenMenuViewCommand ?? ( _OpenMenuViewCommand = new DelegateCommand(MenuViewShow) );
+
+        private DelegateCommand _OpenRoleLoginViewCommand;
+        public DelegateCommand OpenRoleLoginViewCommand =>
+            _OpenRoleLoginViewCommand ?? ( _OpenRoleLoginViewCommand = new DelegateCommand(RoleLoginViewShow) );
+
+        private DelegateCommand _OpenWorkRunViewCommand;
+        public DelegateCommand OpenWorkRunViewCommand =>
+            _OpenWorkRunViewCommand ?? ( _OpenWorkRunViewCommand = new DelegateCommand(WorkRunViewShow) );
+
+
+        private DelegateCommand<MainWindow>_CloseViewCommand;
+        public DelegateCommand<MainWindow> CloseViewCommand =>
+            _CloseViewCommand ?? ( _CloseViewCommand = new DelegateCommand<MainWindow>(CloseViewMethod) );
+
+
+
+        private  void OnLoad()
+        {
+
+            TipService tipService = new TipService();
+            Task.Run(() => { management.InitTemplates(tipService); });
+        }
+
+        private void OnClose()
+        {
+
+
+
+        }
+
+        void MenuViewShow()
+        {
+            _regionManager.Regions[ "RegionContent" ].RequestNavigate("MenuView");
+
+        }
+
+        void RoleLoginViewShow()
+        {
+            RoleLoginView roleLoginView = new RoleLoginView();
+            roleLoginView.ShowDialog();
+        }
+
+        void WorkRunViewShow()
+        {
+            _regionManager.Regions[ "RegionContent" ].RequestNavigate("WorkRunView");
+        }
+
+        void CloseViewMethod(MainWindow window)
+        {
+            _appData.APPExitEvent.Reset();
+            window.Close();
+        }
+
+
+    }
+}

+ 64 - 0
ViewModels/MenuViewModel.cs

@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Regions;
+using System.Windows.Controls;
+
+namespace LampInspectionMachine.ViewModels
+{
+    public  class MenuViewModel:BindableBase 
+    {
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+
+
+        private DelegateCommand<string> _OpenCameraViewCommand;
+        public DelegateCommand<string> OpenCameraViewCommand =>
+            _OpenCameraViewCommand ?? ( _OpenCameraViewCommand = new DelegateCommand<string>(CameraViewShow) );
+
+
+        private DelegateCommand <string> _OpenVisionProViewCommand;
+        public DelegateCommand<string> OpenVisionProViewCommand =>
+            _OpenVisionProViewCommand ?? ( _OpenVisionProViewCommand = new DelegateCommand<string>(VisionProViewShow) );
+
+
+  
+
+
+
+        public MenuViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator) 
+        {
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+        }
+
+
+
+
+
+        void CameraViewShow(string index)
+        {
+
+            NavigationParameters paras = new NavigationParameters();
+            paras.Add("Index", Convert.ToInt32(index)); //键值对
+            _regionManager.Regions[ "MenuRegionContent" ].RequestNavigate("CameraView", paras);
+        }
+        void VisionProViewShow(string index)
+        {
+            NavigationParameters paras = new NavigationParameters();
+            paras.Add("Index", Convert.ToInt32(index)); //键值对
+            _regionManager.Regions[ "MenuRegionContent" ].RequestNavigate("VisionProView", paras);
+        }
+       
+
+     
+    }
+}

+ 20 - 0
ViewModels/ProductViewModel.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+using Prism.Events;
+using Prism.Ioc;
+
+namespace LampInspectionMachine.ViewModels
+{
+    public class ProductViewModel:BindableBase
+    {
+
+        public ProductViewModel(IContainerProvider container, IEventAggregator eventAggregator)
+        {
+
+        }
+    }
+}

+ 175 - 0
ViewModels/RoleLoginViewModel.cs

@@ -0,0 +1,175 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using Prism.Commands;
+using LampInspectionMachine.Log4xml;
+using LampInspectionMachine.Model;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Regions;
+using LampInspectionMachine.Views;
+using System.Windows.Media;
+using System.Threading;
+using System.Windows;
+
+namespace LampInspectionMachine.ViewModels
+{
+    public  class RoleLoginViewModel:BindableBase
+    {
+        private AppData _appData;
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+        private Brush _brush= Brushes.Transparent;
+        private string loginstr="";
+
+
+        private DelegateCommand<RoleLoginView> _LoginCommand;
+        public DelegateCommand<RoleLoginView> LogoutCommand =>
+            _LoginCommand ?? ( _LoginCommand = new DelegateCommand<RoleLoginView>(OnRoleLogin) );
+        private Users loginUser=new Users(){  Role= Roles.操作员     };
+        public Users LoginUser { get => loginUser; set { SetProperty(ref loginUser, value); } }
+
+        private  List<string> rolesList=new List<string>(){ Roles.操作员.ToString(),Roles.工程师.ToString(),Roles.管理员.ToString() };
+
+        private  string _CurrRole="操作员";
+        public RoleLoginViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator) 
+        {
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+            _appData=_container.Resolve<AppData>();
+        }
+        void OnRoleLogin(RoleLoginView view)
+        {
+            loginUser.Password=SecureStringToString(Password);
+            if ( loginUser.CheckUserLogin(loginUser, _appData) )
+            {
+                L_Brush = Brushes.Green;
+                Loginstr = "登录成功";
+                LogHelper.Info("登录成功");
+                Task task=  Task.Run(() =>
+                {
+                    Thread.Sleep(1000);
+                    Application.Current.Dispatcher.Invoke(new Action(() =>
+                    {
+                        view.Close();
+                    }));
+                });
+               
+                
+               
+            }
+            else
+            {
+                L_Brush = Brushes.Red;
+                Loginstr = "登录失败";
+                Task task=  Task.Run(() =>
+                {
+                    Thread.Sleep(1000);
+                    L_Brush = Brushes.Transparent;
+                    Loginstr = "";
+                });
+                LogHelper.Info("登录失败");
+            }
+
+
+        }
+
+
+
+        public DelegateCommand<object> PasswordChangedCommand => new DelegateCommand<object>(PasswordChanged);
+        // 密码变量
+        private SecureString _password;
+
+        public SecureString Password
+        {
+            get
+            {
+                return _password;
+            }
+            set
+            {
+                // 如果新值与旧值不同
+                if ( _password != value )
+                {
+                    // 更新密码
+
+                    // 触发属性更改通知,通知UI层密码已更改
+                    SetProperty(ref _password, value);
+                }
+            }
+        }
+
+        public string CurrRole { get => _CurrRole;
+            set
+            {
+                SetProperty(ref _CurrRole, value);
+                LoginUser.Role = ( Roles ) Enum.Parse(typeof(Roles), CurrRole);
+            }
+        }
+
+        public List<string> RolesList { get => rolesList; set { SetProperty(ref rolesList, value); } }
+
+        public Brush L_Brush { get => _brush; set { SetProperty(ref _brush, value); } }
+
+        public string Loginstr { get => loginstr; set { SetProperty(ref loginstr, value); } }
+
+        private void PasswordChanged(object parameter)
+        {
+            var passwordBox = parameter as PasswordBox;
+            if ( passwordBox != null )
+            {
+                // 设置 ViewModel 中的密码属性
+                Password = passwordBox.SecurePassword;
+            }
+        }
+
+
+        /// <summary>
+        /// 将 SecureString 类型的数据转换为普通的字符串类型。
+        /// </summary>
+        /// <param name="secureString">要转换的 SecureString 对象。</param>
+        /// <returns>转换后的字符串,如果转换失败则返回空字符串。</returns>
+        private string SecureStringToString(SecureString secureString)
+        {
+            // 初始化指针
+            IntPtr ptr = IntPtr.Zero;
+            try
+            {
+                // 将 SecureString 转换为指针
+                ptr = Marshal.SecureStringToGlobalAllocUnicode(secureString);
+
+                if ( ptr != IntPtr.Zero )
+                {
+                    // 将指针中的数据复制到一个普通的字符串
+                    return Marshal.PtrToStringUni(ptr);
+                }
+                else
+                {
+                    return string.Empty;
+                }
+            }
+            catch ( Exception ex )
+            {
+                // 处理异常
+                Console.WriteLine($"转换 SecureString 出错:{ex.Message}");
+                return string.Empty;
+            }
+            finally
+            {
+                // 清除内存中的敏感数据
+                if ( ptr != IntPtr.Zero )
+                {
+                    Marshal.ZeroFreeGlobalAllocUnicode(ptr);
+                }
+            }
+        }
+    }
+}

+ 47 - 0
ViewModels/SettingViewModel.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+using LampInspectionMachine.Model;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Regions;
+using Prism.Commands;
+using LampInspectionMachine.DataBase;
+
+namespace LampInspectionMachine.ViewModels
+{
+    public class SettingViewModel:BindableBase
+    {
+
+        private AppData _appData;
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+        //private SettingModel _settingModel=new SettingModel();
+
+
+        private DelegateCommand _SaveSettingsCommand;
+        public DelegateCommand  SaveSettingsCommand =>
+            _SaveSettingsCommand ?? ( _SaveSettingsCommand = new DelegateCommand(SaveSettings) );
+        public SettingViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+            _appData = _container.Resolve<AppData>();
+            //SettingModel=_appData.Setting_Model;
+             
+        }
+
+        //public SettingModel SettingModel { get => _settingModel; set { SetProperty(ref _settingModel, value); } }
+
+
+        public void SaveSettings()
+        {
+            //SqlSugarHelper.Updateable(SettingModel);
+        }
+    }
+}

+ 55 - 0
ViewModels/VisionProViewModel.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+using Prism.Regions;
+using LampInspectionMachine.Core;
+using Cognex.VisionPro.ToolBlock;
+using Prism.Events;
+using Prism.Ioc;
+using Cognex.VisionPro;
+using System.Windows.Forms.Integration;
+using System.Windows;
+using Cognex.VisionPro.ToolGroup;
+using OpenCvSharp.Flann;
+
+namespace LampInspectionMachine.ViewModels
+{
+    public class VisionProViewModel : BindableBase, IConfirmNavigationRequest
+    {
+        private CogToolBlock _TcogToolBlock;
+        private Management management;
+        public VisionProViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregato) 
+        {
+            management= container.Resolve<Management>();
+        }
+
+        public CogToolBlock TcogToolBlock { get => _TcogToolBlock; set { SetProperty(ref _TcogToolBlock, value); } }
+
+        public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
+        {
+            continuationCallback(true);   
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+           
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            if ( navigationContext.Parameters.ContainsKey("Index") )
+            {
+                management.OnSwitchToolBlock(Convert.ToInt32(navigationContext.Parameters.GetValue<string>("Index")));
+            }
+        }
+
+    }
+}

+ 77 - 0
ViewModels/WorkRunViewModel.cs

@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Prism.Mvvm;
+using System.Threading.Tasks;
+using Prism.Events;
+using Prism.Ioc;
+using Prism.Regions;
+using LampInspectionMachine.Model;
+using System.Threading;
+using LampInspectionMachine.Log4xml;
+using System.Diagnostics;
+using System.IO.Ports;
+using LampInspectionMachine.HttpService;
+using System.IO;
+using System.Net;
+using Newtonsoft.Json;
+
+using System.Collections.ObjectModel;
+using LampInspectionMachine.Views;
+
+namespace LampInspectionMachine.ViewModels
+{
+    public class WorkRunViewModel:BindableBase, INavigationAware
+    {
+        private AppData _appData;
+        private IContainerProvider _container;
+        private IEventAggregator _eventAggregator;
+        private IRegionManager _regionManager;
+
+        private Stopwatch[]IOChecksTime=new Stopwatch[50];
+        private string CheckOrderCode=string.Empty;
+        
+
+
+        //运行线程
+        private Thread  WorkThread;
+        public WorkRunViewModel(IContainerProvider container, IRegionManager regionManager, IEventAggregator eventAggregator)
+        {
+            _container = container;
+            _eventAggregator = eventAggregator;
+            _regionManager = regionManager;
+            _appData = _container.Resolve<AppData>();
+         
+
+
+        }
+
+        
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            //停止运行
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            //继续运行
+        }
+
+     
+
+
+       
+
+
+
+        
+        
+    }
+}

+ 445 - 0
Views/CameraView.xaml

@@ -0,0 +1,445 @@
+<UserControl x:Class="LampInspectionMachine.Views.CameraView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:LampInspectionMachine.Views"
+             xmlns:Viewlocal="clr-namespace:LampInspectionMachine.ViewModels"
+             xmlns:cognexWF1="clr-namespace:Cognex.VisionPro;assembly=Cognex.VisionPro.Controls"
+             xmlns:prism="http://prismlibrary.com/"
+             xmlns:valueConvert="clr-namespace:LampInspectionMachine.ValueConverters"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d"
+             FontFamily="微软雅黑"
+             FontSize="10"
+             d:DesignHeight="800"
+             d:DesignWidth="800">
+    <UserControl.Resources>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="Transparent" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="1"
+                                      ShadowDepth="0.5"
+                                      Color="#2961AC" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style TargetType="{x:Type TreeView}">
+            <Setter Property="Background"
+                    Value="#F5F5F5" />
+            <Setter Property="BorderBrush"
+                    Value="#CCCCCC" />
+            <Setter Property="BorderThickness"
+                    Value="1" />
+            <Setter Property="FontFamily"
+                    Value="Segoe UI" />
+            <Setter Property="FontSize"
+                    Value="10" />
+            <Setter Property="ItemContainerStyle">
+                <Setter.Value>
+                    <Style TargetType="{x:Type TreeViewItem}">
+                        <Setter Property="Margin"
+                                Value="2" />
+                        <Setter Property="Padding"
+                                Value="5,3" />
+                    </Style>
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style TargetType="{x:Type TreeViewItem}">
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type TreeViewItem}">
+                        <StackPanel>
+                            <Grid>
+                                <Grid.ColumnDefinitions>
+                                    <ColumnDefinition Width="Auto" />
+                                    <ColumnDefinition Width="*" />
+                                </Grid.ColumnDefinitions>
+                                <Image Grid.Column="0"
+                                       Source="/Resources/folder.png"
+                                       Width="16"
+                                       Height="16" />
+                                <ContentPresenter Grid.Column="1"
+                                                  ContentSource="Header" />
+                            </Grid>
+                            <ItemsPresenter />
+                        </StackPanel>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+            <Setter Property="Foreground"
+                    Value="#333333" />
+            <Style.Triggers>
+                <Trigger Property="IsMouseOver"
+                         Value="True">
+                    <Setter Property="Background"
+                            Value="#E3F2FD" />
+                    <Setter Property="Foreground"
+                            Value="#0D47A1" />
+                </Trigger>
+                <Trigger Property="IsSelected"
+                         Value="True">
+                    <Setter Property="Background"
+                            Value="#BBDEFB" />
+                    <Setter Property="Foreground"
+                            Value="#0D47A1" />
+                </Trigger>
+            </Style.Triggers>
+        </Style>
+
+
+        <!--ComboBox-->
+        <!--ComBoBox项选中背景色-->
+        <SolidColorBrush x:Key="ComboBoxSelectdBackground"
+                         Color="#ff8c69" />
+        <!--ComBoBox项鼠标经过背景色-->
+        <SolidColorBrush x:Key="ComboBoxMouseOverBackground"
+                         Color="#ff3030" />
+        <!--ComBoBox项选中前景色-->
+        <SolidColorBrush x:Key="ComboBoxSelectedForeground"
+                         Color="White" />
+        <!--ComBoBox项鼠标经过前景色-->
+        <SolidColorBrush x:Key="ComboBoxMouseOverForegrond"
+                         Color="White" />
+        <ControlTemplate x:Key="ComboBoxToggleButton"
+                         TargetType="{x:Type ToggleButton}">
+            <Grid Height="25"
+                  HorizontalAlignment="Stretch">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*" />
+                    <ColumnDefinition Width="30" />
+                </Grid.ColumnDefinitions>
+                <Border  Background="White"
+                         Grid.ColumnSpan="2"
+                         Opacity="0" />
+                <Path x:Name="Arrow"
+                      Grid.Column="1"
+                      Data="M 0 0  6 6 12 0 Z"
+                      VerticalAlignment="Center"
+                      HorizontalAlignment="Center"
+                      Stretch="None"
+                      Fill="#999" />
+            </Grid>
+            <ControlTemplate.Triggers>
+                <Trigger Property="IsChecked"
+                         Value="true">
+                    <Setter TargetName="Arrow"
+                            Property="RenderTransform">
+                        <Setter.Value>
+                            <RotateTransform   CenterX="6"
+                                               CenterY="3"
+                                               Angle="180"></RotateTransform>
+                        </Setter.Value>
+                    </Setter>
+                    <Setter TargetName="Arrow"
+                            Property="Margin"
+                            Value="0 0 0 2" />
+                </Trigger>
+            </ControlTemplate.Triggers>
+        </ControlTemplate>
+        <Style TargetType="{x:Type ComboBox}">
+            <Setter Property="ItemContainerStyle">
+                <Setter.Value>
+                    <Style TargetType="ComboBoxItem">
+                        <Setter Property="Height"
+                                Value="20" />
+                        <Setter Property="Template">
+                            <Setter.Value>
+                                <ControlTemplate  TargetType="{x:Type ComboBoxItem}">
+                                    <Grid Height="{TemplateBinding Height}"
+                                          Width="{TemplateBinding Width}">
+                                        <Border x:Name="_borderbg"
+                                                Background="Transparent" />
+                                        <TextBlock Margin="3 0 3 0"
+                                                   VerticalAlignment="Center"
+                                                   x:Name="_txt"
+                                                   Foreground="#333"
+                                                   Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}" />
+                                        <Border x:Name="_border"
+                                                Background="White"
+                                                Opacity="0" />
+                                    </Grid>
+                                    <ControlTemplate.Triggers>
+                                        <Trigger Property="IsSelected"
+                                                 Value="true">
+                                            <Setter TargetName="_borderbg"
+                                                    Property="Background"
+                                                    Value="{StaticResource ComboBoxSelectdBackground}" />
+                                            <Setter TargetName="_txt"
+                                                    Property="Foreground"
+                                                    Value="{StaticResource ComboBoxSelectedForeground}" />
+                                        </Trigger>
+                                        <MultiTrigger>
+                                            <MultiTrigger.Conditions>
+                                                <Condition Property="IsSelected"
+                                                           Value="false" />
+                                                <Condition Property="IsMouseOver"
+                                                           Value="true" />
+                                            </MultiTrigger.Conditions>
+                                            <Setter TargetName="_borderbg"
+                                                    Property="Background"
+                                                    Value="{StaticResource ComboBoxMouseOverBackground}" />
+                                            <Setter TargetName="_txt"
+                                                    Property="Foreground"
+                                                    Value="{StaticResource ComboBoxMouseOverForegrond}" />
+                                        </MultiTrigger>
+
+                                    </ControlTemplate.Triggers>
+                                </ControlTemplate>
+                            </Setter.Value>
+                        </Setter>
+                    </Style>
+                </Setter.Value>
+            </Setter>
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type ComboBox}">
+                        <Grid>
+
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="0.7*" />
+                                <ColumnDefinition Width="0.3*"
+                                                  MaxWidth="30" />
+                            </Grid.ColumnDefinitions>
+                            <Border  Grid.Column="0"
+                                     Grid.ColumnSpan="2"
+                                     BorderThickness="1"
+                                     BorderBrush="{TemplateBinding BorderBrush}"
+                                     CornerRadius="1,0,0,1" />
+                            <ContentPresenter HorizontalAlignment="Left"
+                                              Margin="3,3,0,3"
+                                              x:Name="ContentSite"
+                                              VerticalAlignment="Center"
+                                              Content="{TemplateBinding SelectionBoxItem}"
+                                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
+                                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
+                                              IsHitTestVisible="False" />
+
+                            <!--ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen-->
+                            <ToggleButton Grid.Column="0"
+                                          Grid.ColumnSpan="2"
+                                          Template="{StaticResource ComboBoxToggleButton}"
+                                          x:Name="ToggleButton"
+                                          Focusable="false"
+                                          IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
+                                          ClickMode="Press" />
+                            <!--必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它-->
+                            <TextBox   Visibility="Hidden"
+                                       BorderThickness="0"
+                                       Margin="2 0 0 0"
+                                       x:Name="PART_EditableTextBox"
+                                       VerticalAlignment="Center"
+                                       Focusable="True"
+                                       Background="Transparent"
+                                       IsReadOnly="{TemplateBinding IsReadOnly}" />
+
+                            <!--Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen-->
+                            <Popup IsOpen="{TemplateBinding IsDropDownOpen}"
+                                   Placement="Bottom"
+                                   x:Name="Popup"
+                                   Focusable="False"
+                                   AllowsTransparency="True"
+                                   PopupAnimation="Slide">
+                                <Grid MaxHeight="150"
+                                      MinWidth="{TemplateBinding ActualWidth}"
+                                      x:Name="DropDown"
+                                      SnapsToDevicePixels="True">
+                                    <Border x:Name="DropDownBorder"
+                                            BorderBrush="#e8e8e8"
+                                            BorderThickness="1 0 1 1" />
+                                    <ScrollViewer Margin="1"
+                                                  SnapsToDevicePixels="True"
+                                                  HorizontalScrollBarVisibility="Auto"
+                                                  VerticalScrollBarVisibility="Auto"
+                                                  CanContentScroll="True">
+                                        <!--StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True-->
+                                        <StackPanel IsItemsHost="True"
+                                                    KeyboardNavigation.DirectionalNavigation="Contained"
+                                                    Background="White" />
+                                    </ScrollViewer>
+                                </Grid>
+                            </Popup>
+                        </Grid>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsEditable"
+                                     Value="true">
+                                <Setter TargetName="PART_EditableTextBox"
+                                        Property="Visibility"
+                                        Value="Visible" />
+                            </Trigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+
+        <valueConvert:EnumToBoolConverter x:Key="EnumToBoolConverter" />
+    </UserControl.Resources>
+
+    <Grid>
+        <Grid>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="Auto" />
+                <ColumnDefinition Width="*" />
+            </Grid.ColumnDefinitions>
+            <Grid>
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="Auto" />
+                    </Grid.RowDefinitions>
+                    <StackPanel Grid.Row="0"
+                                Margin="50,15,0,0"
+                                Orientation="Horizontal"
+                                VerticalAlignment="Center">
+                        <GroupBox Header="相机">
+                           
+                        <ComboBox x:Name="combox"
+                                  Width="190"
+                                  Height="30"
+                                  SelectedItem="{Binding Management.CurrCameraSn}"
+                                  ItemsSource="{Binding Management.CameraList}" />
+                        </GroupBox>
+                    </StackPanel>
+
+
+
+                    <StackPanel Grid.Row="1"
+                                Margin="50,5,0,0"
+                                Orientation="Horizontal"
+                                VerticalAlignment="Center">
+                        <GroupBox Header="采集方式">
+                            <StackPanel Orientation="Horizontal">
+                                <RadioButton  Content="软触发"
+                                              IsChecked="{Binding Management.CurrCamConfig.TriggerMode,Converter={StaticResource EnumToBoolConverter},ConverterParameter=软触发}"
+                                              GroupName="SoftTrigger"
+                                              Margin="10" />
+                                <RadioButton  Content="硬触发"
+                                              IsChecked="{Binding Management.CurrCamConfig.TriggerMode,Converter={StaticResource EnumToBoolConverter},ConverterParameter=硬触发}"
+                                              GroupName="SoftTrigger"
+                                              Margin="30,10,40,0" />
+                            </StackPanel>
+                        </GroupBox>
+                    </StackPanel>
+
+                    <StackPanel Grid.Row="2"
+                                Margin="50,5,0,0"
+                                Orientation="Horizontal"
+                                VerticalAlignment="Center">
+                        <GroupBox Header="曝光">
+                            <StackPanel Orientation="Horizontal">
+                                <TextBox Width="190"/>
+                            </StackPanel>
+                        </GroupBox>
+                    </StackPanel>
+
+                    <Border Grid.Row="3"
+                            BorderThickness="1"
+                            BorderBrush="#e8e8e8"
+                            Margin="50,10,0,0"
+                            Padding="5">
+
+                        <StackPanel  Orientation="Horizontal"
+                                     VerticalAlignment="Center">
+                            <Border Background="#0A85D9"
+                                    BorderBrush="Black"
+                                    BorderThickness="1"
+                                    Margin="10,5,3,5"
+                                    CornerRadius="8">
+                                <Button Content="初始化"
+                                        Background="Transparent"
+                                        Foreground="White"
+                                        Margin="5"
+                                        MinWidth="50"
+                                        BorderThickness="0"
+                                        Command="{Binding CameraInifCommand}" />
+
+                            </Border>
+                            <Border Background="#0A85D9"
+                                    BorderBrush="Black"
+                                    BorderThickness="1"
+                                    Margin="40,5,3,5"
+                                    CornerRadius="8">
+                                <Button Content="关闭"
+                                        Background="Transparent"
+                                        Foreground="White"
+                                        Margin="5"
+                                        MinWidth="50"
+                                        BorderThickness="0"
+                                        Command="{Binding CameraCloseCommand}"
+                                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />
+
+                            </Border>
+                        </StackPanel>
+                    </Border>
+
+                    <Border Grid.Row="4"
+                            BorderThickness="1"
+                            BorderBrush="#e8e8e8"
+                            Margin="50,10,0,0"
+                            Padding="5">
+
+                        <StackPanel  Orientation="Horizontal"
+                                     VerticalAlignment="Center">
+                            <Border Background="#0A85D9"
+                                    BorderBrush="Black"
+                                    BorderThickness="1"
+                                    Margin="10,5,3,5"
+                                    CornerRadius="8">
+                                <Button Content="开始采集"
+                                        Background="Transparent"
+                                        Foreground="White"
+                                        Margin="5"
+                                        MinWidth="50"
+                                        BorderThickness="0"
+                                        Command="{Binding  SoftTrigger_ContinueCommand}"
+                                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />
+                            </Border>
+                            <Border Background="#0A85D9"
+                                    BorderBrush="Black"
+                                    BorderThickness="1"
+                                    Margin="40,5,3,5"
+                                    CornerRadius="8">
+                                <Button Content="单张采集"
+                                        Background="Transparent"
+                                        Foreground="White"
+                                        Margin="5"
+                                        MinWidth="50"
+                                        BorderThickness="0"
+                                        Command="{Binding SoftTriggerCommand}" />
+
+                            </Border>
+
+                        </StackPanel>
+                    </Border>
+
+                    
+                </Grid>
+            </Grid>
+            <DockPanel  Grid.Column="1"
+                        Margin="20,20,10,20">
+                <WindowsFormsHost Viewlocal:CogDisplayBinder.ImageSource="{Binding Management.Image}">
+                    <cognexWF1:CogRecordDisplay x:Name="cogRecordDisplay" />
+                </WindowsFormsHost>
+
+            </DockPanel>
+        </Grid>
+    </Grid>
+</UserControl>

+ 37 - 0
Views/CameraView.xaml.cs

@@ -0,0 +1,37 @@
+using Cognex.VisionPro;
+using LampInspectionMachine.Core;
+using Prism.Ioc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// CameraView.xaml 的交互逻辑
+    /// </summary>
+    public partial class CameraView : UserControl
+    {
+
+        private Management management;
+        public CameraView(IContainerProvider container)
+        {
+            InitializeComponent();
+            management=container.Resolve<Management>(); 
+           
+        }
+    }
+
+  
+}

+ 112 - 0
Views/LoadingView.xaml

@@ -0,0 +1,112 @@
+<Window x:Class="LampInspectionMachine.Views.LoadingView"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:LampInspectionMachine.Views"
+        mc:Ignorable="d"
+        WindowStartupLocation="CenterScreen"
+        WindowStyle="None"
+        ResizeMode="NoResize"
+        Width="300"
+        Height="100"
+        d:DesignHeight="150"
+        d:DesignWidth="300"
+        Background="Transparent"
+        Title="LoadingView">
+    <Window.Resources>
+        <Style x:Key="ellipse"
+               TargetType="Ellipse">
+            <Setter Property="Width"
+                    Value="20" />
+            <Setter Property="Height"
+                    Value="20" />
+            <Setter Property="Fill"
+                    Value="#41b6e6" />
+            <Setter Property="RenderTransform">
+                <Setter.Value>
+                    <TranslateTransform X="0"
+                                        Y="0" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <PowerEase x:Key="powerEase"
+                   Power="2"
+                   EasingMode="EaseInOut" />
+    </Window.Resources>
+    <Canvas Background="Transparent"
+            Width="200"
+            Height="200">
+        <Canvas.Triggers>
+            <EventTrigger RoutedEvent="Loaded">
+                <BeginStoryboard>
+                    <Storyboard RepeatBehavior="Forever"
+                                Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
+                        <DoubleAnimation  Storyboard.TargetName="e1"
+                                          To="-50"
+                                          BeginTime="0:0:0.0"
+                                          Duration="0:0:0.5"
+                                          AutoReverse="True"
+                                          EasingFunction="{StaticResource powerEase}" />
+                        <DoubleAnimation Storyboard.TargetName="e2"
+                                         To="-50"
+                                         BeginTime="0:0:0.1"
+                                         Duration="0:0:0.5"
+                                         AutoReverse="True"
+                                         EasingFunction="{StaticResource powerEase}" />
+                        <DoubleAnimation Storyboard.TargetName="e3"
+                                         To="-50"
+                                         BeginTime="0:0:0.2"
+                                         Duration="0:0:0.5"
+                                         AutoReverse="True"
+                                         EasingFunction="{StaticResource powerEase}" />
+                        <DoubleAnimation Storyboard.TargetName="e4"
+                                         To="-50"
+                                         BeginTime="0:0:0.3"
+                                         Duration="0:0:0.5"
+                                         AutoReverse="True"
+                                         EasingFunction="{StaticResource powerEase}" />
+                        <DoubleAnimation Storyboard.TargetName="e5"
+                                         To="-50"
+                                         BeginTime="0:0:0.4"
+                                         Duration="0:0:0.5"
+                                         AutoReverse="True"
+                                         EasingFunction="{StaticResource powerEase}" />
+                    </Storyboard>
+                </BeginStoryboard>
+            </EventTrigger>
+        </Canvas.Triggers>
+
+
+        <Label Content="Loading"
+               Name="Msg"
+               FontSize="16"
+               FontFamily="Times New Roman"
+               Foreground="#ffb549"
+               FontWeight="Bold"
+               Width="200"
+               HorizontalContentAlignment="Center"
+               Canvas.Top="70" />
+
+        <Ellipse Name="e1"
+                 Canvas.Left="30"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+        <Ellipse Name="e2"
+                 Canvas.Left="60"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+        <Ellipse Name="e3"
+                 Canvas.Left="90"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+        <Ellipse Name="e4"
+                 Canvas.Left="120"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+        <Ellipse Name="e5"
+                 Canvas.Left="150"
+                 Canvas.Top="60"
+                 Style="{StaticResource ellipse}" />
+    </Canvas>
+</Window>

+ 42 - 0
Views/LoadingView.xaml.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing.Drawing2D;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// LoadingView.xaml 的交互逻辑
+    /// </summary>
+    public partial class LoadingView : Window
+    {
+
+
+        private string str="";
+        public LoadingView()
+        {
+            InitializeComponent();
+        }
+
+        public string Str
+        {
+            get => str;
+            set
+            {
+                str = value;
+                Msg.Content = value;
+            }
+        }
+    }
+}

+ 173 - 0
Views/MainWindow.xaml

@@ -0,0 +1,173 @@
+<Window x:Class="LampInspectionMachine.Views.MainWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:LampInspectionMachine"
+        xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
+        xmlns:prism="http://prismlibrary.com/"
+        prism:ViewModelLocator.AutoWireViewModel="True"
+        mc:Ignorable="d"
+        WindowStyle="None"
+        Title="包装"
+        Height="450"
+        FontWeight="Bold"
+        FontFamily="微软雅黑"
+        MouseDoubleClick="Grid_MouseDown"
+        SizeChanged="Window_SizeChanged"
+        Width="800">
+    <b:Interaction.Triggers>
+        <b:EventTrigger EventName="Loaded">
+            <b:InvokeCommandAction Command="{Binding LoadedCommand}" />
+        </b:EventTrigger>
+        <b:EventTrigger EventName="Closed">
+            <b:InvokeCommandAction Command="{Binding ClosedCommand}" />
+        </b:EventTrigger>
+    </b:Interaction.Triggers>
+    <WindowChrome.WindowChrome>
+        <WindowChrome GlassFrameThickness="50"
+                      CaptionHeight="30"
+                      NonClientFrameEdges="Left,Bottom,Right"
+                      CornerRadius="20" />
+    </WindowChrome.WindowChrome>
+    <Window.Resources>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="White" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="#D4D8DD" />
+                </Setter.Value>
+            </Setter> 
+        </Style>
+    </Window.Resources>
+    <Border BorderBrush="AliceBlue"
+            BorderThickness="2"
+            Margin="10"
+            CornerRadius="10">
+        <Border.Background>
+            <LinearGradientBrush>
+                <GradientStop Color="#95DDFD"
+                              Offset="0" />
+                <GradientStop Color="#97B8FF"
+                              Offset="0.4" />
+                <GradientStop Color="#2961AC"
+                              Offset="0.9" />
+            </LinearGradientBrush>
+        </Border.Background>
+        <Grid Background="White"
+              Opacity="0.8">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="70" />
+                <RowDefinition />
+            </Grid.RowDefinitions>
+            <Grid Grid.Row="0"
+                  VerticalAlignment="Center">
+                <StackPanel Orientation="Horizontal">
+
+                    <TextBlock Text="灯检"
+                               FontSize="26"
+                               Margin="30,20,0,0"
+                               FontWeight="Bold" />
+                </StackPanel>
+                <StackPanel Orientation="Horizontal"
+                            VerticalAlignment="Top"
+                            Height="65"
+                            HorizontalAlignment="Right">
+                    <TextBlock Text="当前时间:"
+                               FontSize="16"
+                               Margin="5,5,5,10"
+                               VerticalAlignment="Bottom" />
+                    <TextBlock Text="2025-10-30"
+                               FontSize="16"
+                               Margin="0,0,25,10"
+                               VerticalAlignment="Bottom" />
+                    <Border Style="{StaticResource buttonborder}">
+
+                        <Button Content="权限登录"
+                                VerticalAlignment="Top"
+                                Command="{Binding OpenRoleLoginViewCommand}"
+                                Padding="5"
+                                BorderBrush="Transparent"
+                                FontSize="15"
+                                WindowChrome.IsHitTestVisibleInChrome="True"
+                                Background="Transparent" />
+
+                    </Border>
+                    <Border Style="{StaticResource buttonborder}">
+
+                        <Button Content="菜单界面"
+                                VerticalAlignment="Top"
+                                Padding="5"
+                                BorderBrush="Transparent"
+                                FontSize="15"
+                                Command="{Binding OpenMenuViewCommand}"
+                                WindowChrome.IsHitTestVisibleInChrome="True"
+                                Background="Transparent" />
+
+                    </Border>
+                    <Border Style="{StaticResource buttonborder}">
+
+                        <Button Content="运行界面"
+                                VerticalAlignment="Top"
+                                Padding="5"
+                                BorderBrush="Transparent"
+                                FontSize="15"
+                                Command="{Binding OpenWorkRunViewCommand}"
+                                WindowChrome.IsHitTestVisibleInChrome="True"
+                                Background="Transparent" />
+
+                    </Border>
+                    <Button Content="➖"
+                            Margin="0,10,0,0"
+                            VerticalAlignment="Top"
+                            Name="btnNormal"
+                            Click="btnNormal_Click"
+                            Width="45"
+                            FontWeight="Bold"
+                            FontSize="15"
+                            BorderThickness="0"
+                            WindowChrome.IsHitTestVisibleInChrome="True"
+                            Background="Transparent" />
+                    <Button  Content="⭕"
+                             Margin="0,7,0,0"
+                             VerticalAlignment="Top"
+                             Click="btnMaximize_Click"
+                             Name="btnMaximize"
+                             Width="45"
+                             FontWeight="Bold"
+                             FontSize="20"
+                             BorderThickness="0"
+                             WindowChrome.IsHitTestVisibleInChrome="True"
+                             Background="Transparent" />
+                    <Button  Content="❌"
+                             Margin="0,10,0,0"
+                             VerticalAlignment="Top"
+                             Width="45"
+                             Command="{Binding CloseViewCommand}"
+                             CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
+                             FontWeight="Bold"
+                             FontSize="15"
+                             BorderThickness="0"
+                             WindowChrome.IsHitTestVisibleInChrome="True"
+                             Background="Transparent" />
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="1">
+                <ContentControl prism:RegionManager.RegionName="RegionContent" />
+            </Grid>
+        </Grid>
+    </Border>
+</Window>

+ 76 - 0
Views/MainWindow.xaml.cs

@@ -0,0 +1,76 @@
+using System.Windows;
+using System.Windows.Input;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// MainWindow.xaml 的交互逻辑
+    /// </summary>
+    public partial class MainWindow : Window
+    {
+        private WindowState _windowState= WindowState.Normal;
+        public MainWindow()
+        {
+            InitializeComponent();
+
+        }
+
+
+
+        Rect rcnormal;//定义一个全局rect记录还原状态下窗口的位置和大小。
+        /// <summary>
+        /// 最大化
+        /// </summary>
+        private void btnMaximize_Click(object sender, RoutedEventArgs e)
+        {
+            if ( _windowState == WindowState.Normal )
+            {
+                _windowState = WindowState.Maximized;
+                rcnormal = new Rect(this.Left, this.Top, this.Width, this.Height);//保存下当前位置与大小
+                this.Left = 0;//设置位置
+                this.Top = 0;
+                Rect rc = SystemParameters.WorkArea;//获取工作区大小
+                this.Width = rc.Width;
+                this.Height = rc.Height;
+            }
+            else
+            {
+                _windowState = WindowState.Normal;
+                this.Left = rcnormal.Left;
+                this.Top = rcnormal.Top;
+                this.Width = rcnormal.Width;
+                this.Height = rcnormal.Height;
+            }
+        }
+        /// <summary>
+        /// 还原
+        /// </summary>
+        private void btnNormal_Click(object sender, RoutedEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+
+        }
+        private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
+        {
+            if ( this.ActualHeight > SystemParameters.WorkArea.Height || this.ActualWidth > SystemParameters.WorkArea.Width )
+            {
+                this.WindowState = System.Windows.WindowState.Normal;
+                btnMaximize_Click(null, null);
+            }
+        }
+        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            if ( e.ClickCount == 2 )
+            {
+                if ( this.ActualWidth == SystemParameters.WorkArea.Width )
+                {
+                    btnNormal_Click(null, null);
+                }
+                else
+                {
+                    btnMaximize_Click(null, null);
+                }
+            }
+        }
+    }
+}

+ 190 - 0
Views/MenuView.xaml

@@ -0,0 +1,190 @@
+<UserControl x:Class="LampInspectionMachine.Views.MenuView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:LampInspectionMachine.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d"
+             d:DesignHeight="450"
+             d:DesignWidth="800">
+    <UserControl.Resources>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="White" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="#D4D8DD" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style x:Key="textborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="#D4D8DD" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="White" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style x:Key="Menubutton"
+               TargetType="Button">
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="HorizontalContentAlignment"
+                    Value="Left" />
+            <Setter Property="FontWeight"
+                    Value="Bold" />
+            <Setter Property="Margin"
+                    Value="15,5,5,5" />
+            <Setter Property="Padding"
+                    Value="5" />
+            <Setter Property="FontSize"
+                    Value="14" />
+            <Setter Property="BorderThickness"
+                    Value="0" />
+        </Style>
+    </UserControl.Resources>
+   
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="Auto" />
+            <ColumnDefinition Width="*" />
+        </Grid.ColumnDefinitions>
+        <Border Grid.Column="0"
+                Margin="10"
+                Padding="2"
+                CornerRadius="5"
+                BorderBrush="#D4D8DD"
+                BorderThickness="2">
+           <Grid Margin="5">
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="40" />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+                    <Border Style="{StaticResource textborder}"
+                            Grid.Row="0">
+                        <TextBlock Text="调试"
+                                   Width="150"
+                                   Margin="15,5,5,5"
+                                   FontSize="14" />
+                    </Border>
+                    <Border BorderBrush="#D4D8DD"
+                            BorderThickness="1"
+                            Grid.Row="1">
+                        <StackPanel>
+                            <Button Content="相机1"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="0"/>
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="0"/>
+                            <Button Content="相机2"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="1"/>
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="1"/>
+                            <Button Content="相机3"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="2" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="2" />
+                            <Button Content="相机4"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="3" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="3" />
+                            <Button Content="相机5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="4" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="4" />
+                            <Button Content="相机6"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="5" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="5" />
+                            <Button Content="相机7"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="6" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="6" />
+                            <Button Content="相机8"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenCameraViewCommand}"
+                                    CommandParameter="7" />
+                            <Button Content="视觉调试"
+                                    Margin="30,0,5,5"
+                                    Style="{StaticResource Menubutton}"
+                                    Command="{Binding OpenVisionProViewCommand}"
+                                    CommandParameter="7" />
+                        </StackPanel>
+                    </Border>
+
+                </Grid>
+            </Grid>
+        </Border>
+
+        <Border Grid.Column="1"
+                Margin="20"
+                BorderBrush="#D4D8DD"
+                BorderThickness="2">
+            <ContentControl prism:RegionManager.RegionName="MenuRegionContent" />
+        </Border>
+      
+    </Grid>
+    
+</UserControl>

+ 15 - 0
Views/MenuView.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// MenuView.xaml 的交互逻辑
+    /// </summary>
+    public partial class MenuView : UserControl
+    {
+        public MenuView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 433 - 0
Views/ProductView.xaml

@@ -0,0 +1,433 @@
+<UserControl x:Class="LampInspectionMachine.Views.ProductView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:LampInspectionMachine.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d"
+             d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+        <Style  TargetType="{x:Type GridViewColumnHeader}">
+            <Setter Property="OverridesDefaultStyle"
+                    Value="True" />
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
+                        <Grid Name="g">
+                            <Border Name="bd"
+                                    Padding="{TemplateBinding Padding}"
+                                    MaxHeight="{TemplateBinding Height}">
+                                <!--<ContentPresenter Margin="5,4,1,3" 
+                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>-->
+                                <ContentPresenter RecognizesAccessKey="True"
+                                                  Content="{TemplateBinding ContentControl.Content}"
+                                                  ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
+                                                  ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
+                                                  Name="HeaderContent"
+                                                  Margin="5,4,1,3"
+                                                  SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
+                            </Border>
+                            <Thumb Name="PART_HeaderGripper"
+                                   Template="{StaticResource tmpForThumb}"
+                                   HorizontalAlignment="Right"
+                                   Margin="0,0,-1,0" />
+                        </Grid>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsMouseOver"
+                                     Value="True">
+                                <Setter TargetName="g"
+                                        Property="Background"
+                                        Value="#0A6CE7">
+
+                                </Setter>
+                            </Trigger>
+                            <Trigger Property="IsPressed"
+                                     Value="True">
+                                <Setter Property="Margin"
+                                        Value="6,5,1,3"
+                                        TargetName="HeaderContent" />
+                            </Trigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <ControlTemplate x:Key="tmpForThumb"
+                         TargetType="{x:Type Thumb}">
+            <Border>
+                <Border BorderThickness="1 0 1 0"
+                        Name="rec"
+                        BorderBrush="Transparent">
+                </Border>
+            </Border>
+        </ControlTemplate>
+        <Style TargetType="{x:Type ListViewItem}">
+            <Style.Setters>
+                <!--<Setter Property="Background">
+                    <Setter.Value>
+                        <Binding RelativeSource="{RelativeSource Self}"
+                                 Converter="{StaticResource myConverter}" />
+                    </Setter.Value>
+                </Setter>-->
+                <Setter Property="SnapsToDevicePixels"
+                        Value="True" />
+                <Setter Property="Template">
+                    <Setter.Value>
+                        <ControlTemplate TargetType="{x:Type ListViewItem}">
+                            <Border Padding="{TemplateBinding Control.Padding}"
+                                    Background="{TemplateBinding Panel.Background}"
+                                    Name="Bd"
+                                    SnapsToDevicePixels="True">
+                                <GridViewRowPresenter HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
+                                                      VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
+                                                      SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
+                                                      Margin="3" />
+                            </Border>
+                            <ControlTemplate.Triggers>
+                                <MultiTrigger>
+                                    <MultiTrigger.Conditions>
+                                        <Condition Property="IsSelected"
+                                                   Value="False" />
+                                    </MultiTrigger.Conditions>
+                                    <Setter Property="Foreground"
+                                            Value="#000000" />
+                                </MultiTrigger>
+                                <MultiTrigger>
+                                    <MultiTrigger.Conditions>
+                                        <Condition Property="UIElement.IsMouseOver"
+                                                   Value="True">
+                                        </Condition>
+                                    </MultiTrigger.Conditions>
+                                    <Setter Property="Panel.Background"
+                                            TargetName="Bd">
+                                        <Setter.Value>
+                                            <SolidColorBrush>#D9DFE8</SolidColorBrush>
+                                        </Setter.Value>
+                                    </Setter>
+                                </MultiTrigger>
+                                <MultiTrigger>
+                                    <MultiTrigger.Conditions>
+                                        <Condition Property="Selector.IsSelectionActive"
+                                                   Value="False">
+                                        </Condition>
+                                        <Condition Property="Selector.IsSelected"
+                                                   Value="True">
+                                        </Condition>
+                                    </MultiTrigger.Conditions>
+                                    <Setter Property="Panel.Background"
+                                            TargetName="Bd">
+                                        <Setter.Value>
+                                            <SolidColorBrush>#3DDADADA</SolidColorBrush>
+                                        </Setter.Value>
+                                    </Setter>
+
+                                </MultiTrigger>
+                                <MultiTrigger>
+                                    <MultiTrigger.Conditions>
+                                        <Condition Property="Selector.IsSelectionActive"
+                                                   Value="True">
+                                        </Condition>
+                                        <Condition Property="Selector.IsSelected"
+                                                   Value="True">
+                                        </Condition>
+                                    </MultiTrigger.Conditions>
+                                    <Setter Property="Panel.Background"
+                                            TargetName="Bd">
+                                        <Setter.Value>
+                                            <SolidColorBrush>#3D26A0DA</SolidColorBrush>
+                                        </Setter.Value>
+                                    </Setter>
+
+                                </MultiTrigger>
+                                <Trigger Property="IsSelected"
+                                         Value="True">
+                                    <Trigger.Setters>
+                                        <Setter TargetName="Bd"
+                                                Property="Background"
+                                                Value="#8CB1E0" />
+                                        <Setter Property="Foreground"
+                                                Value="#FFFFFF" />
+                                    </Trigger.Setters>
+                                </Trigger>
+                            </ControlTemplate.Triggers>
+                        </ControlTemplate>
+                    </Setter.Value>
+                </Setter>
+            </Style.Setters>
+        </Style>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Margin"
+                    Value="70,5,0,0" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Top" />
+            <Setter Property="BorderBrush"
+                    Value="White" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="#E0CCB2" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style x:Key="textborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="#F9F2E9" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="#D4D8DD" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="White" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <!--List -->
+        <Style TargetType="{x:Type ListView}">
+            <Setter Property="SnapsToDevicePixels"
+                    Value="true" />
+            <Setter Property="OverridesDefaultStyle"
+                    Value="true" />
+            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
+                    Value="Auto" />
+            <Setter Property="ScrollViewer.VerticalScrollBarVisibility"
+                    Value="Auto" />
+            <Setter Property="ScrollViewer.CanContentScroll"
+                    Value="true" />
+            <Setter Property="VerticalContentAlignment"
+                    Value="Center" />
+            <Setter Property="Padding"
+                    Value="10" />
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type  ListView}">
+                        <Border Name="Border"
+                                BorderThickness="1"
+                                Background="White">
+                            <Border.BorderBrush>
+                                <SolidColorBrush Color="#EFF1F6" />
+                            </Border.BorderBrush>
+                            <ScrollViewer Style="{StaticResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
+                                <ItemsPresenter />
+                            </ScrollViewer>
+                        </Border>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <!--列表内容样式-->
+        <Style TargetType="{x:Type ListViewItem}"
+               x:Key="ListViewItemContainerStylePatientList">
+            <Setter Property="FontSize"
+                    Value="12" />
+            <Setter Property="Height"
+                    Value="60" />
+            <Setter Property="FontWeight"
+                    Value="Normal" />
+            <Setter Property="Foreground"
+                    Value="#3E4A58" />
+            <Setter Property="HorizontalContentAlignment"
+                    Value="Center" />
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type ListViewItem}">
+                        <Border x:Name="Bd"
+                                CornerRadius="4"
+                                Margin="0,5"
+                                Background="{TemplateBinding Background}"
+                                BorderBrush="{TemplateBinding BorderBrush}"
+                                BorderThickness="0">
+                            <GridViewRowPresenter Content="{TemplateBinding Content}"
+                                                  Columns="{TemplateBinding GridView.ColumnCollection}" />
+                        </Border>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsSelected"
+                                     Value="true">
+                                <Setter Property="Background"
+                                        TargetName="Bd"
+                                        Value="#F6F6F6" />
+                            </Trigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+
+            <!--隔行变色-->
+            <Style.Triggers>
+                <MultiTrigger>
+                    <MultiTrigger.Conditions>
+                        <Condition Property="ItemsControl.AlternationIndex"
+                                   Value="1" />
+                    </MultiTrigger.Conditions>
+                    <Setter Property="Background"
+                            Value="#F6F8FA" />
+                </MultiTrigger>
+            </Style.Triggers>
+        </Style>
+        <!--列头样式定义-->
+        <Style x:Key="ListViewHeaderPatientList"
+               TargetType="{x:Type GridViewColumnHeader}">
+            <Setter Property="OverridesDefaultStyle"
+                    Value="True" />
+            <Setter Property="FontSize"
+                    Value="14" />
+
+            <Setter Property="Foreground"
+                    Value="#3E4A58" />
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
+                        <Grid Name="gird"
+                              Height="36"
+                              Margin="1,0">
+                            <Grid.Background>
+                                <SolidColorBrush Color="#F9F2E9" />
+                            </Grid.Background>
+                            <Border Name="bd"
+                                    CornerRadius="4"
+                                    Padding="{TemplateBinding Padding}">
+                                <ContentPresenter  HorizontalAlignment="Center"
+                                                   VerticalAlignment="Center" />
+                            </Border>
+                            <!--<Thumb Name="PART_HeaderGripper" Template="{StaticResource ThumbColumnHeaderSpliter}" HorizontalAlignment="Right" Margin="0,0,-1,0"/>-->
+                        </Grid>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsMouseOver"
+                                     Value="True">
+                                <Setter TargetName="gird"
+                                        Property="Background">
+                                    <Setter.Value>
+                                        <SolidColorBrush Color="#F7F6F6" />
+                                    </Setter.Value>
+                                </Setter>
+                            </Trigger>
+
+
+                            <Trigger Property="IsPressed"
+                                     Value="True">
+                                <Setter TargetName="gird"
+                                        Property="Background">
+                                    <Setter.Value>
+                                        <SolidColorBrush Color="#F7F6F6" />
+                                    </Setter.Value>
+                                </Setter>
+                            </Trigger>
+
+
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition />
+        </Grid.RowDefinitions>
+        <StackPanel Orientation="Horizontal"
+                    Height="50"
+                    Margin="5,20,5,5"
+                    Grid.Row="0">
+            <Border Style="{StaticResource textborder}"
+                 >
+                <TextBlock Text="开始时间"
+                           Margin="10,0,10,5"
+                           FontSize="22" />
+                </Border>
+            <DatePicker  FontSize="14"
+                         Margin="20,5,70,0"
+                         BorderThickness="0">
+                <DatePicker.RenderTransform>
+                    <ScaleTransform ScaleX="1.6"
+                                    ScaleY="1.6">
+                    </ScaleTransform>
+                </DatePicker.RenderTransform>
+            </DatePicker>
+            <Border Style="{StaticResource textborder}"
+                    Grid.Row="0">
+                <TextBlock Text="结束时间"
+                           Margin="10,0,10,5"
+                           FontSize="22" />
+            </Border>
+            <DatePicker  FontSize="14"
+                         BorderThickness="0"
+                         Margin="20,5,70,0">
+                <DatePicker.RenderTransform>
+                    <ScaleTransform ScaleX="1.6"
+                                    ScaleY="1.6">
+                    </ScaleTransform>
+                </DatePicker.RenderTransform>
+            </DatePicker>
+            <Border Style="{StaticResource buttonborder}">
+
+                <Button Content="查询"
+                        VerticalAlignment="Top" 
+                        Padding="30,5,30,5"
+                        BorderBrush="Transparent"
+                        FontSize="20"
+                        WindowChrome.IsHitTestVisibleInChrome="True"
+                        Background="Transparent" />
+            </Border>
+        </StackPanel>
+        <Grid Grid.Row="1">
+
+            <ListView
+                      x:Name="LVPatients"
+                      Margin="36,18,36,0"
+                      ItemContainerStyle="{StaticResource ResourceKey=ListViewItemContainerStylePatientList}"
+                      AlternationCount="2"
+                      BorderThickness="0">
+
+                <ListView.View>
+                    <GridView x:Name="pList"
+                              ColumnHeaderContainerStyle="{StaticResource ResourceKey=ListViewHeaderPatientList}">
+                        <GridViewColumn Header="序号"
+                                        DisplayMemberBinding="{Binding NAME}"
+                                        Width="100" />
+                        <GridViewColumn Header="创建日期"
+                                        DisplayMemberBinding="{Binding GENDER}"
+                                        Width="165" />
+                        <GridViewColumn Header="登录账号"
+                                        DisplayMemberBinding="{Binding AGE}"
+                                        Width="160" />
+                        <GridViewColumn Header="病例号"
+                                        DisplayMemberBinding="{Binding PATIENTSNO}"
+                                        Width="200" />
+                        <GridViewColumn Header="病例信息"
+                                        DisplayMemberBinding="{Binding TREATTYPE}"
+                                        Width="400" />
+                        <GridViewColumn Header="状态"
+                                        DisplayMemberBinding="{Binding BEDNO}"
+                                        Width="100" />
+                        <GridViewColumn Header="完成时间"
+                                        DisplayMemberBinding="{Binding DEPTNAME}"
+                                        Width="200" />
+                    </GridView>
+                </ListView.View>
+            </ListView>
+
+
+
+        </Grid>
+    </Grid>
+</UserControl>

+ 15 - 0
Views/ProductView.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// ProductView.xaml 的交互逻辑
+    /// </summary>
+    public partial class ProductView : UserControl
+    {
+        public ProductView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 347 - 0
Views/RoleLoginView.xaml

@@ -0,0 +1,347 @@
+<Window x:Class="LampInspectionMachine.Views.RoleLoginView"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:LampInspectionMachine.Views"
+        xmlns:prism="http://prismlibrary.com/"
+        prism:ViewModelLocator.AutoWireViewModel="True"
+        xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+        mc:Ignorable="d"
+        FontFamily="微软雅黑"
+        WindowStyle="None"
+        Title="RoleLoginView" Height="360" Width="650">
+    <WindowChrome.WindowChrome>
+        <WindowChrome GlassFrameThickness="50"
+                      CaptionHeight="30"
+                      NonClientFrameEdges="Left,Bottom,Right"
+                      CornerRadius="20" />
+    </WindowChrome.WindowChrome>
+    <Window.Resources>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="Transparent" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="1"
+                                      ShadowDepth="0.5"
+                                      Color="#2961AC" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <!--ComboBox-->
+        <!--ComBoBox项选中背景色-->
+        <SolidColorBrush x:Key="ComboBoxSelectdBackground"
+                         Color="#ff8c69" />
+        <!--ComBoBox项鼠标经过背景色-->
+        <SolidColorBrush x:Key="ComboBoxMouseOverBackground"
+                         Color="#ff3030" />
+        <!--ComBoBox项选中前景色-->
+        <SolidColorBrush x:Key="ComboBoxSelectedForeground"
+                         Color="White" />
+        <!--ComBoBox项鼠标经过前景色-->
+        <SolidColorBrush x:Key="ComboBoxMouseOverForegrond"
+                         Color="White" />
+        <ControlTemplate x:Key="ComboBoxToggleButton"
+                         TargetType="{x:Type ToggleButton}">
+            <Grid Height="25"
+                  HorizontalAlignment="Stretch">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*" />
+                    <ColumnDefinition Width="30" />
+                </Grid.ColumnDefinitions>
+                <Border  Background="White"
+                         Grid.ColumnSpan="2"
+                         Opacity="0" />
+                <Path x:Name="Arrow"
+                      Grid.Column="1"
+                      Data="M 0 0  6 6 12 0 Z"
+                      VerticalAlignment="Center"
+                      HorizontalAlignment="Center"
+                      Stretch="None"
+                      Fill="#999" />
+            </Grid>
+            <ControlTemplate.Triggers>
+                <Trigger Property="IsChecked"
+                         Value="true">
+                    <Setter TargetName="Arrow"
+                            Property="RenderTransform">
+                        <Setter.Value>
+                            <RotateTransform   CenterX="6"
+                                               CenterY="3"
+                                               Angle="180"></RotateTransform>
+                        </Setter.Value>
+                    </Setter>
+                    <Setter TargetName="Arrow"
+                            Property="Margin"
+                            Value="0 0 0 2" />
+                </Trigger>
+            </ControlTemplate.Triggers>
+        </ControlTemplate>
+        <Style TargetType="{x:Type ComboBox}">
+            <Setter Property="ItemContainerStyle">
+                <Setter.Value>
+                    <Style TargetType="ComboBoxItem">
+                        <Setter Property="Height"
+                                Value="20" />
+                        <Setter Property="Template">
+                            <Setter.Value>
+                                <ControlTemplate  TargetType="{x:Type ComboBoxItem}">
+                                    <Grid Height="{TemplateBinding Height}"
+                                          Width="{TemplateBinding Width}">
+                                        <Border x:Name="_borderbg"
+                                                Background="Transparent" />
+                                        <TextBlock Margin="3 0 3 0"
+                                                   VerticalAlignment="Center"
+                                                   x:Name="_txt"
+                                                   Foreground="#333"
+                                                   Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}" />
+                                        <Border x:Name="_border"
+                                                Background="White"
+                                                Opacity="0" />
+                                    </Grid>
+                                    <ControlTemplate.Triggers>
+                                        <Trigger Property="IsSelected"
+                                                 Value="true">
+                                            <Setter TargetName="_borderbg"
+                                                    Property="Background"
+                                                    Value="{StaticResource ComboBoxSelectdBackground}" />
+                                            <Setter TargetName="_txt"
+                                                    Property="Foreground"
+                                                    Value="{StaticResource ComboBoxSelectedForeground}" />
+                                        </Trigger>
+                                        <MultiTrigger>
+                                            <MultiTrigger.Conditions>
+                                                <Condition Property="IsSelected"
+                                                           Value="false" />
+                                                <Condition Property="IsMouseOver"
+                                                           Value="true" />
+                                            </MultiTrigger.Conditions>
+                                            <Setter TargetName="_borderbg"
+                                                    Property="Background"
+                                                    Value="{StaticResource ComboBoxMouseOverBackground}" />
+                                            <Setter TargetName="_txt"
+                                                    Property="Foreground"
+                                                    Value="{StaticResource ComboBoxMouseOverForegrond}" />
+                                        </MultiTrigger>
+
+                                    </ControlTemplate.Triggers>
+                                </ControlTemplate>
+                            </Setter.Value>
+                        </Setter>
+                    </Style>
+                </Setter.Value>
+            </Setter>
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type ComboBox}">
+                        <Grid>
+
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="0.7*" />
+                                <ColumnDefinition Width="0.3*"
+                                                  MaxWidth="30" />
+                            </Grid.ColumnDefinitions>
+                            <Border  Grid.Column="0"
+                                     Grid.ColumnSpan="2"
+                                     BorderThickness="1"
+                                     BorderBrush="{TemplateBinding BorderBrush}"
+                                     CornerRadius="1,0,0,1" />
+                            <ContentPresenter HorizontalAlignment="Left"
+                                              Margin="3,3,0,3"
+                                              x:Name="ContentSite"
+                                              VerticalAlignment="Center"
+                                              Content="{TemplateBinding SelectionBoxItem}"
+                                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
+                                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
+                                              IsHitTestVisible="False" />
+
+                            <!--ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen-->
+                            <ToggleButton Grid.Column="0"
+                                          Grid.ColumnSpan="2"
+                                          Template="{StaticResource ComboBoxToggleButton}"
+                                          x:Name="ToggleButton"
+                                          Focusable="false"
+                                          IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
+                                          ClickMode="Press" />
+                            <!--必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它-->
+                            <TextBox   Visibility="Hidden"
+                                       BorderThickness="0"
+                                       Margin="2 0 0 0"
+                                       x:Name="PART_EditableTextBox"
+                                       VerticalAlignment="Center"
+                                       Focusable="True"
+                                       Background="Transparent"
+                                       IsReadOnly="{TemplateBinding IsReadOnly}" />
+
+                            <!--Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen-->
+                            <Popup IsOpen="{TemplateBinding IsDropDownOpen}"
+                                   Placement="Bottom"
+                                   x:Name="Popup"
+                                   Focusable="False"
+                                   AllowsTransparency="True"
+                                   PopupAnimation="Slide">
+                                <Grid MaxHeight="150"
+                                      MinWidth="{TemplateBinding ActualWidth}"
+                                      x:Name="DropDown"
+                                      SnapsToDevicePixels="True">
+                                    <Border x:Name="DropDownBorder"
+                                            BorderBrush="#e8e8e8"
+                                            BorderThickness="1 0 1 1" />
+                                    <ScrollViewer Margin="1"
+                                                  SnapsToDevicePixels="True"
+                                                  HorizontalScrollBarVisibility="Auto"
+                                                  VerticalScrollBarVisibility="Auto"
+                                                  CanContentScroll="True">
+                                        <!--StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True-->
+                                        <StackPanel IsItemsHost="True"
+                                                    KeyboardNavigation.DirectionalNavigation="Contained"
+                                                    Background="White" />
+                                    </ScrollViewer>
+                                </Grid>
+                            </Popup>
+                        </Grid>
+                        <ControlTemplate.Triggers>
+                            <Trigger Property="IsEditable"
+                                     Value="true">
+                                <Setter TargetName="PART_EditableTextBox"
+                                        Property="Visibility"
+                                        Value="Visible" />
+                            </Trigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </Window.Resources>
+    <Grid Background="Transparent">
+        <Border BorderBrush="AliceBlue" BorderThickness="2" Margin="10" CornerRadius="10">
+            <Border.Background>
+                <LinearGradientBrush>
+                    <GradientStop Color="#95DDFD"
+                                  Offset="0" />
+                    <GradientStop Color="#97B8FF"
+                                  Offset="0.4" />
+                    <GradientStop Color="#2961AC"
+                                  Offset="0.9" />
+                </LinearGradientBrush>
+            </Border.Background>
+            <Grid Background="White" Opacity="0.8">
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="60"/>
+                    <RowDefinition Height="Auto"/>
+                    <RowDefinition Height="Auto"/>
+                    <RowDefinition />
+                </Grid.RowDefinitions>
+                <Grid Grid.Row="0">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                    </Grid.ColumnDefinitions>
+                    <StackPanel Orientation="Horizontal" Grid.Column="0">
+                        <Ellipse Fill="#8A2BE1"
+                                 Width="50"
+                                 Height="50"
+                                 Stretch="Fill">
+                        </Ellipse>
+                        <TextBlock Text="灯检"
+                                   Foreground="Black"
+                                   FontSize="25"
+                                   Margin="10"
+                                   FontWeight="Bold" />
+                    </StackPanel>
+                    <TextBlock Text="Login" Grid.Column="0"
+                               HorizontalAlignment="Left"
+                               Margin="5"
+                               VerticalAlignment="Center"
+                               FontSize="14" />
+                    <StackPanel Grid.Column="1" HorizontalAlignment="Right">
+                        <Border Style="{StaticResource buttonborder}">
+
+                            <Button Content="关闭"
+                                    VerticalAlignment="Top"
+                                    Foreground="Black"
+                                    Padding="5"
+                                    MinWidth="50"
+                                    BorderBrush="Transparent"
+                                    FontSize="15"
+                                    Click="Button_Click"
+                                    WindowChrome.IsHitTestVisibleInChrome="True"
+                                    Background="Transparent" />
+                        </Border>
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">
+                    <StackPanel>
+                        <TextBlock Text="登录"
+                                   Foreground="Black"
+                                   FontSize="25"
+                                   FontWeight="Bold" />
+                        <TextBlock Text="Sign in"
+                                   Foreground="Black"
+                                   FontSize="25"
+                                   Margin="0,0,0,10"
+                                   FontWeight="Bold" />
+                        <ComboBox x:Name="combox"
+                                  Width="180"
+                                  Height="30"
+                                  SelectedItem="{Binding CurrRole}"
+                                  ItemsSource="{Binding RolesList}"/>
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="2">
+                    <StackPanel VerticalAlignment="Bottom"
+                                HorizontalAlignment="Center"
+                               >
+           
+                        <PasswordBox x:Name="PasswordBox"
+                                         Margin="5,20,5,5"
+                                         Width="180"
+                                     Height="30"
+                                     VerticalContentAlignment="Bottom"
+                                     FontSize="20"
+                                     FontWeight="Thin">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="PasswordChanged">
+                                    <i:InvokeCommandAction Command="{Binding PasswordChangedCommand}"
+                                                           CommandParameter="{Binding ElementName=PasswordBox}" />
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </PasswordBox>
+                       
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="3">
+                    
+                    <StackPanel HorizontalAlignment="Stretch"  VerticalAlignment="Center" Width="180">
+                        <TextBlock  TextAlignment="Center"
+                                    Background="{ Binding L_Brush}"
+                                    Text="{Binding Loginstr}" FontSize="12" FontWeight="Bold" FontFamily="微软雅黑" Margin="50,0,50,10"/>
+                        <Border Background="#0A85D9"  BorderBrush="Black" BorderThickness="1" CornerRadius="8">
+                            <Button Content="登录"
+                                    Name="loginbtu"
+                                    Background="Transparent"
+                                    FontSize="20"
+                                    Foreground="White"
+                                    Margin="5"
+                                    BorderThickness="0"
+                                    Command="{Binding LogoutCommand}"
+                                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"/>
+                        </Border>
+                    </StackPanel>
+                </Grid>
+
+            </Grid>
+        </Border>
+    </Grid>
+</Window>

+ 20 - 0
Views/RoleLoginView.xaml.cs

@@ -0,0 +1,20 @@
+using System.Windows;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// RoleLoginView.xaml 的交互逻辑
+    /// </summary>
+    public partial class RoleLoginView : Window
+    {
+        public RoleLoginView()
+        {
+            InitializeComponent();
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 303 - 0
Views/SettingView.xaml

@@ -0,0 +1,303 @@
+<UserControl x:Class="LampInspectionMachine.Views.SettingView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:LampInspectionMachine.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d"
+             d:DesignHeight="700"
+             d:DesignWidth="1000">
+    <UserControl.Resources>
+        <Style x:Key="textborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="#548CC5" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="#7DB1EC" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="White" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style x:Key="buttonborder"
+               TargetType="Border">
+            <Setter Property="BorderThickness"
+                    Value="2" />
+            <Setter Property="Background"
+                    Value="Transparent" />
+            <Setter Property="VerticalAlignment"
+                    Value="Center" />
+            <Setter Property="BorderBrush"
+                    Value="White" />
+            <Setter Property="CornerRadius"
+                    Value="5" />
+            <Setter Property="Effect">
+                <Setter.Value>
+                    <DropShadowEffect BlurRadius="10"
+                                      Direction="0"
+                                      ShadowDepth="0"
+                                      Color="#D4D8DD" />
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </UserControl.Resources>
+    <Grid Margin="20">
+        <Grid>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="Auto" />
+                <RowDefinition Height="Auto" />
+                <RowDefinition Height="*" />
+
+            </Grid.RowDefinitions>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition />
+                <ColumnDefinition />
+            </Grid.ColumnDefinitions>
+            <StackPanel Grid.Row="0"
+                        Grid.Column="0">
+                <Border Style="{StaticResource textborder}"
+                        Grid.Row="0">
+                    <TextBlock Text="通讯设置"
+                               Margin="15,5,5,5"
+                               FontSize="25" />
+                </Border>
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+                    <StackPanel Margin="10"
+                                Grid.Row="0"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center">
+                        <TextBlock  Text="扫码枪:"
+                                    Margin="5,5,5,5"
+                                    FontSize="20"
+                                    FontWeight="Bold"/>
+                        <TextBox Text="{Binding SettingModel.CodePortName}"
+                                 Width="280"
+                                 FontSize="20"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                        <TextBox Text="{Binding SettingModel.BaudRateToCode}"
+                                 Margin="10,0,0,0"
+                                 Width="100"
+                                 FontSize="20"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                    </StackPanel>
+
+                    <StackPanel Grid.Row="1"
+                                Margin="10"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center">
+                        <TextBlock  Text="读卡器:"
+                                    Margin="5,5,5,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.CardPortName}"
+                                 FontSize="20"
+                                 Width="280"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                        <TextBox Text="{Binding SettingModel.BaudRateToCard}"
+                                 Margin="10,0,0,0"
+                                 Width="100"
+                                 FontSize="20"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                    </StackPanel>
+                    <StackPanel Grid.Row="2"
+                                Margin="10"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center">
+                        <TextBlock  Text="IO模块:"
+                                    Margin="5,5,5,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.ModbusIp}"
+                                 FontSize="20"
+                                 Width="280"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                        <TextBox Text="{Binding SettingModel.ModbuePost}"
+                                 Margin="10,0,0,0"
+                                 Width="100"
+                                 FontSize="20"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                    </StackPanel>
+                </Grid>
+            </StackPanel>
+            <StackPanel Grid.Row="0"
+                        Margin="10,0,0,0"
+                        Grid.Column="1">
+                <Border Style="{StaticResource textborder}"
+                        Grid.Row="0">
+                    <TextBlock Text="其它设置"
+                               Margin="15,5,5,5"
+                               FontSize="25" />
+                </Border>
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+                    <StackPanel Margin="10"
+                                Grid.Row="0"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center">
+                        <TextBlock  Text="双色灯闪烁时长:"
+                                    Margin="5,5,5,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.ArmLedTime}"
+                                 Width="300"
+                                 FontSize="20"
+                                 ToolTip="s"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                    </StackPanel>
+
+                    <StackPanel Grid.Row="1"
+                                Margin="10"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center">
+                        <TextBlock  Text="滚筒空转时间:"
+                                    Margin="5,5,25,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.IdleTime}"
+                                 FontSize="20"
+                                 Width="300"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                    </StackPanel>
+                    <StackPanel Grid.Row="2"
+                                Margin="10"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center">
+                        <TextBlock  Text="单次出料数量:"
+                                    Margin="5,5,25,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.SingleOutPut}"
+                                 FontSize="20"
+                                 Width="300"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                    </StackPanel>
+                    <StackPanel Grid.Row="3"
+                                Margin="10"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center">
+                        <TextBlock  Text="设备编号:"
+                                    Margin="5,5,25,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.DeviceId}"
+                                 FontSize="20"
+                                 Width="300"
+                                 HorizontalContentAlignment="Center"
+                                 VerticalContentAlignment="Center" />
+                    </StackPanel>
+                </Grid>
+            </StackPanel>
+            <StackPanel Grid.Row="1"
+                        Grid.Column="0">
+                <Border Style="{StaticResource textborder}"
+                        Grid.Row="0">
+                    <TextBlock Text="MES通讯地址"
+                               Margin="15,5,5,5"
+                               FontSize="25" />
+                </Border>
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+                    <StackPanel Grid.Row="0"
+                                Margin="10">
+                        <TextBlock  Text="刷卡登录:"
+                                    Margin="5,5,5,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.LoginIP}"
+                                 FontSize="20" />
+                    </StackPanel>
+
+                    <StackPanel Grid.Row="1"
+                                Margin="10">
+                        <TextBlock  Text="获取物料:"
+                                    Margin="5,5,5,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.MaterialIP}"
+                                 FontSize="20" />
+                    </StackPanel>
+                    <StackPanel Grid.Row="2"
+                                Margin="10">
+                        <TextBlock  Text="扫码获取订单:"
+                                    Margin="5,5,5,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.CaseIP}"
+                                 FontSize="20" />
+                    </StackPanel>
+
+                    <StackPanel Grid.Row="3"
+                                Margin="10">
+                        <TextBlock  Text="后台上传:"
+                                    Margin="5,5,5,5"
+                                    FontSize="20"
+                                    FontWeight="Bold" />
+                        <TextBox Text="{Binding SettingModel.UpLoad}"
+                                 FontSize="20" />
+                    </StackPanel>
+                </Grid>
+            </StackPanel>
+
+            <StackPanel Grid.Row="2"
+                        Margin="30"
+                        VerticalAlignment="Bottom" HorizontalAlignment="Center"
+                        Grid.Column="0" Grid.ColumnSpan="2">
+                <Border Style="{StaticResource buttonborder}">
+
+                    <Button Content="保存"
+                            VerticalAlignment="Top"
+                            Command="{Binding SaveSettingsCommand}"
+                            Padding="20,5,20,5"
+                            BorderBrush="Transparent"
+                            FontSize="15"
+                            WindowChrome.IsHitTestVisibleInChrome="True"
+                            Background="Transparent" />
+
+                </Border>
+            </StackPanel>
+        </Grid>
+    </Grid>
+</UserControl>

+ 15 - 0
Views/SettingView.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// SettingView.xaml 的交互逻辑
+    /// </summary>
+    public partial class SettingView : UserControl
+    {
+        public SettingView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 20 - 0
Views/VisionProView.xaml

@@ -0,0 +1,20 @@
+<UserControl x:Class="LampInspectionMachine.Views.VisionProView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:cognexWF="clr-namespace:Cognex.VisionPro;assembly=Cognex.VisionPro.Controls"
+             xmlns:cognexWF1="clr-namespace:Cognex.VisionPro.ToolGroup;assembly=Cognex.VisionPro.ToolGroup.Controls"
+             xmlns:wf="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
+             xmlns:Viewlocal="clr-namespace:LampInspectionMachine.ViewModels"
+             xmlns:local="clr-namespace:LampInspectionMachine.Views"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+        <DockPanel >
+            <WindowsFormsHost>
+                <cognexWF1:CogToolGroupEditV2 x:Name="cogToolBlock" />
+            </WindowsFormsHost>
+        </DockPanel>
+    </Grid>
+</UserControl>

+ 40 - 0
Views/VisionProView.xaml.cs

@@ -0,0 +1,40 @@
+using Cognex.VisionPro.ToolBlock;
+using Cognex.VisionPro;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using LampInspectionMachine.Core;
+using Prism.Ioc;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// VisionProView.xaml 的交互逻辑
+    /// </summary>
+    public partial class VisionProView : UserControl
+    {
+        private Management management;
+        public VisionProView(IContainerProvider container)
+        {
+            InitializeComponent();
+            management=container.Resolve<Management>();
+            management.ToolBlockSwitched += Management_ToolBlockSwitched;
+        }
+
+        private void Management_ToolBlockSwitched(int obj)
+        {
+            cogToolBlock.Subject = management.CamTemplateS[ obj ];
+        }
+    }
+}

+ 52 - 0
Views/WorkRunView.xaml

@@ -0,0 +1,52 @@
+<UserControl x:Class="LampInspectionMachine.Views.WorkRunView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:LampInspectionMachine.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="1200">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="*"/>
+            <RowDefinition Height="Auto"/>
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition />
+            <ColumnDefinition Width="Auto"/>
+        </Grid.ColumnDefinitions>
+        
+        <Border  Grid.Row="1"
+                 Grid.Column="0"
+                 Margin="5"
+                 BorderBrush="#7AB0F0"
+                 BorderThickness="2"
+                 CornerRadius="5"
+                 Padding="1">
+         
+        </Border>
+        <Border  Grid.Row="1"
+                 Grid.Column="1"
+                 CornerRadius="5"
+                 Padding="1">
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="Auto"/>
+                    <RowDefinition />
+                </Grid.RowDefinitions>
+            
+                <Border Grid.Row="1"
+                        Margin="30"
+                        BorderBrush="#7AB0F0"
+                        BorderThickness="2">
+                    
+                </Border>
+
+            </Grid>
+        </Border>
+
+    </Grid>
+</UserControl>

+ 15 - 0
Views/WorkRunView.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace LampInspectionMachine.Views
+{
+    /// <summary>
+    /// WorkRunView.xaml 的交互逻辑
+    /// </summary>
+    public partial class WorkRunView : UserControl
+    {
+        public WorkRunView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 27 - 0
packages.config

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="EntityFramework" version="6.4.4" targetFramework="net48" />
+  <package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.31" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+  <package id="OpenCvSharp4" version="4.10.0.20241108" targetFramework="net48" />
+  <package id="OpenCvSharp4.Extensions" version="4.10.0.20241108" targetFramework="net48" />
+  <package id="OpenCvSharp4.runtime.win" version="4.10.0.20241108" targetFramework="net48" />
+  <package id="Prism.Core" version="8.1.97" targetFramework="net48" />
+  <package id="Prism.Unity" version="8.1.97" targetFramework="net48" />
+  <package id="Prism.Wpf" version="8.1.97" targetFramework="net48" />
+  <package id="SqlSugar" version="5.1.4.188" targetFramework="net48" />
+  <package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net48" />
+  <package id="System.Data.SQLite" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Data.SQLite.EF6" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Data.SQLite.Linq" version="1.0.119.0" targetFramework="net48" />
+  <package id="System.Drawing.Common" version="8.0.0" targetFramework="net48" />
+  <package id="System.Memory" version="4.5.5" targetFramework="net48" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
+  <package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
+  <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" />
+</packages>