测试按钮代码调整
This commit is contained in:
@@ -71,60 +71,50 @@ namespace 头罩视野.Views
|
|||||||
ma.BtnClickFunction(Function.ButtonType.切换型, 1);
|
ma.BtnClickFunction(Function.ButtonType.切换型, 1);
|
||||||
}
|
}
|
||||||
//反转
|
//反转
|
||||||
//private bool _isPressing = false;
|
|
||||||
private async void Button_Click_ResDown(object sender, MouseButtonEventArgs e)
|
private async void Button_Click_ResDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
((Button)sender).CaptureMouse();
|
await _modbusMaster.WriteSingleCoilAsync(1, 10, true);
|
||||||
//_isPressing = true;
|
System.Diagnostics.Debug.WriteLine("反转开始");
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
//重新占位写入
|
|
||||||
_modbusMaster.WriteSingleCoilAsync(1, 10, true);
|
|
||||||
Task.Delay(100);
|
|
||||||
System.Diagnostics.Debug.WriteLine("stard1111");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click_ResUp(object sender, MouseButtonEventArgs e)
|
private async void Button_Click_ResUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
((Button)sender).ReleaseMouseCapture();
|
await _modbusMaster.WriteSingleCoilAsync(1, 10, false);
|
||||||
System.Diagnostics.Debug.WriteLine("end1111");
|
System.Diagnostics.Debug.WriteLine("反转结束");
|
||||||
|
|
||||||
}
|
}
|
||||||
//正转
|
//正转
|
||||||
|
|
||||||
private async void Button_Click_ForDown(object sender, MouseButtonEventArgs e)
|
private async void Button_Click_ForDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
((Button)sender).CaptureMouse();
|
await _modbusMaster.WriteSingleCoilAsync(1, 11, true);
|
||||||
|
|
||||||
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
//重新占位写入
|
|
||||||
_modbusMaster.WriteSingleCoilAsync(1, 11, true);
|
|
||||||
System.Diagnostics.Debug.WriteLine("正传start");
|
|
||||||
Task.Delay(100);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click_ForUp(object sender, MouseButtonEventArgs e)
|
private async void Button_Click_ForUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
((Button)sender).ReleaseMouseCapture();
|
|
||||||
|
await _modbusMaster.WriteSingleCoilAsync(1, 11, false);
|
||||||
System.Diagnostics.Debug.WriteLine("正传end");
|
//System.Diagnostics.Debug.WriteLine("正传end");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//测试btn 测试按钮:读取数据,存入共享列表
|
//测试btn 测试按钮:读取数据,存入共享列表
|
||||||
private void Button_Click_Test(object sender, RoutedEventArgs e)
|
private void Button_Click_Test(object sender, RoutedEventArgs e)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
ma.BtnClickFunction(Function.ButtonType.复归型, 100);
|
||||||
|
|
||||||
testTimer.Start();
|
testTimer.Start();
|
||||||
ma.BtnClickFunction(Function.ButtonType.复归型, 101);
|
|
||||||
MessageBox.Show("开始测试");
|
|
||||||
}
|
}
|
||||||
|
//停止btn
|
||||||
|
private void Button_Click_Stop(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ma.BtnClickFunction(Function.ButtonType.复归型, 103);
|
||||||
|
|
||||||
|
testTimer.Stop();
|
||||||
|
|
||||||
|
}
|
||||||
private async void Timer_Tick(object sender, EventArgs e)
|
private async void Timer_Tick(object sender, EventArgs e)
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -140,7 +130,7 @@ namespace 头罩视野.Views
|
|||||||
LeftEyeArea = double.TryParse(zmsyarea.Text, out var l) ? l : 0,
|
LeftEyeArea = double.TryParse(zmsyarea.Text, out var l) ? l : 0,
|
||||||
RightEyeArea = double.TryParse(ymsyarea.Text, out var r) ? r : 0,
|
RightEyeArea = double.TryParse(ymsyarea.Text, out var r) ? r : 0,
|
||||||
BinocularArea = double.TryParse(smsyarea.Text, out var b) ? b : 0,
|
BinocularArea = double.TryParse(smsyarea.Text, out var b) ? b : 0,
|
||||||
LowerVision = double.TryParse(kbsyarea.Text, out var lv) ? lv : 0,
|
LowerVision = double.TryParse(xfsyarea.Text, out var lv) ? lv : 0,
|
||||||
VisionRetentionRate = double.TryParse(sybhl.Text, out var vr) ? vr : 0
|
VisionRetentionRate = double.TryParse(sybhl.Text, out var vr) ? vr : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -152,6 +142,7 @@ namespace 头罩视野.Views
|
|||||||
data.LowerVision == _lastRecord.LowerVision &&
|
data.LowerVision == _lastRecord.LowerVision &&
|
||||||
data.VisionRetentionRate == _lastRecord.VisionRetentionRate)
|
data.VisionRetentionRate == _lastRecord.VisionRetentionRate)
|
||||||
{
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine("判断去重的方法");
|
||||||
return; // 一样就不添加
|
return; // 一样就不添加
|
||||||
}
|
}
|
||||||
// 不一样 → 插入表格
|
// 不一样 → 插入表格
|
||||||
@@ -159,13 +150,7 @@ namespace 头罩视野.Views
|
|||||||
_lastRecord = data;
|
_lastRecord = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//停止btn
|
|
||||||
private void Button_Click_Stop(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
testTimer.Stop();
|
|
||||||
MessageBox.Show("已停止");
|
|
||||||
ma.BtnClickFunction(Function.ButtonType.复归型, 103);
|
|
||||||
}
|
|
||||||
//打印
|
//打印
|
||||||
|
|
||||||
private void Button_Click_Print(object sender, RoutedEventArgs e)
|
private void Button_Click_Print(object sender, RoutedEventArgs e)
|
||||||
@@ -411,6 +396,12 @@ namespace 头罩视野.Views
|
|||||||
ma = new Function(_modbusMaster);
|
ma = new Function(_modbusMaster);
|
||||||
c = new DataChange();
|
c = new DataChange();
|
||||||
|
|
||||||
|
//zmsyarea.Text = "1.00"; // 左目
|
||||||
|
//smsyarea.Text = "2.00"; // 双目
|
||||||
|
//kbsyarea.Text = "3.00"; // 空白
|
||||||
|
//ymsyarea.Text = "4.00"; // 右目
|
||||||
|
//xfsyarea.Text = "5.00"; // 下方
|
||||||
|
//sybhl.Text = "6.00"; // 视野保存率
|
||||||
}
|
}
|
||||||
private void Page_Unloaded(object sender, RoutedEventArgs e)
|
private void Page_Unloaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user