From b88ed4486e091a22236f3571e4c644d4f9e92510 Mon Sep 17 00:00:00 2001 From: zxd Date: Tue, 16 Jul 2019 18:41:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E4=BF=AE=E6=94=B9=E8=88=AA?= =?UTF-8?q?=E7=82=B9=E7=9A=84=E8=87=AA=E5=AE=9A=E4=B9=89=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plane.FormationCreator/Formation/FlightTask.cs | 14 ++++++++------ Plane.FormationCreator/Views/TaskBarView.xaml | 4 +++- Plane.FormationCreator/Views/TaskBarView.xaml.cs | 11 +++++++++++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Plane.FormationCreator/Formation/FlightTask.cs b/Plane.FormationCreator/Formation/FlightTask.cs index 02a131e..581f00d 100644 --- a/Plane.FormationCreator/Formation/FlightTask.cs +++ b/Plane.FormationCreator/Formation/FlightTask.cs @@ -45,6 +45,7 @@ namespace Plane.FormationCreator.Formation } } + /* public int TaskTypeIndex { @@ -60,20 +61,21 @@ namespace Plane.FormationCreator.Formation } } */ - + private string _TaskName = ""; public string TaskCnName { get { - string CnName = ""; switch (TaskType) { - case FlightTaskType.TakeOff: CnName = (TaskIndex + 1).ToString() + ".起飞"; break; - case FlightTaskType.FlyTo: CnName = (TaskIndex + 1).ToString() + ".航点"; break; - case FlightTaskType.Land: CnName = (TaskIndex + 1).ToString() + ".降落"; break; + case FlightTaskType.TakeOff: _TaskName = "起飞"; break; + case FlightTaskType.FlyTo: _TaskName = _TaskName == "" ? "航点" : _TaskName; break; + case FlightTaskType.Land: _TaskName = "降落"; break; } - return CnName; + _TaskName = (TaskIndex + 1).ToString() + "." + _TaskName; + return _TaskName; } + set { Set(nameof(TaskCnName), ref _TaskName, value); } } public int TaskTypeIndex diff --git a/Plane.FormationCreator/Views/TaskBarView.xaml b/Plane.FormationCreator/Views/TaskBarView.xaml index 614c33d..9435114 100644 --- a/Plane.FormationCreator/Views/TaskBarView.xaml +++ b/Plane.FormationCreator/Views/TaskBarView.xaml @@ -96,6 +96,7 @@ BorderThickness="1" BorderBrush="Black" Effect="{Binding IsSelected, Converter={StaticResource FlightTaskIsSelectedToEffectConverter}}" + MouseLeftButtonDown="TaskLeftButtonDown" MouseLeftButtonUp="SelectTask" MouseRightButtonUp="HideTask"> @@ -104,7 +105,8 @@ HorizontalAlignment="Center" FontSize="12" Foreground="White" - Text="{Binding TaskCnName}" /> + Text="{Binding TaskCnName}" + /> diff --git a/Plane.FormationCreator/Views/TaskBarView.xaml.cs b/Plane.FormationCreator/Views/TaskBarView.xaml.cs index dab60b4..478a95b 100644 --- a/Plane.FormationCreator/Views/TaskBarView.xaml.cs +++ b/Plane.FormationCreator/Views/TaskBarView.xaml.cs @@ -32,6 +32,17 @@ namespace Plane.FormationCreator.Views private FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance(); + public void TaskLeftButtonDown(object sender, MouseButtonEventArgs e) + { + if (e.ClickCount > 1) + { + var elem = sender as FrameworkElement; + var task = elem.DataContext as FlightTask; + + } + } + + private void SelectTask(object sender, MouseButtonEventArgs e) { var elem = sender as FrameworkElement;