RTK按钮取消

This commit is contained in:
xu 2020-03-06 17:43:33 +08:00
parent 911024c0ad
commit da086831bf
9 changed files with 58 additions and 41 deletions

View File

@ -34,7 +34,7 @@
<cnv:InverseBooleanConverter x:Key="InverseBooleanConverter" /> <cnv:InverseBooleanConverter x:Key="InverseBooleanConverter" />
<cnv:BooleanToStringConverter x:Key="ShowModifyTaskViewButtonContentConverter" <cnv:BooleanToStringConverter x:Key="ShowModifyTaskViewButtonContentConverter"
False="【飞行模式】" False="【飞行模式】"
True="【编辑模式】" /> True="【设计模式】" />
<cnv:BooleanToStringConverter x:Key="Show2d3dButtonContentConverter" <cnv:BooleanToStringConverter x:Key="Show2d3dButtonContentConverter"
False="平面视图" False="平面视图"

View File

@ -41,7 +41,7 @@ namespace Plane.FormationCreator
} }
} }
private bool _ShowModifyTaskView = true; private bool _ShowModifyTaskView = false;
public bool ShowModifyTaskView public bool ShowModifyTaskView
{ {
get { return _ShowModifyTaskView; } get { return _ShowModifyTaskView; }

View File

@ -1,6 +1,7 @@
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using Microsoft.Practices.ServiceLocation; using Microsoft.Practices.ServiceLocation;
using Plane.CommunicationManagement; using Plane.CommunicationManagement;
using Plane.FormationCreator.ViewModels;
using Plane.Util; using Plane.Util;
using Plane.Windows.IniHelper; using Plane.Windows.IniHelper;
using Plane.Windows.Messages; using Plane.Windows.Messages;
@ -25,12 +26,23 @@ namespace Plane.FormationCreator.Formation
private ICommsSerial comPort; private ICommsSerial comPort;
private CommModuleManager _commModuleManager = CommModuleManager.Instance; private CommModuleManager _commModuleManager = CommModuleManager.Instance;
public ObservableCollection<RtcmInfo> rtcmInfoList { get; } = new ObservableCollection<RtcmInfo>(); public ObservableCollection<RtcmInfo> rtcmInfoList { get; } = new ObservableCollection<RtcmInfo>();
private ControlPanelViewModel ControlPanelVM = ServiceLocator.Current.GetInstance<ControlPanelViewModel>();
private bool _rtcmthreadrun = false; private bool _rtcmthreadrun = false;
public bool Rtcmthreadrun public bool Rtcmthreadrun
{ {
get { return _rtcmthreadrun; } get { return _rtcmthreadrun; }
set { Set(nameof(Rtcmthreadrun), ref _rtcmthreadrun, value); } set {
Set(nameof(Rtcmthreadrun), ref _rtcmthreadrun, value);
if (value)
ControlPanelVM.RTKState = "RTK发送中...";
else
ControlPanelVM.RTKState = "RTK未发送";
}
} }
private int bps; private int bps;
@ -228,7 +240,15 @@ namespace Plane.FormationCreator.Formation
break; break;
} }
msgseen.Clear(); msgseen.Clear();
comPort.Open(); try
{
comPort.Open();
}
catch (Exception ex)
{
//Message.Show(ex.Message);
}
if (comPort.IsOpen) if (comPort.IsOpen)
{ {
Rtcmthreadrun = true; Rtcmthreadrun = true;

View File

@ -45,7 +45,7 @@
<c:MetroWindow.RightWindowCommands> <c:MetroWindow.RightWindowCommands>
<c:WindowCommands> <c:WindowCommands>
<Button Content="{Binding LoginDisp}" <Button Content="{Binding LoginDisp}"
Command="{Binding LoginCommand}" /> Command="{Binding LoginCommand}" />

View File

@ -1153,9 +1153,10 @@ namespace Plane.FormationCreator.ViewModels
Alert.Show("作为参照的原点未设置,无法开始任务!", "提示"); Alert.Show("作为参照的原点未设置,无法开始任务!", "提示");
return; return;
} }
//飞机用UTC时间日志用本地时间记录
DateTime MissionTime = DateTime.UtcNow.AddSeconds(5); DateTime MissionTime = DateTime.UtcNow.AddSeconds(5);
Message.Show("开始任务"+ MissionTime.ToString()); DateTime MissionTime_log = DateTime.Now.AddSeconds(5);
Message.Show("任务开始:" + MissionTime_log.ToString());
//循环3次 发送起飞命令 避免通信问题 //循环3次 发送起飞命令 避免通信问题
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
@ -1182,7 +1183,7 @@ namespace Plane.FormationCreator.ViewModels
await Task.Delay(10).ConfigureAwait(false); await Task.Delay(10).ConfigureAwait(false);
} }
_copterManager.Net_LogStartMission(MissionTime, _flightTaskManager.OriginLng, _flightTaskManager.OriginLat); _copterManager.Net_LogStartMission(MissionTime_log, _flightTaskManager.OriginLng, _flightTaskManager.OriginLat);
Alert.Show("所有飞机开始执行航点任务。请勿多次开始任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Information); Alert.Show("所有飞机开始执行航点任务。请勿多次开始任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
})); }));
} }

View File

@ -12,7 +12,7 @@
d:DesignHeight="300" d:DesignHeight="300"
d:DesignWidth="300"> d:DesignWidth="300">
<StackPanel> <StackPanel Margin="0,0,-8,0">
<StackPanel.Resources> <StackPanel.Resources>
<Style TargetType="Button" <Style TargetType="Button"
BasedOn="{StaticResource {x:Type Button}}"> BasedOn="{StaticResource {x:Type Button}}">
@ -79,25 +79,20 @@
Text="{Binding AltP, UpdateSourceTrigger=PropertyChanged}" /> Text="{Binding AltP, UpdateSourceTrigger=PropertyChanged}" />
</WrapPanel> </WrapPanel>
<WrapPanel> <WrapPanel>
<Button Margin="0,0,0,0" Content="选写航点" Command="{Binding WriteMissionSingleCommand}" />
<Button Content="选写航点" <Button Margin="3,0,0,0" Content="定位统计" Command="{Binding ReportGPSTypeCommand}"/>
Command="{Binding WriteMissionSingleCommand}" /> <Button Margin="3,0,0,0" Content="统计模块" Command="{Binding DetectionCommModuleVersion}" />
<Button Content="定位统计" <Button Margin="3,0,0,0" Content="正式参数" Command="{Binding TurnOffTestLightsCommand}" />
Command="{Binding ReportGPSTypeCommand}"/>
<Button Content="统计模块" <TextBlock Margin="8,0,5,0" Text="起飞高度" VerticalAlignment="Center"></TextBlock>
Command="{Binding DetectionCommModuleVersion}" /> <TextBox Width="30" Height="25" Text="{Binding TaskOffAlt}" />
<Button Content="正式参数" <TextBlock Margin="5,0,5,0" Text="米" VerticalAlignment="Center"></TextBlock>
Command="{Binding TurnOffTestLightsCommand}"
/>
<TextBlock Margin="5,0,3,0" Text="起飞高度" VerticalAlignment="Center"></TextBlock>
<TextBox Width="30" Height="26" Text="{Binding TaskOffAlt}"
/>
<Label Visibility="Collapsed">Lat</Label> <Label Visibility="Collapsed">Lat</Label>
<TextBox Visibility="Collapsed" Text="{Binding LatOffset}" Width="50"/> <TextBox Visibility="Collapsed" Text="{Binding LatOffset}" Width="50"/>
<Label Visibility="Collapsed">Lng</Label> <Label Visibility="Collapsed">Lng</Label>
<TextBox Visibility="Collapsed" Text="{Binding LngOffset}" Width="50"/> <TextBox Visibility="Collapsed" Text="{Binding LngOffset}" Width="50"/>
<Button Visibility="Collapsed" Content="设置返航点" <Button Visibility="Collapsed" Content="设置返航点" Command="{Binding RLTOffsetCommand}" />
Command="{Binding RLTOffsetCommand}" />
</WrapPanel> </WrapPanel>
<Separator/> <Separator/>
<WrapPanel> <WrapPanel>
@ -135,19 +130,20 @@
Width="55" Width="55"
Margin="5, 5, 5, 5" Margin="5, 5, 5, 5"
HorizontalContentAlignment="Right" HorizontalContentAlignment="Right"
Text="{Binding RTKcomvalue, UpdateSourceTrigger=PropertyChanged}"
Text="{Binding RTKcomvalue, UpdateSourceTrigger=PropertyChanged}" Visibility="Collapsed"
/> />
<Button Content="{Binding Path=RTKbtntxt}" <Button Content="{Binding Path=RTKbtntxt}"
Command="{Binding SendRTKCommand}" /> Command="{Binding SendRTKCommand}" Visibility="Collapsed" />
<Button Content="{Binding Path=NTRIPbtntxt}" <Button Content="{Binding Path=NTRIPbtntxt}"
Command="{Binding SendRTCMCommand}"/> Command="{Binding SendRTCMCommand}" Visibility="Collapsed"/>
<Button Content="RTK" Command="{Binding OpenRtcmManageCommand}" /> <Button Content="RTK 控制" Command="{Binding OpenRtcmManageCommand}" />
<TextBlock <TextBlock
Margin="5,5,5,5" Margin="5,5,5,5" Foreground ="Red" VerticalAlignment="Center"
Text="{Binding Path=RTKState}" Text="{Binding Path=RTKState}"
/> />
</WrapPanel> </WrapPanel>

View File

@ -84,13 +84,13 @@
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
<StackPanel Grid.Row="1" Margin="0,0,0,5" <StackPanel Grid.Row="1" Margin="0,5,0,5"
Orientation="Horizontal"> Orientation="Horizontal">
<Button Content="间隔选" Command="{Binding IntervalSelectCoptersCommand}"/> <Button Content="间隔选" Command="{Binding IntervalSelectCoptersCommand}"/>
<TextBlock Text="连选数量" Margin="5,5,0,0"/> <TextBlock Text="连选数量" Margin="5,5,0,0"/>
<TextBox Width="30" Margin="5,0,0,0" Text="{Binding ContinuousNum}"/> <TextBox Width="30" Margin="5,0" VerticalContentAlignment="Center" Text="{Binding ContinuousNum}"/>
<TextBlock Text="间隔数量" Margin="5,5,0,0"/> <TextBlock Text="间隔数量" Margin="5,5,0,0"/>
<TextBox Width="30" Margin="5,0,0,0" Text="{Binding IntervalNum}"/> <TextBox Width="30" Margin="5,0" VerticalContentAlignment="Center" Text="{Binding IntervalNum}"/>
<TextBlock Text="选中个数" Margin="5,5,0,0"/> <TextBlock Text="选中个数" Margin="5,5,0,0"/>
<TextBlock Width="30" Margin="5,5,0,0" Text="{Binding CopterManager.SeletedCopterCount, UpdateSourceTrigger=PropertyChanged}"/> <TextBlock Width="30" Margin="5,5,0,0" Text="{Binding CopterManager.SeletedCopterCount, UpdateSourceTrigger=PropertyChanged}"/>

View File

@ -7,7 +7,7 @@
xmlns:c="http://metro.mahapps.com/winfx/xaml/controls" xmlns:c="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="800" d:DesignHeight="300" d:DesignWidth="800"
Height="350" Width="1500" WindowStartupLocation="CenterScreen" Background="#FF2D2D2D" BorderBrush="#FF039AF0"> Height="350" Width="1500" WindowStartupLocation="CenterScreen" Background="#FF2D2D2D" BorderBrush="#FF039AF0" Title="RTK控制">
<Grid Margin="0,0,0,0"> <Grid Margin="0,0,0,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
@ -15,7 +15,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Margin="5" Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Margin="5" Orientation="Horizontal" VerticalAlignment="Center">
<ComboBox Width="120" Height="25" Foreground="White" SelectedIndex="0" <ComboBox Width="120" Height="25" Foreground="White" SelectedIndex="0"
ItemsSource="{Binding serialPorts, Mode=OneWay}" Margin="10" ItemsSource="{Binding serialPorts, Mode=OneWay}"
SelectedValue="{Binding SerialPortsSelectdValue}" SelectedValue="{Binding SerialPortsSelectdValue}"
DropDownOpened="ComboBox_DropDownOpened"/> DropDownOpened="ComboBox_DropDownOpened"/>
<Button Margin="6" Width="80" Height="28" <Button Margin="6" Width="80" Height="28"

View File

@ -5,17 +5,17 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Plane.FormationCreator.Views" xmlns:local="clr-namespace:Plane.FormationCreator.Views"
mc:Ignorable="d" mc:Ignorable="d"
Title="设置摆放" Height="301.595" Width="364.628" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize"> Title="设置摆放" Height="290.592" Width="364.628" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize">
<Grid Margin="90,45"> <Grid Margin="90,35,90,20">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="28"/> <RowDefinition Height="32"/>
<RowDefinition Height="28"/> <RowDefinition Height="32"/>
<RowDefinition Height="28"/> <RowDefinition Height="32"/>
<RowDefinition Height="28"/> <RowDefinition Height="32"/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Content="每列数量" Margin="5,2"></Label> <Label Content="每列数量" Margin="5,2"></Label>