-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05185e9
commit 53a6488
Showing
8 changed files
with
145 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.ContextMenu.LogTracer" | ||
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:local="clr-namespace:Bloxstrap.UI.Elements.ContextMenu" | ||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" | ||
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels.ContextMenu" | ||
d:DataContext="{d:DesignInstance Type=models:LogTracerViewModel}" | ||
mc:Ignorable="d" | ||
Title="Log tracer" | ||
Width="800" | ||
Height="480" | ||
Background="{ui:ThemeResource ApplicationBackgroundBrush}" | ||
ExtendsContentIntoTitleBar="True" | ||
WindowStartupLocation="CenterScreen"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
|
||
<ui:TitleBar Grid.Row="0" Grid.ColumnSpan="2" Padding="8" x:Name="RootTitleBar" Title="Log tracer" ShowMinimize="True" ShowMaximize="True" CanMaximize="True" KeyboardNavigation.TabNavigation="None" Icon="pack://application:,,,/Bloxstrap.ico" /> | ||
|
||
<TextBlock Grid.Row="1" Padding="12" Text="{Binding LogLocation, Mode=OneWay, StringFormat='Tracing \{0\}'}" /> | ||
|
||
<ScrollViewer x:Name="ScrollViewer" Grid.Row="2"> | ||
<RichTextBox Grid.Row="1" Block.LineHeight="2" IsReadOnly="True" Background="Transparent" BorderThickness="0" TextChanged="RichTextBox_TextChanged"> | ||
<FlowDocument x:Name="FlowDocument"> | ||
<Paragraph FontFamily="Courier New" FontSize="14"> | ||
<Run Text="{Binding LogContents, Mode=OneWay}" /> | ||
</Paragraph> | ||
</FlowDocument> | ||
</RichTextBox> | ||
</ScrollViewer> | ||
</Grid> | ||
</ui:UiWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Windows.Controls; | ||
|
||
using Bloxstrap.UI.ViewModels.ContextMenu; | ||
|
||
namespace Bloxstrap.UI.Elements.ContextMenu | ||
{ | ||
/// <summary> | ||
/// Interaction logic for LogTracer.xaml | ||
/// </summary> | ||
public partial class LogTracer | ||
{ | ||
private readonly LogTracerViewModel _viewModel; | ||
|
||
public LogTracer(RobloxActivity activityWatcher) | ||
{ | ||
_viewModel = new LogTracerViewModel(this, activityWatcher); | ||
DataContext = _viewModel; | ||
|
||
InitializeComponent(); | ||
} | ||
|
||
private void RichTextBox_TextChanged(object sender, TextChangedEventArgs e) => ScrollViewer.ScrollToEnd(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
|
||
using CommunityToolkit.Mvvm.Input; | ||
|
||
namespace Bloxstrap.UI.ViewModels.ContextMenu | ||
{ | ||
internal class LogTracerViewModel : NotifyPropertyChangedViewModel | ||
{ | ||
private readonly Window _window; | ||
private readonly RobloxActivity _activityWatcher; | ||
|
||
public ICommand CloseWindowCommand => new RelayCommand(_window.Close); | ||
|
||
public string LogLocation => _activityWatcher.LogFilename; | ||
public string LogContents { get; private set; } = ""; | ||
|
||
public LogTracerViewModel(Window window, RobloxActivity activityWatcher) | ||
{ | ||
_window = window; | ||
_activityWatcher = activityWatcher; | ||
|
||
_activityWatcher.OnLogEntry += (_, message) => | ||
{ | ||
LogContents += message += "\r\n"; | ||
OnPropertyChanged(nameof(LogContents)); | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters