修改逻辑
This commit is contained in:
@@ -51,7 +51,6 @@ namespace 头罩视野.Views
|
||||
private void Button_Click_Reset(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ma.BtnClickFunction(Function.ButtonType.复归型, 90);
|
||||
MessageBox.Show("数据已复位", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
//左开眼
|
||||
private void Button_Click_left(object sender, RoutedEventArgs e)
|
||||
@@ -64,17 +63,50 @@ namespace 头罩视野.Views
|
||||
ma.BtnClickFunction(Function.ButtonType.切换型, 1);
|
||||
}
|
||||
//反转
|
||||
private void Button_Click_Res(object sender, RoutedEventArgs e)
|
||||
private bool _isPressing = false;
|
||||
private async void Button_Click_ResDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
ma.BtnClickFunction(Function.ButtonType.复归型, 10);
|
||||
((Button)sender).CaptureMouse();
|
||||
_isPressing = true;
|
||||
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)
|
||||
{
|
||||
((Button)sender).ReleaseMouseCapture();
|
||||
_isPressing = false;
|
||||
System.Diagnostics.Debug.WriteLine("end1111");
|
||||
|
||||
}
|
||||
//正转
|
||||
private void Button_Click_For(object sender, RoutedEventArgs e)
|
||||
|
||||
private bool _isPressing1 = false;
|
||||
private async void Button_Click_ForDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
ma.BtnClickFunction(Function.ButtonType.复归型, 11);
|
||||
((Button)sender).CaptureMouse();
|
||||
_isPressing1 = 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)
|
||||
{
|
||||
((Button)sender).ReleaseMouseCapture();
|
||||
|
||||
_isPressing1 = false;
|
||||
System.Diagnostics.Debug.WriteLine("正传end");
|
||||
}
|
||||
|
||||
|
||||
//测试btn 测试按钮:读取数据,存入共享列表
|
||||
private void Button_Click_Test(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -312,6 +344,8 @@ namespace 头罩视野.Views
|
||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_timer.Start();
|
||||
ma = new Function(_modbusMaster);
|
||||
c = new DataChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user