兼容老版本航点文件

间隔保留1位小数
This commit is contained in:
xu 2020-05-05 16:18:23 +08:00
parent 59b4669a7d
commit 8938e3aaaa
2 changed files with 23 additions and 5 deletions

View File

@ -102,7 +102,7 @@ namespace Plane.FormationCreator.Formation
{
_ledSumTime += (float)led.Delay;
}
LEDSumTime = _ledSumTime;
LEDSumTime =(float) Math.Round(_ledSumTime, 1);
}
@ -204,6 +204,7 @@ namespace Plane.FormationCreator.Formation
private double delay = 1; //灯光延时 单位100ms 从当前任务开为0延时几秒后设置LED
private int ledmode = 0; //灯光模式 0常亮 1闪烁 2随机闪烁(RGB无意义)
private float ledInterval = 0; //闪烁延时 单位:秒
private int ledrate = 0; //为了和以前文件兼容自动转为ledInterval
private int ledtimes = 0; //次数 (预留、暂取消其意义)
private string ledRGB = "FFFFFF"; //灯光颜色
private SolidColorBrush _DrawRGB = new SolidColorBrush(Color.FromRgb(0xFF, 0xFF, 0xFF));
@ -231,7 +232,10 @@ namespace Plane.FormationCreator.Formation
public double Delay
{
get { return delay; }
set { delay = value; OnPropertyChanged("delay"); }
set {
delay = Math.Round(value, 1);
OnPropertyChanged("delay");
}
}
public int LEDMode
@ -242,8 +246,22 @@ namespace Plane.FormationCreator.Formation
public float LEDInterval
{
get { return ledInterval; }
set { ledInterval = value; }
set { ledInterval = value;
if (ledInterval != 0)
ledrate = (int)Math.Round(1 / ledInterval); //用于兼容老版本
}
}
public int LEDRate
{
get { return ledrate; }
set { ledrate = value;
if ((ledrate!=0)&&(ledInterval==0))
ledInterval = 1 / ledrate;
}
}
public int LEDTimes
{
get { return ledtimes; }

View File

@ -427,7 +427,7 @@
<StackPanel DataContext="{Binding FlightTaskManager.SelectedTask.ModifyingSingleCopterInfo}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40*"/>
<ColumnDefinition Width="45*"/>
<ColumnDefinition Width="61*"/>
<ColumnDefinition Width="61*"/>
<ColumnDefinition Width="61*"/>
@ -435,7 +435,7 @@
<StackPanel Orientation="Horizontal" Margin="0,0,0,0" >
<TextBlock Text="总时长:" Margin="5,7,2,2" VerticalAlignment="Center" Height="15"/>
<TextBlock Text="{Binding LEDSumTime}" Margin="0,7,2,2" VerticalAlignment="Center" Height="15"/>
<TextBlock Text="秒" Margin="0,7,5,2" VerticalAlignment="Center" Height="15"/>
<TextBlock Text="秒" Margin="0,7,10,2" VerticalAlignment="Center" Height="15"/>
</StackPanel>
<Grid Grid.Column="1" Grid.ColumnSpan="3" VerticalAlignment="Center" Height="34">