diff --git a/Plane.FormationCreator/Formation/FlightTaskManager.cs b/Plane.FormationCreator/Formation/FlightTaskManager.cs index ce98b8f..1b14345 100644 --- a/Plane.FormationCreator/Formation/FlightTaskManager.cs +++ b/Plane.FormationCreator/Formation/FlightTaskManager.cs @@ -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) => diff --git a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs index 420a3b3..31b678f 100644 --- a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs @@ -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 { diff --git a/Plane.FormationCreator/Views/ControlPanelView.xaml b/Plane.FormationCreator/Views/ControlPanelView.xaml index 352967e..b9655fe 100644 --- a/Plane.FormationCreator/Views/ControlPanelView.xaml +++ b/Plane.FormationCreator/Views/ControlPanelView.xaml @@ -56,10 +56,11 @@