修改日志显示

This commit is contained in:
zxd 2018-09-07 10:36:30 +08:00
parent 5b194cb7bf
commit 80aa891a33
6 changed files with 62 additions and 14 deletions

View File

@ -28,7 +28,17 @@
<Setter Property="Margin"
Value="0,10" />
</Style>
<ContextMenu x:Key="LogMenu" >
<MenuItem Header="清除"
Command="{Binding ClearLogs}" Foreground="White"/>
</ContextMenu>
</c:MetroWindow.Resources>
<c:MetroWindow.RightWindowCommands>
<c:WindowCommands>
@ -49,7 +59,8 @@
Visibility="{Binding Source={x:Static local:AppEx.Current}, Path=AppMode, Converter={StaticResource AppModeToVisibilityConverter}, ConverterParameter=SwitchToControllingCoptersModeButton}" />-->
<Button Name="btnShowLog"
Content="日志"
Click="btnShowLog_Click" />
Click="btnShowLog_Click"
Visibility="Collapsed"/>
<Button Name="btnGoHome"
Content="回家"
Click="btnGoHome_Click" />
@ -171,11 +182,21 @@
Background="{StaticResource HighlightBrush}">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="4"
Text="{Binding Message}"/>
Text="{Binding Message}" MouseUp="LogShowHide"/>
<TextBlock Margin="4"
Text="{Binding CopterListViewModel.SelectedCopter.StatusText}" />
</StackPanel>
</Border>
<TextBox Name="logTextBox" Height="700" Width="600" Background="#FF2D2D2D"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Visibility="Hidden"
Text="{Binding Logs}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
TextChanged="LogTextChange"
IsReadOnly="True"
TextWrapping="Wrap"
ContextMenu="{StaticResource LogMenu}"/>
</Grid>
</c:MetroWindow>

View File

@ -483,6 +483,17 @@ namespace Plane.FormationCreator
logWindows.Show();
}
private void LogShowHide(object sender, MouseButtonEventArgs e)
{
if (logTextBox.Visibility == Visibility.Visible)
logTextBox.Visibility = Visibility.Hidden;
else
logTextBox.Visibility = Visibility.Visible;
}
private void LogTextChange(object sender, TextChangedEventArgs e)
{
logTextBox.ScrollToEnd();
}
}
}

View File

@ -335,12 +335,6 @@
<ItemGroup>
<Resource Include="bg.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="tiane.bmp" />
</ItemGroup>
<ItemGroup>
<Resource Include="tiane.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -134,9 +134,9 @@ namespace Plane.FormationCreator.ViewModels
var center = _mapManager.Center;
string id;
int colnum = 20; //自动生成列数=4
float coldis = 2.5f;//列相距5米
float rowdis = 5f;//行相距5米
int colnum = 5; //自动生成列数=4
float coldis = 3.5f;//列相距5米
float rowdis = 3f;//行相距5米
int currcol = 0; //当前列号
int currrow = 0; //当前行
Tuple<double, double> colheadLatLng = new Tuple<double, double>(0, 0);

View File

@ -59,16 +59,25 @@ namespace Plane.FormationCreator.ViewModels
set
{
Set(nameof(Message), ref _Message, value);
_MessageList.Add(value);
Logs += (Environment.NewLine + value);
}
}
private List<string> _MessageList = new List<string>();
public string Messages
{
get { return string.Join("\r\n", _MessageList.ToArray()); }
}
private string _Logs = "----------软件日志----------";
public string Logs
{
get { return _Logs; }
set { Set(nameof(Logs), ref _Logs, value); }
}
private ICommand _RestartListeningCommand;
public ICommand RestartListeningCommand
{
@ -211,6 +220,18 @@ namespace Plane.FormationCreator.ViewModels
}
}
private ICommand _ClearLogs;
public ICommand ClearLogs
{
get
{
return _ClearLogs ?? (_ClearLogs = new RelayCommand(() =>
{
Logs = "";
}));
}
}
private string GetSwitchVelocityModeButtonContent()
=> AppEx.Current.IsInFastMode ? "高速模式" : "低速模式";
}

View File

@ -9,6 +9,7 @@
mc:Ignorable="d"
Style="{StaticResource VSWindowStyleKey}"
Title="日志" Height="776.219" Width="1195.283">
<Grid>
<TabControl>
<TabItem Header="软件日志">
@ -18,7 +19,7 @@
VerticalAlignment="Stretch"
Margin="10,10,10,10"
TextWrapping="Wrap"
IsReadOnly="True"
IsReadOnly="True"
ScrollViewer.VerticalScrollBarVisibility="Visible"/>
</TabItem>
<TabItem Header="飞机日志">