优化项目代码
This commit is contained in:
@@ -23,7 +23,6 @@ namespace 头罩视野.Views
|
||||
public partial class PageTest : Page
|
||||
{
|
||||
|
||||
private TcpClient _tcpClient => ModbusResourceManager.Instance.TcpClient;
|
||||
private IModbusMaster _modbusMaster => ModbusResourceManager.Instance.ModbusMaster;
|
||||
DispatcherTimer _timer;
|
||||
DataChange c = new DataChange();
|
||||
@@ -32,7 +31,7 @@ namespace 头罩视野.Views
|
||||
//// 定时采集用
|
||||
private DispatcherTimer testTimer;
|
||||
// 保存上一条数据(用于去重)
|
||||
private TestDataStore.TestRecord _lastRecord;
|
||||
private TestDataStore.TestRecord? _lastRecord;
|
||||
|
||||
public PageTest()
|
||||
{
|
||||
@@ -53,10 +52,6 @@ namespace 头罩视野.Views
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取客户端
|
||||
var client = ModbusHelper.TcpClient;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//复位btn
|
||||
@@ -75,11 +70,11 @@ namespace 头罩视野.Views
|
||||
ma.BtnClickFunction(Function.ButtonType.切换型, 1);
|
||||
}
|
||||
//反转
|
||||
private bool _isPressing = false;
|
||||
//private bool _isPressing = false;
|
||||
private async void Button_Click_ResDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
((Button)sender).CaptureMouse();
|
||||
_isPressing = true;
|
||||
//_isPressing = true;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
//重新占位写入
|
||||
@@ -97,11 +92,11 @@ namespace 头罩视野.Views
|
||||
|
||||
}
|
||||
//正转
|
||||
private bool _isPressing1 = false;
|
||||
|
||||
private async void Button_Click_ForDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
((Button)sender).CaptureMouse();
|
||||
_isPressing1 = true;
|
||||
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
@@ -116,7 +111,6 @@ namespace 头罩视野.Views
|
||||
{
|
||||
((Button)sender).ReleaseMouseCapture();
|
||||
|
||||
_isPressing1 = false;
|
||||
System.Diagnostics.Debug.WriteLine("正传end");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user