灯光频率改为间隔
可以选择颜色
This commit is contained in:
parent
e1c81f28ff
commit
62a7b8b028
@ -123,7 +123,7 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
Thread.Sleep((int)vLEDInfo.Delay * 1000);
|
||||
if (!LEDTestRun) break;
|
||||
_commModuleManager.LED_TaskAsync(vLEDInfo.LEDMode, vLEDInfo.LEDRate, vLEDInfo.LEDTimes, vLEDInfo.LEDRGB, this.Copter);
|
||||
_commModuleManager.LED_TaskAsync(vLEDInfo.LEDMode, vLEDInfo.LEDInterval, vLEDInfo.LEDTimes, vLEDInfo.LEDRGB, this.Copter);
|
||||
}
|
||||
//LEDTestRun = false;
|
||||
});
|
||||
@ -170,7 +170,7 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
private double delay = 1; //灯光延时 单位:100ms (从当前任务开为0,延时几秒后设置LED)
|
||||
private int ledmode = 0; //灯光模式 0常亮 1闪烁 2随机闪烁(RGB无意义)
|
||||
private float ledRate = 0; //闪烁延时 单位:100ms
|
||||
private float ledInterval = 0; //闪烁延时 单位:秒
|
||||
private int ledtimes = 0; //次数 (预留、暂取消其意义)
|
||||
private string ledRGB = "FFFFFF"; //灯光颜色
|
||||
|
||||
@ -183,7 +183,7 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
delay = led.delay;
|
||||
ledmode = led.ledmode;
|
||||
ledRate = led.ledRate;
|
||||
ledInterval = led.ledInterval;
|
||||
ledRGB = led.ledRGB;
|
||||
}
|
||||
public double Delay
|
||||
@ -197,10 +197,10 @@ namespace Plane.FormationCreator.Formation
|
||||
get { return ledmode; }
|
||||
set { ledmode = value; }
|
||||
}
|
||||
public float LEDRate
|
||||
public float LEDInterval
|
||||
{
|
||||
get { return ledRate; }
|
||||
set { ledRate = value; }
|
||||
get { return ledInterval; }
|
||||
set { ledInterval = value; }
|
||||
}
|
||||
public int LEDTimes
|
||||
{
|
||||
|
@ -285,7 +285,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
IMission LEDMission = Mission.CreateLEDControlMission(
|
||||
(int)(ledInfo.Delay * 10),
|
||||
ledInfo.LEDMode,
|
||||
ledInfo.LEDRate,
|
||||
ledInfo.LEDInterval,
|
||||
0, //ledInfo.LEDTimes,
|
||||
color.R,
|
||||
color.G,
|
||||
|
@ -1518,7 +1518,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
IMission LEDMission = Mission.CreateLEDControlMission(
|
||||
(int)(ledInfo.Delay * 10),
|
||||
ledMode,
|
||||
ledInfo.LEDRate,
|
||||
ledInfo.LEDInterval,
|
||||
0, //ledInfo.LEDTimes,
|
||||
color.R,
|
||||
color.G,
|
||||
|
@ -308,7 +308,8 @@
|
||||
<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}"/>
|
||||
<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="结束时间"/>
|
||||
@ -322,7 +323,8 @@
|
||||
<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,表示变换后回到原色"/>
|
||||
<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="频率"/>
|
||||
@ -340,9 +342,11 @@
|
||||
<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}"/>
|
||||
<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}"/>
|
||||
<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>
|
||||
@ -413,7 +417,7 @@
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="0,5,0,0" Orientation="Horizontal" >
|
||||
<TextBlock Text="类型" Margin="0,0,0,0" VerticalAlignment="Center" ></TextBlock>
|
||||
<ComboBox MinWidth="125" Width="125" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center"
|
||||
<ComboBox MinWidth="125" Width="110" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center"
|
||||
SelectedIndex="{Binding Path=LEDMode}">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style>
|
||||
@ -428,6 +432,11 @@
|
||||
<ComboBoxItem Content="呼吸灯" />
|
||||
<ComboBoxItem Content="同步闪烁(随机)" />
|
||||
<ComboBoxItem Content="异步闪烁(单色)" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ComboBoxItem Content="拉烟"/>
|
||||
</ComboBox>
|
||||
|
||||
@ -436,13 +445,16 @@
|
||||
ToolTip="单位:秒,最小设置0.1秒"
|
||||
Text="{Binding Delay,UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<TextBlock Text="频率" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
|
||||
<TextBox MinWidth="40" MaxWidth="45" Margin="5,0,0,0"
|
||||
Text="{Binding Path=LEDRate, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Text="间隔" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
|
||||
<TextBox 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}" />
|
||||
<TextBox Margin="5,0,0,0" MinWidth="50" Width="50"
|
||||
Text="{Binding LEDRGB, UpdateSourceTrigger=PropertyChanged}"
|
||||
MouseDoubleClick="TextBox_MouseDoubleClick"
|
||||
/>
|
||||
|
||||
<Button Content="删除" Margin="12,0,0,0"
|
||||
Command="{Binding RemoveLEDCommand}"/>
|
||||
|
@ -17,14 +17,17 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Plane.Geography;
|
||||
using Plane.FormationCreator.Util;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Plane.FormationCreator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ModifyTaskView.xaml
|
||||
/// </summary>
|
||||
|
||||
public partial class ModifyTaskView : UserControl
|
||||
{
|
||||
private int[] defcolor= { 255, 65280, 16711680, 65535 , 16711935, 16776960,0 };
|
||||
ModifyTaskViewModel _modifyTaskViewModel = ServiceLocator.Current.GetInstance<ModifyTaskViewModel>();
|
||||
public ModifyTaskView()
|
||||
{
|
||||
@ -60,7 +63,28 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
}
|
||||
|
||||
private void TextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
|
||||
colorDialog.CustomColors = defcolor;
|
||||
try
|
||||
{
|
||||
colorDialog.Color = ColorTranslator.FromHtml("#" + (sender as TextBox).Text);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
colorDialog.Color = System.Drawing.Color.White;
|
||||
}
|
||||
|
||||
|
||||
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
defcolor = colorDialog.CustomColors;
|
||||
(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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user