灯光列表改为单独页面

跑马灯和灯带加入方向
加入对齐灯光时间
加入灯光新类型
拉烟ID之前是8改为11,到固件任然为50
This commit is contained in:
xu 2020-05-05 13:29:14 +08:00
parent 62a7b8b028
commit 59b4669a7d
6 changed files with 498 additions and 99 deletions

View File

@ -672,15 +672,15 @@ namespace Plane.FormationCreator.Formation
{
var copter = copters[j];
var fc = copter as FakeCopter;
fc.SetProperties(
latitude: Tasks[0].SingleCopterInfos[j].TargetLat,
longitude: Tasks[0].SingleCopterInfos[j].TargetLng,
altitude:0
);
//设置灯光为默认颜色
fc.LEDColor = CopterManager.CopterDefaultColor;// "000000";
if (fc != null)
{
fc.SetProperties(
latitude: Tasks[0].SingleCopterInfos[j].TargetLat,
longitude: Tasks[0].SingleCopterInfos[j].TargetLng,
altitude: 0 );
//设置灯光为默认颜色
fc.LEDColor = CopterManager.CopterDefaultColor;// "000000";
}
}
}

View File

@ -1,15 +1,18 @@
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Plane.CommunicationManagement;
using Plane.Copters;
using Plane.Windows.Messages;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Media;
namespace Plane.FormationCreator.Formation
{
@ -29,19 +32,24 @@ namespace Plane.FormationCreator.Formation
{
LEDInfo LedInfo = new LEDInfo();
LEDInfos.Add(LedInfo);
LedInfo.RemoveEvent += new LEDInfo.RemoveEventHandler(LEDRemove);
LedInfo.RemoveEvent += new LEDInfo.RemoveEventHandler(LEDRemove);
LedInfo.PropertyChanged += (sender, e) =>{RefLEDSumTime();};
RefLEDSumTime();
}
public void AddLEDInfo(LEDInfo LedInfo)
{
LEDInfos.Add(LedInfo);
LedInfo.RemoveEvent += new LEDInfo.RemoveEventHandler(LEDRemove);
LedInfo.PropertyChanged += (sender, e) => { RefLEDSumTime(); };
RefLEDSumTime();
}
public void LEDRemove(object sender)
{
LEDInfo LedInfo = sender as LEDInfo;
LEDInfos.Remove(LedInfo);
RefLEDSumTime();
}
@ -57,6 +65,7 @@ namespace Plane.FormationCreator.Formation
return _AddLEDCommand ?? (_AddLEDCommand = new RelayCommand<double>(async =>
{
AddLEDInfo();
}));
}
}
@ -85,15 +94,39 @@ namespace Plane.FormationCreator.Formation
}));
}
}
public void RefLEDSumTime()
{
float _ledSumTime = 0;
foreach (LEDInfo led in LEDInfos)
{
_ledSumTime += (float)led.Delay;
}
LEDSumTime = _ledSumTime;
}
//灯光总时长
private float _LEDSumTime = 0;
public float LEDSumTime
{
get { return _LEDSumTime; }
set { Set(nameof(LEDSumTime), ref _LEDSumTime, value); }
}
bool LEDTestRun = false;
/*
/*
private string _TestLEDtxt = "测试";
public string TestLEDtxt
{
get { return _TestLEDtxt; }
set { Set(nameof(TestLEDtxt), ref _TestLEDtxt, value); }
}
*/
/*
LEDMode 0 = "常亮"
1="同步闪烁(单色)" />
@ -130,7 +163,7 @@ namespace Plane.FormationCreator.Formation
}else
{
LEDTestRun = false;
_commModuleManager.LED_TaskAsync(99, 0, 0, "000000", this.Copter);
_commModuleManager.LED_TaskAsync(255, 0, 0, "000000", this.Copter);
}
}));
@ -166,13 +199,22 @@ namespace Plane.FormationCreator.Formation
}
}
public class LEDInfo
public class LEDInfo :INotifyPropertyChanged
{
private double delay = 1; //灯光延时 单位100ms 从当前任务开为0延时几秒后设置LED
private int ledmode = 0; //灯光模式 0常亮 1闪烁 2随机闪烁(RGB无意义)
private float ledInterval = 0; //闪烁延时 单位:秒
private int ledtimes = 0; //次数 (预留、暂取消其意义)
private string ledRGB = "FFFFFF"; //灯光颜色
private SolidColorBrush _DrawRGB = new SolidColorBrush(Color.FromRgb(0xFF, 0xFF, 0xFF));
protected internal virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
public LEDInfo()
{
@ -184,12 +226,12 @@ namespace Plane.FormationCreator.Formation
delay = led.delay;
ledmode = led.ledmode;
ledInterval = led.ledInterval;
ledRGB = led.ledRGB;
LEDRGB = led.ledRGB;
}
public double Delay
{
get { return delay; }
set { delay = value; }
set { delay = value; OnPropertyChanged("delay"); }
}
public int LEDMode
@ -211,9 +253,29 @@ namespace Plane.FormationCreator.Formation
public string LEDRGB
{
get { return ledRGB; }
set { ledRGB = value; }
set {
ledRGB = value;
DrawRGB.Color= (Color)ColorConverter.ConvertFromString("#" + ledRGB);
}
}
[Newtonsoft.Json.JsonIgnore]
public SolidColorBrush DrawRGB
{
get
{
return _DrawRGB;
}
set
{
_DrawRGB = value;
}
}
public delegate void RemoveEventHandler(object sender);
public event RemoveEventHandler RemoveEvent;
private ICommand _RemoveLEDCommand;

View File

@ -1514,7 +1514,7 @@ namespace Plane.FormationCreator.ViewModels
Color color = (Color)ColorConverter.ConvertFromString("#" + ledInfo.LEDRGB);
int ledMode = ledInfo.LEDMode;
//拉烟任务模式ID是50需要改为50
if (ledMode == 8) ledMode = 50;
if (ledMode == 11) ledMode = 50;
IMission LEDMission = Mission.CreateLEDControlMission(
(int)(ledInfo.Delay * 10),
ledMode,

View File

@ -1680,14 +1680,29 @@ public ICommand VerticlAlignmentCommand
#region
private double _BeginTime = 10;
private double _BeginTime = 1;
public double BeginTime
{
get { return _BeginTime; }
set { Set(nameof(BeginTime), ref _BeginTime, value); }
}
private double _EndTime = 11;
//灯带扫光方向,默认从左到右
private double _BeltDirection = 90;
public double BeltDirection
{
get { return _BeltDirection; }
set { Set(nameof(BeltDirection), ref _BeltDirection, value); }
}
private double _EndTime = 3;
public double EndTime
{
get { return _EndTime; }
@ -1701,22 +1716,55 @@ public ICommand VerticlAlignmentCommand
set { Set(nameof(AverageSum), ref _AverageSum, value); }
}
private string _ChangeRGB = "FFFFFF";
private string _ChangeRGB = "FF0000";
public string ChangeRGB
{
get { return _ChangeRGB; }
set { Set(nameof(ChangeRGB), ref _ChangeRGB, value); }
set { Set(nameof(ChangeRGB), ref _ChangeRGB, value);
DrawChangeRGB.Color = (Color)ColorConverter.ConvertFromString("#" + value);
}
}
private string _EndRGB = "";
private string _EndRGB = "0000FF";
public string EndRGB
{
get { return _EndRGB; }
set { Set(nameof(EndRGB), ref _EndRGB, value); }
set { Set(nameof(EndRGB), ref _EndRGB, value);
DrawEndRGB.Color = (Color)ColorConverter.ConvertFromString("#" + value);
}
}
private SolidColorBrush _DrawChangeRGB = new SolidColorBrush(Color.FromRgb(0xFF, 0x00, 0x00));
public SolidColorBrush DrawChangeRGB
{
get
{
return _DrawChangeRGB;
}
set
{
Set(nameof(DrawChangeRGB), ref _DrawChangeRGB, value);
}
}
private SolidColorBrush _DrawEndRGB = new SolidColorBrush(Color.FromRgb(0x00, 0x00, 0xFF));
public SolidColorBrush DrawEndRGB
{
get
{
return _DrawEndRGB;
}
set
{
Set(nameof(DrawEndRGB), ref _DrawEndRGB, value);
}
}
#endregion
//跑马灯--按照经纬度变换灯光
//--按照经纬度变换灯光
private ICommand _SetHorseRaceLampCommand;
public ICommand SetHorseRaceLampCommand
{
@ -1724,10 +1772,18 @@ public ICommand VerticlAlignmentCommand
{
return _SetHorseRaceLampCommand ?? (_SetHorseRaceLampCommand = new RelayCommand(async () =>
{
float CopterDirection =90- (float)BeltDirection ;
if (_copterManager.SelectedCopters.Count() <= 0)
return;
//旋转飞机矩阵
if (CopterDirection != 0)
{
LevelRotateCommand.Execute(CopterDirection);
await Task.Delay(100);
}
double minLat, maxLat;
double minLng, maxLng;
@ -1749,10 +1805,12 @@ public ICommand VerticlAlignmentCommand
foreach (var copterInfo in selectCopterInfos)
{
double interval = copterInfo.TargetLng - minLng;
double leddelay = 0;
int time = (int)(interval / (averagelngCount / AverageSum));
LEDInfo led = new LEDInfo();
led.LEDMode = 0;
led.Delay = BeginTime + time * (EndTime - BeginTime) / AverageSum;
leddelay += led.Delay;
led.LEDRGB = ChangeRGB;
copterInfo.AddLEDInfo(led);
@ -1767,16 +1825,39 @@ public ICommand VerticlAlignmentCommand
else
endLed.LEDRGB = EndRGB;
copterInfo.AddLEDInfo(endLed);
//为了每架飞机结束灯光时间一致,以便下次再做跑马灯之类的效果有个一致的起始时间,再增加一个
//改为专门的按钮功能=AlignmentTimeCommand
/*
leddelay += endLed.Delay;
LEDInfo endLed1 = new LEDInfo();
endLed1.LEDMode = 0;
endLed1.Delay = (EndTime - BeginTime)-leddelay;
if (EndRGB == "0")
endLed1.LEDRGB = copterInfo.LEDInfos[copterInfo.LEDInfos.Count - 2].LEDRGB;
else
endLed1.LEDRGB = EndRGB;
copterInfo.AddLEDInfo(endLed1);
*/
}
}
await Task.Delay(100);
//旋转飞机矩阵
if (CopterDirection != 0)
LevelRotateCommand.Execute(0-CopterDirection);
}));
}
}
private double _StrokesTime = 10;
private double _StrokesTime = 1;
public double StrokesTime
{
get { return _StrokesTime; }
@ -1855,6 +1936,16 @@ public ICommand VerticlAlignmentCommand
}
}
private double _AlignmentTime = 10;
public double AlignmentTime
{
get { return _AlignmentTime; }
set { Set(nameof(AlignmentTime), ref _AlignmentTime, value); }
}
#region
@ -1869,15 +1960,165 @@ public ICommand VerticlAlignmentCommand
public string RightRGB
{
get { return _RightRGB; }
set { Set(nameof(RightRGB), ref _RightRGB, value); }
set { Set(nameof(RightRGB), ref _RightRGB, value);
DrawRightRGB.Color = (Color)ColorConverter.ConvertFromString("#" + value);
}
}
private string _LeftRGB = "FFFFFF";
public string LeftRGB
{
get { return _LeftRGB; }
set { Set(nameof(LeftRGB), ref _LeftRGB, value); }
set { Set(nameof(LeftRGB), ref _LeftRGB, value);
DrawLeftRGB.Color = (Color)ColorConverter.ConvertFromString("#" + value);
}
}
//渐变方向,默认从左到右
private double _GradualDirection = 90;
public double GradualDirection
{
get { return _GradualDirection; }
set { Set(nameof(GradualDirection), ref _GradualDirection, value); }
}
private SolidColorBrush _DrawLeftRGB = new SolidColorBrush(Color.FromRgb(0xFF, 0xFF, 0xFF));
public SolidColorBrush DrawLeftRGB
{
get
{
return _DrawLeftRGB;
}
set
{
Set(nameof(DrawLeftRGB), ref _DrawLeftRGB, value);
}
}
private SolidColorBrush _DrawRightRGB = new SolidColorBrush(Color.FromRgb(0xFF, 0xFF, 0xFF));
public SolidColorBrush DrawRightRGB
{
get
{
return _DrawRightRGB;
}
set
{
Set(nameof(DrawRightRGB), ref _DrawRightRGB, value);
}
}
private ICommand _QueryMAXTimeCommand;
public ICommand QueryMAXTimeCommand
{
get
{
return _QueryMAXTimeCommand ?? (_QueryMAXTimeCommand = new RelayCommand<int>(async =>
{
//所以选中飞行当前任务信息
var selectCopterInfos = _flightTaskManager.SelectedTask.SingleCopterInfos.FindAll(delegate (FlightTaskSingleCopterInfo p)
{
return _copterManager.SelectedCopters.Contains(p.Copter);
});
double maxtime = 0.0f;
string maxid="" ;
foreach (var copterInfo in selectCopterInfos)
{
// AlignmentTime
double leddelay = 0;
foreach (LEDInfo led in copterInfo.LEDInfos)
{
leddelay += led.Delay;
}
if (leddelay > maxtime)
{
maxtime = leddelay;
maxid = copterInfo.Copter.Id;
}
}
Alert.Show($"ID={maxid}飞机的航点灯光时长为{maxtime}秒", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}));
}
}
private ICommand _AlignmentTimeCommand;
public ICommand AlignmentTimeCommand
{
get
{
return _AlignmentTimeCommand ?? (_AlignmentTimeCommand = new RelayCommand<int>(async =>
{
//所以选中飞行当前任务信息
var selectCopterInfos = _flightTaskManager.SelectedTask.SingleCopterInfos.FindAll(delegate (FlightTaskSingleCopterInfo p)
{
return _copterManager.SelectedCopters.Contains(p.Copter);
});
foreach (var copterInfo in selectCopterInfos)
{
// AlignmentTime
double leddelay = 0;
foreach (LEDInfo led in copterInfo.LEDInfos)
{
leddelay += led.Delay;
}
if (leddelay > AlignmentTime)
{
Alert.Show($"{AlignmentTime}秒对齐时间不够,ID={copterInfo.Copter.Id}飞机的航点灯光时长为{leddelay}秒", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
}
foreach (var copterInfo in selectCopterInfos)
{
double leddelay = 0;
foreach (LEDInfo led in copterInfo.LEDInfos)
{
leddelay += led.Delay;
}
if (leddelay<= AlignmentTime)
{
LEDInfo endLed = new LEDInfo();
endLed.LEDMode = 0;
endLed.Delay = AlignmentTime - leddelay;
endLed.LEDRGB = copterInfo.LEDInfos[copterInfo.LEDInfos.Count - 1].LEDRGB;
copterInfo.AddLEDInfo(endLed);
}
}
}));
}
}
#endregion
//渐变色
@ -1889,9 +2130,23 @@ public ICommand VerticlAlignmentCommand
return _SetGradientRampCommand ?? (_SetGradientRampCommand = new RelayCommand(async () =>
{
float CopterDirection = 90 - (float)GradualDirection;
if (_copterManager.SelectedCopters.Count() <= 0)
return;
//旋转飞机矩阵
if (CopterDirection != 0)
{
LevelRotateCommand.Execute(CopterDirection);
await Task.Delay(100);
}
double minLat, maxLat;
double minLng, maxLng;
@ -1936,6 +2191,10 @@ public ICommand VerticlAlignmentCommand
}
await Task.Delay(100);
//旋转飞机矩阵
if (CopterDirection != 0)
LevelRotateCommand.Execute(0 - CopterDirection);
}));
}
}

View File

@ -214,6 +214,7 @@
<TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left"
Text="高度: " />
<TextBox Grid.Row="2"
Height="24"
Grid.Column="2"
Margin="0,5,5,0"
VerticalContentAlignment="Center"
@ -235,7 +236,7 @@
</Grid.ColumnDefinitions>
<CheckBox Content="返航点" ToolTip="勾选后航点仅高度有用,经纬度无效,无视原点自动飞回起飞点" Margin="0,2,0,0" IsChecked="{Binding IsLandWaypoint,UpdateSourceTrigger=PropertyChanged}" />
<CheckBox Content="返航点" ToolTip="勾选后航点仅高度有用,经纬度无效,无视原点自动飞回起飞点" Margin="0,5,0,0" IsChecked="{Binding IsLandWaypoint,UpdateSourceTrigger=PropertyChanged}" />
<Button Content="应用到所选" Margin="0,2,5,0" Command="{Binding SetIsLandCommand}" Grid.Column="1"/>
@ -253,7 +254,7 @@
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<CheckBox Content="改变速度" Margin="0,2"
<CheckBox Content="改变速度" Margin="0,3"
IsChecked="{Binding IsChangeSpeed, UpdateSourceTrigger=PropertyChanged}"/>
<StackPanel Margin="0,0" Grid.Column="1">
<TextBlock Text="水平" Margin="0,0,5,5" VerticalAlignment="Center" HorizontalAlignment="Left"/>
@ -303,75 +304,151 @@
</TabItem>
<TabItem Header="灯光设计">
<StackPanel>
<StackPanel x:Name="lightDesign">
<StackPanel Orientation="Horizontal" Margin="0,5,0,5" >
<TextBlock Margin="5,7,0,0" Text="变换颜色"/>
<TextBox Margin="5,5,40,3" Width="60" Text="{Binding ChangeRGB}"
MouseDoubleClick="TextBox_MouseDoubleClick"/>
<TextBlock Margin="5,7,0,0" Text="起始时间"/>
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding BeginTime}"/>
<TextBlock Margin="5,7,0,0" Text="结束时间"/>
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding EndTime}"/>
<TextBlock Margin="5,7,0,0" Text="分层"/>
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding AverageSum}"/>
<Button Width="80" Content="灯带" Margin="10,0,0,0"
<StackPanel x:Name="lightDesign">
<StackPanel Orientation="Horizontal" Margin="0,5,0,5" >
<TextBlock Margin="5,7,0,0" Text="扫光颜色"/>
<TextBox Height="25" Margin="5,3,5,3" Width="55" Text="{Binding ChangeRGB, UpdateSourceTrigger=PropertyChanged}"
ToolTip="灯带或跑马灯扫过的颜色"
Foreground="Black"
Background="{Binding DrawChangeRGB, UpdateSourceTrigger=PropertyChanged}"
MouseDoubleClick="TextBox_MouseDoubleClick"/>
<TextBlock Margin="0,7,0,0" Text="方向"/>
<TextBox Height="25"
ToolTip="默认90度表示从左到右扫过0度从下向上扫"
Margin="5,3,0,3" Width="30" Text="{Binding BeltDirection}"/>
<TextBlock Margin="5,7,0,0" Text="起始时间"/>
<TextBox Height="25"
ToolTip="扫光开始时间"
Margin="5,3,0,3" Width="30" Text="{Binding BeginTime}"/>
<TextBlock Margin="5,7,0,0" Text="结束时间"/>
<TextBox Height="25" Margin="5,3,0,3" Width="30" Text="{Binding EndTime}"
ToolTip="扫光完成时间" />
<TextBlock Margin="5,7,0,0" Text="分段"/>
<TextBox Height="25" Margin="5,3,0,3" Width="30" Text="{Binding AverageSum}"
ToolTip="图案分成几段扫过,段数越多灯带越窄,同样时间扫得越快" />
<Button Width="78" Content="灯带" Margin="10,0,0,0"
ToolTip="选择的飞机用一个光带扫过"
Command="{Binding SetHorseRaceLampCommand}" HorizontalAlignment="Right"/>
</StackPanel>
<Grid >
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock Margin="5,7,0,0" Text="结束颜色"/>
<TextBox Margin="5,5,40,3" Width="60" Text="{Binding EndRGB}" ToolTip="设置为0表示变换后回到原色"
MouseDoubleClick="TextBox_MouseDoubleClick"/>
<TextBlock Margin="5,7,0,0" Text="起始时间"/>
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding StrokesTime}"/>
<TextBlock Margin="5,7,0,0" Text="频率•"/>
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding IntervalTime}"/>
<TextBlock Margin="5,7,0,0" Text="œ˜变换数量"/>
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding SingleNum}"/>
<Button Width="80" Content="跑马灯" Margin="10,0,0,0"
Command="{Binding SetStrokesLampCommamd}" HorizontalAlignment="Right"/>
</StackPanel>
</Grid>
<Separator Margin="5,5,5,5" />
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5,7,0,0" Text="时间"/>
<TextBox Margin="5,5,0,3" Width="30" Text="{Binding GradientRampTime}"/>
<TextBlock Margin="5,7,0,0" Text="起始色"/>
<TextBox Margin="5,5,0,3" Width="60" Text="{Binding LeftRGB}"
MouseDoubleClick="TextBox_MouseDoubleClick"/>
<TextBlock Margin="5,7,0,0" Text="结束色"/>
<TextBox Margin="5,5,0,3" Width="60" Text="{Binding RightRGB}"
MouseDoubleClick="TextBox_MouseDoubleClick"/>
<Button Margin="10,5,0,3" Width="120" Content="设置渐变灯"
Command="{Binding SetGradientRampCommand}" />
</StackPanel>
<Separator Margin="5,5,5,5" />
</StackPanel>
<Grid >
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock Margin="5,7,0,0" Text="结束颜色"/>
<TextBox Height="25" Margin="5,3,40,3" Width="55" Text="{Binding EndRGB, UpdateSourceTrigger=PropertyChanged}" ToolTip="设置为0表示扫过后回到原色"
Foreground="Black"
Background="{Binding DrawEndRGB, UpdateSourceTrigger=PropertyChanged}"
MouseDoubleClick="TextBox_MouseDoubleClick"/>
<TextBlock Margin="29,7,0,0" Text="起始时间"/>
<TextBox Height="25" Margin="5,3,0,3" Width="30" Text="{Binding StrokesTime}"
ToolTip="跑马灯开始时间" />
<TextBlock Margin="5,7,0,0" Text="œ˜扫光数量"/>
<TextBox Height="25" Margin="5,3,0,3" Width="30" Text="{Binding SingleNum}"
ToolTip="一次扫光改变颜色的数量" />
<TextBlock Margin="5,7,0,0" Text="间隔•"/>
<TextBox Height="25" Margin="5,3,0,3" Width="30" Text="{Binding IntervalTime}"
ToolTip="下一个扫光的间隔(秒)" />
<Button Width="78" Content="跑马灯" Margin="10,0,0,0"
Command="{Binding SetStrokesLampCommamd}" HorizontalAlignment="Right"
ToolTip="根据航点选择的顺序改变为扫光的颜色,经过扫光的航点变为结束颜色"
/>
</StackPanel>
</Grid>
<Separator Margin="5,5,5,5" />
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5,7,3,0" Text="时间"/>
<TextBox Height="25" Margin="5,2,3,3" Width="30" Text="{Binding GradientRampTime}"
ToolTip="开始时间" />
<TextBlock Margin="5,7,3,0" Text="方向"/>
<TextBox Height="25" Margin="5,2,5,3" Width="30" Text="{Binding GradualDirection}"
ToolTip="默认90度表示从左到右渐变0度从下向上渐变" />
<TextBlock Margin="5,7,3,0" Text="起始颜色"/>
<TextBox Height="25" Margin="5,2,3,3" Width="55" Text="{Binding LeftRGB, UpdateSourceTrigger=PropertyChanged}"
Foreground="Black"
ToolTip="渐变起始颜色"
Background="{Binding DrawLeftRGB, UpdateSourceTrigger=PropertyChanged}"
MouseDoubleClick="TextBox_MouseDoubleClick"/>
<TextBlock Margin="5,7,3,0" Text="结束颜色"/>
<TextBox Height="25" Margin="5,2,7,3" Width="55" Text="{Binding RightRGB, UpdateSourceTrigger=PropertyChanged}"
Foreground="Black"
ToolTip="渐变结束颜色"
Background="{Binding DrawRightRGB, UpdateSourceTrigger=PropertyChanged}"
MouseDoubleClick="TextBox_MouseDoubleClick"/>
<Button Margin="42,0,0,3" Width="78" Content="渐变灯"
ToolTip="自动生成渐变过度颜色"
Command="{Binding SetGradientRampCommand}" />
</StackPanel>
<Separator Margin="5,5,5,5" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,12,0" >
<Button Margin="5,0,0,3" Content="最长时间" Width="90"
ToolTip="查询所有选择飞机最长灯光时间"
Command="{Binding QueryMAXTimeCommand}" />
<TextBlock Margin="5,7,3,0" Text="时间对齐"/>
<TextBox Height="25" Margin="5,2,3,3" Width="30" Text="{Binding AlignmentTime}"
ToolTip="对齐时间(秒)" />
<Button Margin="5,0,0,3" Content="对齐" Width="78"
ToolTip="所有飞机灯光时间对齐到指定秒数,便于做第二个灯带或跑马灯"
Command="{Binding AlignmentTimeCommand}" />
</StackPanel>
<Separator Margin="5,5,5,5" />
</StackPanel>
</TabItem>
<TabItem Header="灯光列表">
<StackPanel>
<StackPanel DataContext="{Binding FlightTaskManager.SelectedTask.ModifyingSingleCopterInfo}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="33*"/>
<ColumnDefinition Width="89*"/>
<ColumnDefinition Width="40*"/>
<ColumnDefinition Width="61*"/>
<ColumnDefinition Width="61*"/>
<ColumnDefinition Width="61*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="灯光控制" Margin="5,7,5,2" VerticalAlignment="Center" Height="15"/>
<Grid Grid.Column="1" Grid.ColumnSpan="3" VerticalAlignment="Center" Height="34">
<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"/>
</StackPanel>
<Grid Grid.Column="1" Grid.ColumnSpan="3" VerticalAlignment="Center" Height="34">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Content="应用到全部" VerticalAlignment="Center"
<Button Content="应用全部" VerticalAlignment="Center"
Margin="0,5,5,0"
Command="{Binding SetAllCopterLEDCommand}" />
<Button Content="应用到所选" VerticalAlignment="Center"
<Button Content="应用所选" VerticalAlignment="Center"
Margin="0,5,5,0"
Grid.Column="1"
Command="{Binding SetSelectedCopterLEDCommand}" />
@ -396,8 +473,8 @@
Grid.Row="1"
Grid.ColumnSpan="2"
MinHeight="100"
Height="206"
MaxHeight="280"
Height="346"
MaxHeight="400"
ScrollViewer.VerticalScrollBarVisibility="Visible"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ItemsSource="{Binding Path= LEDInfos}">
@ -417,7 +494,7 @@
<DataTemplate>
<StackPanel Margin="0,5,0,0" Orientation="Horizontal" >
<TextBlock Text="类型" Margin="0,0,0,0" VerticalAlignment="Center" ></TextBlock>
<ComboBox MinWidth="125" Width="110" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center"
<ComboBox Height="25" MinWidth="125" Width="110" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center"
SelectedIndex="{Binding Path=LEDMode}">
<ComboBox.ItemContainerStyle>
<Style>
@ -427,35 +504,35 @@
<ComboBoxItem Content="常亮" />
<ComboBoxItem Content="同步闪烁(单色)" />
<ComboBoxItem Content="异步闪烁(随机)" />
<ComboBoxItem Content="渐亮" />
<ComboBoxItem Content="渐暗" />
<ComboBoxItem Content="呼吸灯" />
<ComboBoxItem Content="同步闪烁(随机)" />
<ComboBoxItem Content="异步闪烁(单色)" />
<ComboBoxItem Content="渐亮" />
<ComboBoxItem Content="渐暗" />
<ComboBoxItem Content="呼吸灯(单色)" />
<ComboBoxItem Content="呼吸灯(随机)" />
<ComboBoxItem Content="异步呼吸(单色)" />
<ComboBoxItem Content="异步呼吸(随机)" />
<ComboBoxItem Content="拉烟"/>
</ComboBox>
<TextBlock Text="时间" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
<TextBox MinWidth="40" MaxWidth="45" Margin="5,0,0,0"
<TextBox Height="25" MinWidth="40" MaxWidth="45" Margin="5,0,0,0"
ToolTip="单位:秒最小设置0.1秒"
Text="{Binding Delay,UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="间隔" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
<TextBox MinWidth="35" MaxWidth="40" Margin="5,0,0,0"
<TextBox Height="25" MinWidth="35" MaxWidth="40" Margin="5,0,0,0"
ToolTip="单位:秒最小设置0.1秒"
Text="{Binding Path=LEDInterval, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="颜色" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
<TextBox Margin="5,0,0,0" MinWidth="50" Width="50"
Text="{Binding LEDRGB, UpdateSourceTrigger=PropertyChanged}"
MouseDoubleClick="TextBox_MouseDoubleClick"
<TextBox Height="25" Margin="5,0,0,0" MinWidth="50" Width="55"
Text="{Binding LEDRGB, UpdateSourceTrigger=PropertyChanged}"
Foreground="Black"
Background="{Binding DrawRGB, UpdateSourceTrigger=PropertyChanged}"
MouseDoubleClick="TextBox_MouseDoubleClick"
/>
<Button Content="删除" Margin="12,0,0,0"
Command="{Binding RemoveLEDCommand}"/>

View File

@ -83,6 +83,7 @@ namespace Plane.FormationCreator.Views
(sender as TextBox).Text = String.Format("{0:X2}", colorDialog.Color.R) +
String.Format("{0:X2}", colorDialog.Color.G) +
String.Format("{0:X2}", colorDialog.Color.B);
}
}