添加LED控制:
选择Copter闪烁一下; 控制Copter的灯光开关
This commit is contained in:
parent
273988c34a
commit
27d8974ee9
@ -29,6 +29,10 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
_copterManager.SelectedCoptersChanged += (sender, e) =>
|
||||
{
|
||||
foreach (ICopter copter in _copterManager.SelectedCopters)
|
||||
{
|
||||
copter.LEDAsync();
|
||||
}
|
||||
// TODO: 林俊清, 20150803, 处理选中多个飞行器的情况。
|
||||
if (_copterManager.SelectedCopters.Count() > 1)
|
||||
{
|
||||
@ -49,6 +53,9 @@ namespace Plane.FormationCreator.Formation
|
||||
}
|
||||
if (selectedCopter!=null)
|
||||
selectedCopter.SetShowLEDFlashAsync(1, 100);
|
||||
|
||||
if (selectedCopter != null)
|
||||
selectedCopter.LEDAsync();
|
||||
};
|
||||
|
||||
TaskAdded += (sender, e) =>
|
||||
|
@ -91,6 +91,30 @@ namespace Plane.FormationCreator.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private const string NTF_GROUPLED_OFF = "NTF_GROUPLED_OFF";
|
||||
private ICommand _LEDOnOffCommand;
|
||||
public ICommand LEDOnOffCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return _LEDOnOffCommand ?? (_LEDOnOffCommand = new RelayCommand(async () =>
|
||||
{
|
||||
string paramstr = NTF_GROUPLED_OFF;
|
||||
float paramvalue = 0;
|
||||
await Task.WhenAll(
|
||||
_copterManager.AcceptingControlCopters.Select(async copter =>
|
||||
{
|
||||
paramvalue = await copter.GetParamAsync(paramstr);
|
||||
}));
|
||||
|
||||
float newParamvalue = paramvalue == 0 ? 1 : 0;
|
||||
|
||||
await Task.WhenAll(_copterManager.AcceptingControlCopters.Select
|
||||
(copter => copter.SetParamAsync(paramstr, newParamvalue)));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _UnlockCommand;
|
||||
public ICommand UnlockCommand
|
||||
{
|
||||
|
@ -56,10 +56,11 @@
|
||||
<Button Content="跳过"
|
||||
Command="{Binding FlagCommand}" />
|
||||
<Button Content="测试"
|
||||
|
||||
Command="{Binding TestCommand}" />
|
||||
<Button Content="开/关灯"
|
||||
Command="{Binding LEDOnOffCommand}" />
|
||||
<TextBox Width="50"
|
||||
Visibility="Hidden"
|
||||
Visibility="Hidden"
|
||||
Text="{Binding AltP, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
|
@ -364,12 +364,20 @@ namespace Plane.FormationCreator.Views
|
||||
{
|
||||
Point curPoint = new Point(kv.Value.X + offsetX, kv.Value.Y + offsetY);
|
||||
var curLoc = _map.ViewportPointToLocation(curPoint);
|
||||
var routePoint = this.Route.Locations[taskIndex];
|
||||
|
||||
var modifyingSingleCopterInfo = _flightTaskManager.SelectedTask.SingleCopterInfos.Find(i => i.Copter == kv.Key);
|
||||
modifyingSingleCopterInfo.TargetLat = routePoint.Latitude = curLoc.Latitude;
|
||||
modifyingSingleCopterInfo.TargetLng = routePoint.Longitude = curLoc.Longitude;
|
||||
//modifyingSingleCopterInfo.TargetLat = routePoint.Latitude = curLoc.Latitude;
|
||||
//modifyingSingleCopterInfo.TargetLng = routePoint.Longitude = curLoc.Longitude;
|
||||
modifyingSingleCopterInfo.TargetLat = curLoc.Latitude;
|
||||
modifyingSingleCopterInfo.TargetLng = curLoc.Longitude;
|
||||
|
||||
}
|
||||
|
||||
var routePoint = this.Route.Locations[taskIndex];
|
||||
var leftTopPos = new Point(eventPos.X - wpOffsetX, eventPos.Y - wpOffsetY);
|
||||
var newRoutePoint = new Point(leftTopPos.X + WAYPOINT_RADIUS, leftTopPos.Y + WAYPOINT_RADIUS);
|
||||
routePoint.Latitude = _map.ViewportPointToLocation(newRoutePoint).Latitude;
|
||||
routePoint.Longitude = _map.ViewportPointToLocation(newRoutePoint).Longitude;
|
||||
MapLayer.SetPosition(wp, _map.ViewportPointToLocation(leftTopPos));
|
||||
}
|
||||
};
|
||||
|
@ -242,9 +242,16 @@
|
||||
<TextBlock Text="类型" Margin="0,0,0,0" VerticalAlignment="Center" ></TextBlock>
|
||||
<ComboBox MinWidth="80" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center"
|
||||
SelectedIndex="{Binding Path=LEDMode}">
|
||||
<ComboBoxItem Content="常亮" Foreground="White" />
|
||||
<ComboBoxItem Content="闪烁" Foreground="White"/>
|
||||
<ComboBoxItem Content="随机" Foreground="White"/>
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style>
|
||||
<Setter Property="ComboBoxItem.Foreground" Value="White"/>
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
<ComboBoxItem Content="常亮" />
|
||||
<ComboBoxItem Content="闪烁" />
|
||||
<ComboBoxItem Content="随机" />
|
||||
<ComboBoxItem Content="渐亮" />
|
||||
<ComboBoxItem Content="渐暗" />
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Text="时间" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
|
||||
|
Loading…
Reference in New Issue
Block a user