任务航点的改名功能
This commit is contained in:
parent
b88ed4486e
commit
6da2a6f7a6
@ -66,16 +66,21 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
get
|
||||
{
|
||||
Windows.Messages.Message.Show(_TaskName);
|
||||
string name = "";
|
||||
switch (TaskType)
|
||||
{
|
||||
case FlightTaskType.TakeOff: _TaskName = "起飞"; break;
|
||||
case FlightTaskType.FlyTo: _TaskName = _TaskName == "" ? "航点" : _TaskName; break;
|
||||
case FlightTaskType.Land: _TaskName = "降落"; break;
|
||||
case FlightTaskType.TakeOff: name = "起飞"; break;
|
||||
case FlightTaskType.FlyTo: name = _TaskName == "" ? "航点" : _TaskName; break;
|
||||
case FlightTaskType.Land: name = "降落"; break;
|
||||
}
|
||||
_TaskName = (TaskIndex + 1).ToString() + "." + _TaskName;
|
||||
return _TaskName;
|
||||
//name = (TaskIndex + 1).ToString() + "." + name;
|
||||
return name;
|
||||
}
|
||||
set {
|
||||
Set(nameof(TaskCnName), ref _TaskName, value);
|
||||
Windows.Messages.Message.Show(_TaskName);
|
||||
}
|
||||
set { Set(nameof(TaskCnName), ref _TaskName, value); }
|
||||
}
|
||||
|
||||
public int TaskTypeIndex
|
||||
@ -110,6 +115,14 @@ namespace Plane.FormationCreator.Formation
|
||||
}
|
||||
}
|
||||
|
||||
public int TaskNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return TaskIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _IsSelected;
|
||||
public bool IsSelected
|
||||
{
|
||||
|
@ -188,6 +188,9 @@
|
||||
<Compile Include="ModifyParam.xaml.cs">
|
||||
<DependentUpon>ModifyParam.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PlaneMessageBox.xaml.cs">
|
||||
<DependentUpon>PlaneMessageBox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ServiceLocatorConfigurer.cs" />
|
||||
<Compile Include="Test.cs" />
|
||||
<Compile Include="CalculationLogLatDistance.cs" />
|
||||
@ -291,6 +294,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="PlaneMessageBox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Properties\DesignTimeResources.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
31
Plane.FormationCreator/PlaneMessageBox.xaml
Normal file
31
Plane.FormationCreator/PlaneMessageBox.xaml
Normal file
@ -0,0 +1,31 @@
|
||||
<c:MetroWindow x:Class="Plane.FormationCreator.PlaneMessageBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:c="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:local="clr-namespace:Plane.FormationCreator"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
TitleForeground="White"
|
||||
FontSize="15"
|
||||
Title="PlaneMessageBox" Height="200" Width="500"
|
||||
MinHeight="200" MinWidth="500"
|
||||
MaxHeight="200" MaxWidth="500"
|
||||
WindowStyle="ToolWindow" Visibility="Visible" ShowMinButton="False" ShowMaxRestoreButton="False" ShowCloseButton="False" IsCloseButtonEnabled="False" IsMinButtonEnabled="False" IsMaxRestoreButtonEnabled="False" IsWindowDraggable="False"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Name="messageBoxText" Text="提示" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<TextBox Name="textbox" Width="350" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
PreviewKeyDown="Box_OnKeyDown"/>
|
||||
<WrapPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Button Width="80" Margin="25,0" Content="确认" Click="ButtonOK_Click"/>
|
||||
<Button Width="80" Margin="25,0" Content="取消" Click="ButtonCancel_Click"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</c:MetroWindow>
|
68
Plane.FormationCreator/PlaneMessageBox.xaml.cs
Normal file
68
Plane.FormationCreator/PlaneMessageBox.xaml.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using MahApps.Metro.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Plane.FormationCreator
|
||||
{
|
||||
/// <summary>
|
||||
/// PlaneMessageBox.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PlaneMessageBox : MetroWindow
|
||||
{
|
||||
private static PlaneMessageBox staticInstance = null;
|
||||
public static bool OnShow(string planmeMessageBox, string caption, ref string content)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if (staticInstance == null)
|
||||
{
|
||||
staticInstance = new PlaneMessageBox();
|
||||
}
|
||||
Windows.Messages.Message.Show("content = " + content);
|
||||
staticInstance.messageBoxText.Text = planmeMessageBox;
|
||||
staticInstance.Title = caption;
|
||||
staticInstance.textbox.Text = content;
|
||||
staticInstance.ShowDialog();
|
||||
ret = staticInstance.DialogResult == true;
|
||||
content = staticInstance.textbox.Text;
|
||||
staticInstance.Close();
|
||||
staticInstance = null;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public PlaneMessageBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ButtonOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
}
|
||||
|
||||
private void Box_OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
//todo 焦点问题没解决前不放出
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -100,13 +100,18 @@
|
||||
MouseLeftButtonUp="SelectTask"
|
||||
MouseRightButtonUp="HideTask">
|
||||
|
||||
<TextBlock Width="auto"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
<WrapPanel VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" >
|
||||
<TextBlock Width="auto"
|
||||
FontSize="12"
|
||||
Margin="0,0,2,0"
|
||||
Foreground="White"
|
||||
Text="{Binding TaskNum}"/>
|
||||
<TextBlock Width="auto"
|
||||
FontSize="12"
|
||||
Foreground="White"
|
||||
Text="{Binding TaskCnName}"
|
||||
/>
|
||||
Text="{Binding TaskCnName}"/>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
@ -38,7 +38,13 @@ namespace Plane.FormationCreator.Views
|
||||
{
|
||||
var elem = sender as FrameworkElement;
|
||||
var task = elem.DataContext as FlightTask;
|
||||
|
||||
if (task.TaskType != FlightTaskType.FlyTo) return;
|
||||
TasksControl.Focus();
|
||||
string newName = task.TaskCnName;
|
||||
if (PlaneMessageBox.OnShow("请输入新的名称", "重命名", ref newName))
|
||||
{
|
||||
task.TaskCnName = newName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user