Compare commits
3 Commits
1444e6b948
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b14b23b05 | |||
| 8ef83ed848 | |||
| c287760071 |
84
精工涂胶检测项目/CVE.LogViewer/CVE.LogViewer.csproj
Normal file
84
精工涂胶检测项目/CVE.LogViewer/CVE.LogViewer.csproj
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<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>{766CF29F-3629-470A-AEC7-D2AEAD685484}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CVE.LogViewer</RootNamespace>
|
||||
<AssemblyName>CVE.LogViewer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataGridViewAppender.cs" />
|
||||
<Compile Include="Helper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="LogConfig.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
144
精工涂胶检测项目/CVE.LogViewer/DataGridViewAppender.cs
Normal file
144
精工涂胶检测项目/CVE.LogViewer/DataGridViewAppender.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using log4net.Appender;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CVE.LogViewer
|
||||
{
|
||||
class DataGridViewAppender : AppenderSkeleton
|
||||
{
|
||||
private DataGridView _dataGridView;
|
||||
public DataGridView AppenderControl
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dataGridView;
|
||||
}
|
||||
set
|
||||
{
|
||||
_dataGridView = value;
|
||||
}
|
||||
}
|
||||
public string FormName { get; set; }
|
||||
public string ListViewName { get; set; }
|
||||
/// <summary>
|
||||
/// 查找控件
|
||||
/// </summary>
|
||||
/// <param name="root"></param>
|
||||
/// <param name="ListViewName"></param>
|
||||
/// <returns></returns>
|
||||
private Control FindControlRecursive(Control root, string ListViewName)
|
||||
{
|
||||
if (root.Name == ListViewName) return root;
|
||||
foreach (Control c in root.Controls)
|
||||
{
|
||||
Control t = FindControlRecursive(c, ListViewName);
|
||||
if (t != null) return t;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示日志
|
||||
/// </summary>
|
||||
/// <param name="loggingEvent"></param>
|
||||
protected override void Append(log4net.Core.LoggingEvent loggingEvent)
|
||||
{
|
||||
//验证控件是否存在
|
||||
if (_dataGridView == null)
|
||||
{
|
||||
if (String.IsNullOrEmpty(FormName) ||
|
||||
String.IsNullOrEmpty(ListViewName))
|
||||
return;
|
||||
|
||||
Form form = Application.OpenForms[FormName];
|
||||
if (form == null)
|
||||
return;
|
||||
|
||||
_dataGridView = (DataGridView)FindControlRecursive(form, ListViewName);
|
||||
|
||||
_dataGridView.Invoke(new Action(() =>
|
||||
{
|
||||
_dataGridView.Rows.Clear();
|
||||
DataGridViewTextBoxColumn logInfo = new DataGridViewTextBoxColumn();
|
||||
logInfo.Name = "Log Info";
|
||||
logInfo.DataPropertyName = "Log Info";
|
||||
logInfo.HeaderText = "Log Info";
|
||||
_dataGridView.Columns.Add(logInfo);
|
||||
_dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
//设置自动换行
|
||||
_dataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
|
||||
//设置自动调整高度
|
||||
_dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
|
||||
_dataGridView.RowHeadersVisible = false;
|
||||
_dataGridView.ColumnHeadersVisible = false;
|
||||
_dataGridView.AllowDrop = false;
|
||||
_dataGridView.AllowUserToAddRows = false;
|
||||
_dataGridView.AllowUserToDeleteRows = false;
|
||||
_dataGridView.AllowUserToOrderColumns = false;
|
||||
_dataGridView.AllowUserToResizeColumns = false;
|
||||
_dataGridView.AllowUserToResizeRows = false;
|
||||
_dataGridView.MultiSelect = false;
|
||||
_dataGridView.ReadOnly = true;
|
||||
_dataGridView.CellBorderStyle = DataGridViewCellBorderStyle.None;
|
||||
if (_dataGridView == null)
|
||||
return;
|
||||
|
||||
form.FormClosing += (s, e) => _dataGridView = null;
|
||||
}));
|
||||
}
|
||||
if (!_dataGridView.IsHandleCreated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_dataGridView.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//显示日志
|
||||
string str = String.Format("{0} {1}", loggingEvent.TimeStamp.ToString("yyyy/MM/dd HH:mm:ss.fff"), RenderLoggingEvent(loggingEvent));
|
||||
string level = loggingEvent.Level.ToString();
|
||||
|
||||
_dataGridView.BeginInvoke((MethodInvoker)delegate
|
||||
{
|
||||
//日志行数控制
|
||||
if (_dataGridView.Rows.Count > 500)
|
||||
{
|
||||
//大于200行清空显示
|
||||
_dataGridView.Rows.Clear();
|
||||
}
|
||||
DataGridViewRow row = new DataGridViewRow();
|
||||
|
||||
DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
|
||||
cell.Value = str;
|
||||
//根据等级控制显示颜色
|
||||
switch (level)
|
||||
{
|
||||
case "DEBUG":
|
||||
cell.Style.ForeColor = Color.Blue; //DarkBlue;
|
||||
break;
|
||||
case "INFO":
|
||||
cell.Style.ForeColor = Color.Black; //ForestGreen;
|
||||
break;
|
||||
case "WARN":
|
||||
cell.Style.ForeColor = Color.Orange;
|
||||
break;
|
||||
case "ERROR":
|
||||
cell.Style.ForeColor = Color.MediumVioletRed;
|
||||
break;
|
||||
case "FATAL":
|
||||
cell.Style.ForeColor = Color.Red;
|
||||
break;
|
||||
}
|
||||
row.Cells.Add(cell);
|
||||
//控制每次显示最新行
|
||||
_dataGridView.Rows.Add(row);
|
||||
_dataGridView.FirstDisplayedScrollingRowIndex = _dataGridView.Rows.Count - 1;
|
||||
_dataGridView.ClearSelection();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
54
精工涂胶检测项目/CVE.LogViewer/Helper.cs
Normal file
54
精工涂胶检测项目/CVE.LogViewer/Helper.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
namespace CVE.LogViewer
|
||||
{
|
||||
public class Helper
|
||||
{
|
||||
private const string FileName = "LogConfig.xml";
|
||||
public Stream GetXMLStream(string ConfigDir)
|
||||
{
|
||||
if (!System.IO.Directory.Exists(ConfigDir))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(ConfigDir);//不存在就创建目录
|
||||
}
|
||||
|
||||
string ConfigPath = ConfigDir + "\\" + FileName;
|
||||
//判断本地是否存在配置文件
|
||||
if (File.Exists(ConfigPath))
|
||||
{
|
||||
//导入本地配置文件
|
||||
Stream stream = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read);
|
||||
return stream;
|
||||
}
|
||||
else
|
||||
{
|
||||
//载入程序集中配置文件
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var stream = assembly.GetManifestResourceStream(this.GetType(), FileName);
|
||||
try
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new FileNotFoundException("Could not find embedded mappings resource file.", FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
//将默认配置文件保存至指定目录
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(stream);
|
||||
doc.Save(ConfigPath);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
42
精工涂胶检测项目/CVE.LogViewer/LogConfig.xml
Normal file
42
精工涂胶检测项目/CVE.LogViewer/LogConfig.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
|
||||
</configSections>
|
||||
<log4net>
|
||||
<root>
|
||||
<level value="ALL"/>
|
||||
<!---日志级别 从低到高 ALL DEBUG INFO WARN ERROR FATAL None-->
|
||||
<appender-ref ref="RollingLogFileAppender"/>
|
||||
<appender-ref ref="DataGridViewAppender" />
|
||||
</root>
|
||||
<!-- name属性指定其名称,type则是log4net.Appender命名空间的一个类的名称,意思是指定使用哪种介质-->
|
||||
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<file value="Log\\"/>
|
||||
<!-- 输出到什么目录-->
|
||||
<appendToFile value="true"/>
|
||||
<!-- 是否到附加到文件中-->
|
||||
<rollingStyle value="Date"/>
|
||||
<!-- 文件创建方式,以日期的方式记录-->
|
||||
<datePattern value="'Log_'yyyy-MM-dd".txt""/>
|
||||
<!-- 文件格式-->
|
||||
<staticLogFileName value="false"/>
|
||||
<!--否采用静态文件名,文件名是否唯一-->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!---日志内容布局-->
|
||||
<param name="ConversionPattern" value="%date %-5level %message%newline"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<!---listView日志显示-->
|
||||
<appender name="DataGridViewAppender" type="CVE.LogViewer.DataGridViewAppender, CVE.LogViewer">
|
||||
<formName value="FrmMain"/>
|
||||
<listViewName value="dgv_Log"/>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="- %message" />
|
||||
</layout>
|
||||
</appender>
|
||||
</log4net>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
36
精工涂胶检测项目/CVE.LogViewer/Properties/AssemblyInfo.cs
Normal file
36
精工涂胶检测项目/CVE.LogViewer/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("CVE.LogViewer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CVE.LogViewer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("766cf29f-3629-470a-aec7-d2aead685484")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
32444
精工涂胶检测项目/CVE.LogViewer/lib/log4net.xml
Normal file
32444
精工涂胶检测项目/CVE.LogViewer/lib/log4net.xml
Normal file
File diff suppressed because it is too large
Load Diff
4
精工涂胶检测项目/CVE.LogViewer/packages.config
Normal file
4
精工涂胶检测项目/CVE.LogViewer/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net471" />
|
||||
</packages>
|
||||
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.14.36109.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "精工涂胶检测项目", "精工涂胶检测项目\精工涂胶检测项目.csproj", "{10C424D2-36A1-4D94-A034-A6801A1B17B5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CVE.LogViewer", "CVE.LogViewer\CVE.LogViewer.csproj", "{766CF29F-3629-470A-AEC7-D2AEAD685484}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -27,6 +29,18 @@ Global
|
||||
{10C424D2-36A1-4D94-A034-A6801A1B17B5}.Release|x64.Build.0 = Release|x64
|
||||
{10C424D2-36A1-4D94-A034-A6801A1B17B5}.Release|x86.ActiveCfg = Release|x86
|
||||
{10C424D2-36A1-4D94-A034-A6801A1B17B5}.Release|x86.Build.0 = Release|x86
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Debug|x64.Build.0 = Debug|x64
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Release|x64.ActiveCfg = Release|x64
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Release|x64.Build.0 = Release|x64
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{766CF29F-3629-470A-AEC7-D2AEAD685484}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace 精工涂胶检测项目
|
||||
try
|
||||
{
|
||||
// 获取主窗体的 TCP 实例
|
||||
var mainForm = Application.OpenForms.OfType<Form1>().FirstOrDefault();
|
||||
var mainForm = Application.OpenForms.OfType<FrmMain>().FirstOrDefault();
|
||||
if (mainForm == null) return;
|
||||
|
||||
TCPClass tcp = mainForm.myTcp; // ✅ 使用同一实例
|
||||
@@ -53,7 +53,7 @@ namespace 精工涂胶检测项目
|
||||
|
||||
private async void btn_PLCConfirm_Click(object sender, EventArgs e)
|
||||
{
|
||||
var mainForm = Application.OpenForms.OfType<Form1>().FirstOrDefault();
|
||||
var mainForm = Application.OpenForms.OfType<FrmMain>().FirstOrDefault();
|
||||
if (mainForm == null)
|
||||
{
|
||||
MessageBox.Show("无法找到主窗体");
|
||||
@@ -76,7 +76,7 @@ namespace 精工涂胶检测项目
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mainForm.AddLog($"PLC连接失败: {ex.Message}", 2);
|
||||
//mainForm.AddLog($"PLC连接失败: {ex.Message}", 2);
|
||||
MessageBox.Show($"PLC连接失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace 精工涂胶检测项目
|
||||
private void FormCommunication_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
// 获取主窗体的 TCP 实例
|
||||
var mainForm = Application.OpenForms.OfType<Form1>().FirstOrDefault();
|
||||
var mainForm = Application.OpenForms.OfType<FrmMain>().FirstOrDefault();
|
||||
if (mainForm == null) return;
|
||||
|
||||
TCPClass tcp = mainForm.myTcp; // ✅ 使用同一实例
|
||||
@@ -132,7 +132,7 @@ namespace 精工涂胶检测项目
|
||||
}
|
||||
|
||||
// 获取主窗体实例并更新配置
|
||||
var mainForm = Application.OpenForms.OfType<Form1>().FirstOrDefault();
|
||||
var mainForm = Application.OpenForms.OfType<FrmMain>().FirstOrDefault();
|
||||
if (mainForm != null)
|
||||
{
|
||||
mainForm.modbusClient = new ModbusTcpClient(txb_ModbusTcpIP.Text, port);
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace 精工涂胶检测项目
|
||||
{
|
||||
public int Status = 0;
|
||||
public string account;
|
||||
private Form1 formMain;
|
||||
public FormLogin(Form1 formMain1)
|
||||
private FrmMain formMain;
|
||||
public FormLogin(FrmMain formMain1)
|
||||
{
|
||||
InitializeComponent();
|
||||
formMain = formMain1;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -117,12 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="btn_LoadImage.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="btn_ManulTrigger.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>252, 17</value>
|
||||
</metadata>
|
||||
@@ -134,7 +128,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAw
|
||||
CQAAAk1TRnQBSQFMAgEBAwEAAUABAgFAAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CQAAAk1TRnQBSQFMAgEBAwEAAWgBAgFoAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
@@ -176,15 +170,12 @@
|
||||
AX8B8AEHAgAE/wH+AT8CAAs=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="btn_Auto.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="cogRecordDisplay1.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAtwAAAAIB
|
||||
AAAAAQAAAAAAAAAAAAAAAKIAAAAAAQAAiRIAAH4bAAATAAAAAAALAP//CwD//wsA//8DAAAAAAADAAEA
|
||||
AAAAAQAAAAAAAAAAAAAAAKIAAAAAAQAAHB8AAHAyAAATAAAAAAALAP//CwD//wsA//8DAAAAAAADAAEA
|
||||
AAAFAAAAAAAAAAAABQAAAAAAAAAAAAUAAAAAAAAA8D8TAAAA/wALAP//CwD//xMAAIAAAAMAAwAAAAsA
|
||||
//8LAAAAAAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8BAAAAAQAAAAsA//8LAAAACwAAAAsA
|
||||
//8L
|
||||
@@ -19,14 +19,14 @@ namespace 精工涂胶检测项目
|
||||
|
||||
private void FormVPP_Load(object sender, EventArgs e)
|
||||
{
|
||||
var mainForm = Application.OpenForms.OfType<Form1>().FirstOrDefault();
|
||||
var mainForm = Application.OpenForms.OfType<FrmMain>().FirstOrDefault();
|
||||
if (mainForm == null) return;
|
||||
cogJobManagerEdit1.Subject = mainForm.myJobManager;
|
||||
}
|
||||
|
||||
private void FormVPP_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
var mainForm = Application.OpenForms.OfType<Form1>().FirstOrDefault();
|
||||
var mainForm = Application.OpenForms.OfType<FrmMain>().FirstOrDefault();
|
||||
if (mainForm == null) return;
|
||||
mainForm.myJobManager = cogJobManagerEdit1.Subject;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace 精工涂胶检测项目
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form_LoadingImage());
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new FrmMain());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,13 +194,13 @@ namespace 精工涂胶检测项目
|
||||
#region 客户端功能
|
||||
public async Task ConnectAsync(string ip, int port)
|
||||
{
|
||||
var mainForm = Application.OpenForms.OfType<Form1>().FirstOrDefault();
|
||||
var mainForm = Application.OpenForms.OfType<FrmMain>().FirstOrDefault();
|
||||
if (mainForm == null) return;
|
||||
|
||||
_tcpStatus = "Client";
|
||||
_client = new TcpClient();
|
||||
await _client.ConnectAsync(ip, port);
|
||||
mainForm.AddLog($"客户端已连接,主机IP:{ip},主机端口:{port}", 0);
|
||||
//mainForm.AddLog($"客户端已连接,主机IP:{ip},主机端口:{port}", 0);
|
||||
_clientStream = _client.GetStream();
|
||||
_ = ReceiveDataAsync();
|
||||
}
|
||||
|
||||
@@ -396,6 +396,10 @@
|
||||
<Reference Include="HslCommunication, Version=12.3.1.0, Culture=neutral, PublicKeyToken=3d72ad3b6b5ec0e3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\HslCommunication.12.3.1\lib\net451\HslCommunication.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
@@ -468,11 +472,11 @@
|
||||
<Compile Include="Form\FormCommunication.Designer.cs">
|
||||
<DependentUpon>FormCommunication.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Form\FormMain.cs">
|
||||
<Compile Include="Form\FrmMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form\FormMain.Designer.cs">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
<Compile Include="Form\FrmMain.Designer.cs">
|
||||
<DependentUpon>FrmMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Form\StatusChecker.cs" />
|
||||
<Compile Include="Form_LoadingImage.cs">
|
||||
@@ -497,8 +501,8 @@
|
||||
<EmbeddedResource Include="Form\FormCommunication.resx">
|
||||
<DependentUpon>FormCommunication.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Form\FormMain.resx">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Form\FrmMain.resx">
|
||||
<DependentUpon>FrmMain.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Form\FormSetParameter.resx">
|
||||
<DependentUpon>FormSetParameter.cs</DependentUpon>
|
||||
@@ -561,5 +565,11 @@
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CVE.LogViewer\CVE.LogViewer.csproj">
|
||||
<Project>{766cf29f-3629-470a-aec7-d2aead685484}</Project>
|
||||
<Name>CVE.LogViewer</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user