Made a new LogPage for showing the logfile as opposed to opening it with an external app, for android's sake
This commit is contained in:
@@ -12,8 +12,16 @@
|
|||||||
<TextBox Grid.Column="1" x:Name="SearchBox" Watermark="Search..." VerticalContentAlignment="Center"/>
|
<TextBox Grid.Column="1" x:Name="SearchBox" Watermark="Search..." VerticalContentAlignment="Center"/>
|
||||||
<Button x:Name="SearchButton" Classes="icon" Grid.Column="2" Content="" VerticalAlignment="Center" />
|
<Button x:Name="SearchButton" Classes="icon" Grid.Column="2" Content="" VerticalAlignment="Center" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<StackPanel x:Name="CritterStack" HorizontalAlignment="Stretch" Spacing="10" />
|
<StackPanel x:Name="CritterStack" HorizontalAlignment="Stretch" Spacing="10" />
|
||||||
|
|
||||||
|
<Label x:Name="NoResultsLabel"
|
||||||
|
Foreground="{DynamicResource PrimaryForeground}"
|
||||||
|
FontSize="15"
|
||||||
|
Content="No results"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
IsVisible="False"/>
|
||||||
|
|
||||||
<Button x:Name="AddButton" Classes="icon" HorizontalAlignment="Stretch"></Button>
|
<Button x:Name="AddButton" Classes="icon" HorizontalAlignment="Stretch"></Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
10
critterfolio/CritterFolio/CritterFolio/Pages/LogPage.axaml
Normal file
10
critterfolio/CritterFolio/CritterFolio/Pages/LogPage.axaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="CritterFolio.Pages.LogPage">
|
||||||
|
<ScrollViewer>
|
||||||
|
<TextBox x:Name="OutputBox" IsReadOnly="True" />
|
||||||
|
</ScrollViewer>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace CritterFolio.Pages;
|
||||||
|
|
||||||
|
public partial class LogPage : Page
|
||||||
|
{
|
||||||
|
public LogPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Refresh()
|
||||||
|
{
|
||||||
|
var path = Path.Combine(AppContext.BaseDirectory, "log.txt");
|
||||||
|
if (!File.Exists(path)) return;
|
||||||
|
var text = File.ReadAllText(path);
|
||||||
|
OutputBox.Text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,12 +24,7 @@ public partial class TestPage : Page
|
|||||||
|
|
||||||
private void OpenLogButtonClicked(object? sender, RoutedEventArgs args)
|
private void OpenLogButtonClicked(object? sender, RoutedEventArgs args)
|
||||||
{
|
{
|
||||||
var logFilePath = Path.Combine(AppContext.BaseDirectory, "log.txt");
|
Sys.Navigation?.PushPage(new LogPage());
|
||||||
if (!File.Exists(logFilePath)) return;
|
|
||||||
var launcher = TopLevel.GetTopLevel(this)?.Launcher;
|
|
||||||
if (launcher is null) return;
|
|
||||||
|
|
||||||
launcher.LaunchUriAsync(new Uri("file://" + logFilePath));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user