RTK加入停止发送和提示
This commit is contained in:
parent
d81d8f30ea
commit
86856b6e42
@ -45,6 +45,22 @@ namespace Plane.FormationCreator.ViewModels
|
||||
set { Set(nameof(AltP), ref _AltP, value); }
|
||||
}
|
||||
|
||||
|
||||
private string _RTKState = "RTK未发送";
|
||||
public string RTKState
|
||||
{
|
||||
get { return _RTKState; }
|
||||
set { Set(nameof(RTKState), ref _RTKState, value); }
|
||||
}
|
||||
|
||||
private string _RTKbtntxt = "发送RTK";
|
||||
public string RTKbtntxt
|
||||
{
|
||||
get { return _RTKbtntxt; }
|
||||
set { Set(nameof(RTKbtntxt), ref _RTKbtntxt, value); }
|
||||
}
|
||||
|
||||
|
||||
private ICommand _UnlockCommand;
|
||||
public ICommand UnlockCommand
|
||||
{
|
||||
@ -204,11 +220,15 @@ namespace Plane.FormationCreator.ViewModels
|
||||
{
|
||||
return _SendRTKCommand ?? (_SendRTKCommand = new RelayCommand(async () =>
|
||||
{
|
||||
Rtkport = new SerialPortConnection(RTKcomvalue,57600) as IConnection;
|
||||
if (!trkthreadrun)
|
||||
{
|
||||
|
||||
|
||||
Rtkport = new SerialPortConnection(RTKcomvalue, 57600) as IConnection;
|
||||
await Rtkport.OpenAsync();
|
||||
if (!Rtkport.IsOpen)
|
||||
{
|
||||
Alert.Show("无法打开" + RTKcomvalue , "警告", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
Alert.Show("无法打开" + RTKcomvalue, "警告", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
trkthreadrun = true; //开始运行后台任务
|
||||
@ -221,6 +241,10 @@ namespace Plane.FormationCreator.ViewModels
|
||||
thrtk.Start();
|
||||
*/
|
||||
//后台任务方式运行rtk转发任务
|
||||
Alert.Show("RTK数据开始发送", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
RTKState = "RTK数据发送中";
|
||||
RTKbtntxt = "停止RTK";
|
||||
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
//读取RTK数据循环
|
||||
@ -239,6 +263,23 @@ namespace Plane.FormationCreator.ViewModels
|
||||
|
||||
}
|
||||
}).ConfigureAwait(false);
|
||||
Alert.Show("RTK数据停止发送", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
|
||||
}
|
||||
else//停止RTK
|
||||
{
|
||||
trkthreadrun = false;
|
||||
Rtkport.Close();
|
||||
Rtkport = null;
|
||||
|
||||
RTKState = "未发送RTK数据";
|
||||
RTKbtntxt = "发送RTK";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
@ -67,8 +67,13 @@
|
||||
HorizontalContentAlignment="Right"
|
||||
Text="{Binding RTKcomvalue, UpdateSourceTrigger=PropertyChanged}"
|
||||
/>
|
||||
<Button Content="发送RTK"
|
||||
<Button Content="{Binding Path=RTKbtntxt}"
|
||||
|
||||
Command="{Binding SendRTKCommand}" />
|
||||
<TextBlock
|
||||
Margin="5,5,5,5"
|
||||
Text="{Binding Path=RTKState}"
|
||||
/>
|
||||
</WrapPanel>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user