| | |
| | | using LB_SmartVision.Forms.Pages; |
| | | using LB_SmartVision.Forms.Pages.CameraPage; |
| | | using LB_SmartVision.Forms.Pages.CommunicatorPage; |
| | | using LB_SmartVision.Forms.Pages.HistoricalData; |
| | | using LB_SmartVision.Forms.Pages.MESPage; |
| | | using LB_SmartVision.Forms.Pages.MotionControlPage; |
| | | using LB_SmartVision.Forms.Pages.ProcessPage; |
| | |
| | | using LB_VisionProcesses; |
| | | using LB_VisionProcesses.Cameras; |
| | | using LB_VisionProcesses.Cameras.HRCameras; |
| | | using LB_VisionProcesses.Cameras.LBCameras; |
| | | using LB_VisionProcesses.Communicators; |
| | | using LB_VisionProcesses.Communicators.TCom; |
| | | using LB_VisionProcesses.Forms; |
| | |
| | | { |
| | | public partial class VisionForm : Form |
| | | { |
| | | AllProcessesPage AllProcessesPage = new AllProcessesPage(); |
| | | AllProcessesPage AllProcessesPages = new AllProcessesPage(); |
| | | CamerasEditPage CamerasEditPage = new CamerasEditPage(); |
| | | HistoricalDataEditPage HistoricalDataEditPage = new HistoricalDataEditPage(); |
| | | CommunicatorsEditPage CommunicatorsEditPage = new CommunicatorsEditPage(); |
| | | SettingEditPage SettingEditPage = new SettingEditPage(); |
| | | MESEditPage MESEditPage = new MESEditPage(); |
| | |
| | | |
| | | //最开始就清空所有Tab页 |
| | | materialTabControl.TabPages.Clear(); |
| | | materialTabControl.Controls.Add(AllProcessesPage); |
| | | AllProcessesPages.controlsPanel.Dock = DockStyle.Fill; |
| | | materialTabControl.Controls.Add(AllProcessesPages); |
| | | |
| | | HistoricalDataEditPage.LogInfo += LogInfo; |
| | | materialTabControl.Controls.Add(new MyPage(HistoricalDataEditPage)); |
| | | |
| | | CamerasEditPage.LogInfo += LogInfo; |
| | | materialTabControl.Controls.Add(new MyPage(CamerasEditPage)); |
| | |
| | | { |
| | | //materialTabControl.TabPages[i].Font= new Font("Microsoft YaHei UI", 18F, FontStyle.Regular, GraphicsUnit.Point, 0); |
| | | } |
| | | |
| | | materialTabSelector.BaseTabControl = materialTabControl; |
| | | //materialTabSelector.Font = new Font("Microsoft YaHei UI", 18F, FontStyle.Regular, GraphicsUnit.Point, 0); |
| | | } |
| | |
| | | { |
| | | return; |
| | | } |
| | | string strInfo = DateTime.Now.ToString("[yyyy:MM:HH:mm:ss:fff] "); |
| | | string strInfo = DateTime.Now.ToString("[yyyy:MM:dd:HH:mm:ss:fff] "); |
| | | strInfo += strLog; |
| | | if (infoType != LogInfoType.NOSHOW) |
| | | { |
| | |
| | | switch (infoType) |
| | | { |
| | | case LogInfoType.INFO: |
| | | this.rich_Info.SelectionColor = Color.Wheat; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Wheat; |
| | | AsyncLogHelper.Info(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.WARN: |
| | | this.rich_Info.SelectionColor = Color.LightGoldenrodYellow; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Yellow; |
| | | AsyncLogHelper.Warn(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.PASS: |
| | | this.rich_Info.SelectionColor = Color.Green; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Green; |
| | | AsyncLogHelper.Info(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.ERROR: |
| | | this.rich_Info.SelectionColor = Color.Red; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Red; |
| | | AsyncLogHelper.Error(strLog); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // 更新 UI 控件,比如显示接收到的消息 |
| | | this.rich_Info.AppendText(strInfo); |
| | | this.rich_Info.AppendText("\r\n"); |
| | |
| | | { |
| | | |
| | | if (this.rich_Info.Lines.Length > 1000) |
| | | { |
| | | this.rich_Info.Clear(); |
| | | |
| | | } |
| | | // 如果已经在 UI 线程上,直接更新 UI |
| | | switch (infoType) |
| | | { |
| | | case LogInfoType.INFO: |
| | | this.rich_Info.SelectionColor = Color.Wheat; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Wheat; |
| | | AsyncLogHelper.Info(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.WARN: |
| | | this.rich_Info.SelectionColor = Color.Yellow; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Yellow; |
| | | AsyncLogHelper.Warn(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.PASS: |
| | | this.rich_Info.SelectionColor = Color.Green; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Green; |
| | | AsyncLogHelper.Info(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.ERROR: |
| | | this.rich_Info.SelectionColor = Color.Red; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Red; |
| | | AsyncLogHelper.Error(strLog); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | this.rich_Info.AppendText(strInfo); |
| | | this.rich_Info.AppendText("\r\n"); |
| | | this.rich_Info.SelectionStart = this.rich_Info.Text.Length; |
| | | this.rich_Info.ScrollToCaret(); |
| | | } |
| | | } |
| | | AsyncLogHelper.Info(strLog); |
| | | } |
| | | |
| | | public static bool SaveAllLayout() |
| | |
| | | { |
| | | XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config")); |
| | | string[] paths = { |
| | | @"生产日志\Run_Log", |
| | | @"生产日志\Debug_Log", |
| | | @"生产日志\Error_Log", |
| | | @"生产日志\Run", |
| | | @"生产日志\Debug", |
| | | @"生产日志\Error", |
| | | @"生产日志\Fatal", |
| | | @"生产日志\Warn", |
| | | }; |
| | |
| | | } |
| | | com_ProductName.Items.Add("新增"); |
| | | com_ProductName.Text = GlobalVar.strProductName; |
| | | this.WindowState = FormWindowState.Maximized; |
| | | } |
| | | |
| | | public void SaveAllSetting() |
| | |
| | | } |
| | | case CameraBrand.LBCamera: |
| | | { |
| | | //camera = new LBCamera(); |
| | | camera = new LBCamera(); |
| | | break; |
| | | } |
| | | default: |
| | |
| | | { |
| | | string title = layout.Title; |
| | | string strImagePath = layout.SaveImageDir; |
| | | if (!AllProcessesPage.dicProcessControls.ContainsKey(title)) |
| | | if (!AllProcessesPages.dicProcessControls.ContainsKey(title)) |
| | | { |
| | | continue; |
| | | } |
| | | RunBll.GetImage(layout, out InputImage, out RecordImage); |
| | | AllProcessesPage.dicProcessControls[title].ShowHoImage(RecordImage); |
| | | AllProcessesPages.dicProcessControls[title].ShowHoImage(RecordImage); |
| | | if (!string.IsNullOrEmpty(layout.SaveImageDir)) |
| | | { |
| | | string fileNameHead = layout.SaveImageHead; |