Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
Line-Smart-Workstation
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 9ff72174
由
LN
编写于
2024-04-03 17:04:30 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
3ffb2c74
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
96 行增加
和
2 行删除
TSA-V/FrmMenu.cs
TSA-V/Smart-Workstation.csproj
TSA-V/hands/HandClientManager.cs
TSA-V/FrmMenu.cs
查看文件 @
9ff7217
...
...
@@ -303,6 +303,7 @@ namespace TSA_V
TSAVBean
.
serverCommunication
.
StopConnectServer
();
MouseManager
.
Stop
();
HandClientManager
.
StopClient
();
// PUSICANControl.Close();
}
...
...
@@ -344,6 +345,7 @@ namespace TSA_V
TSAVBean
.
ShowPointEvent
+=
TSAVBean_ShowPointEvent
;
//showProjectorTimer.Start();
timer1
.
Start
();
HandClientManager
.
StartClient
();
}
private
bool
TSAVBean_ShowPointEvent
(
ProjectorPInfo
p
)
...
...
TSA-V/Smart-Workstation.csproj
查看文件 @
9ff7217
...
...
@@ -214,6 +214,7 @@
<Compile Include="frmBoard\FrmListViewer.Designer.cs">
<DependentUpon>FrmListViewer.cs</DependentUpon>
</Compile>
<Compile Include="hands\HandClientManager.cs" />
<Compile Include="manager\AOIManager.cs" />
<Compile Include="DataCalculate.cs">
<SubType>Form</SubType>
...
...
@@ -578,7 +579,9 @@
<EmbeddedResource Include="FrmDeviceConfig.resx">
<DependentUpon>FrmDeviceConfig.cs</DependentUpon>
</EmbeddedResource>
<None Include="hands\config.ini" />
<Content Include="hands\config.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
...
...
@@ -625,7 +628,9 @@
</ItemGroup>
<ItemGroup>
<None Include="image\backImage.png" />
<Content Include="hands\defMTest.py" />
<Content Include="hands\defMTest.py">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="image\alarm2.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
...
...
TSA-V/hands/HandClientManager.cs
0 → 100644
查看文件 @
9ff7217
using
HalconDotNet
;
using
System
;
using
System.ComponentModel
;
using
System.Diagnostics
;
using
System.Windows.Forms
;
using
TSA_V.Common
;
namespace
TSA_V
{
public
class
HandClientManager
{
public
HandClientManager
()
{
}
private
static
Process
process
=
null
;
public
static
void
StartClient
()
{
//脚本所在地址
string
CurrentPath
=
System
.
IO
.
Directory
.
GetCurrentDirectory
();
string
ScriptFileName
=
Application
.
StartupPath
+
@"\hands\defMTest.py"
;
;
string
sArguments
=
ScriptFileName
;
//脚本执行文件
//用于执行程序最后的
string
sep
=
"-u"
;
process
=
new
Process
();
try
{
process
.
StartInfo
.
FileName
=
@"python.exe"
;
//传递给进程
process
.
StartInfo
.
Arguments
=
sArguments
;
process
.
StartInfo
.
UseShellExecute
=
false
;
//是否使用操作系统shell启动
process
.
StartInfo
.
CreateNoWindow
=
true
;
//是否在新窗口中启动该进程的值 (不显示程序窗口)
process
.
StartInfo
.
RedirectStandardInput
=
true
;
// 接受来自调用程序的输入信息
process
.
StartInfo
.
RedirectStandardOutput
=
true
;
// 由调用程序获取输出信息
process
.
StartInfo
.
RedirectStandardError
=
true
;
//重定向标准错误输出
process
.
Start
();
// 启动程序
process
.
BeginOutputReadLine
();
process
.
OutputDataReceived
+=
new
DataReceivedEventHandler
(
p_OutputDataReceivedText
);
//process.WaitForExit(); //等待程序执行完退出进程
//process.Close();
}
catch
(
Win32Exception
e
)
{
LogUtil
.
error
(
"出错:"
+
e
.
ToString
());
}
}
public
static
void
pythonDetector4
(
string
[]
strArr
)
{
}
private
static
void
p_OutputDataReceivedText
(
object
sender
,
DataReceivedEventArgs
e
)
{
if
(!
string
.
IsNullOrEmpty
(
e
.
Data
))
{
LogUtil
.
info
(
"pyLog: "
+
e
.
Data
);
}
}
public
static
void
StopClient
()
{
try
{
if
(
process
!=
null
)
{
if
(!
process
.
HasExited
)
{
process
.
Kill
();
LogUtil
.
info
(
$
"停止{"
defMTest
.
py
"} "
);
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
+
ex
.
ToString
());
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论