-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add edit dialog for changing highlight pattern
- Loading branch information
Showing
6 changed files
with
111 additions
and
20 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
30 changes: 30 additions & 0 deletions
30
src/LogAlligator.App/Controls/Dialogs/EditHighlightDialog.axaml
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 @@ | ||
<Window 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" | ||
x:Class="LogAlligator.App.Controls.EditHighlightDialog" | ||
DataContext="{Binding RelativeSource={RelativeSource Self}}" | ||
Title="Edit highlight" | ||
Width="300" | ||
Height="95" | ||
CanResize="False" | ||
ShowInTaskbar="False" | ||
ExtendClientAreaChromeHints="NoChrome" | ||
ExtendClientAreaToDecorationsHint="True" | ||
WindowStartupLocation="CenterOwner" | ||
ShowActivated="True"> | ||
<Window.KeyBindings> | ||
<KeyBinding Gesture="Escape" Command="{Binding OnEscape}" /> | ||
</Window.KeyBindings> | ||
<StackPanel Margin="10 5 10 10" Spacing="2"> | ||
<TextBlock FontSize="{DynamicResource FontSizeNormal}">Edit highlight</TextBlock> | ||
<Separator Background="Transparent"/> | ||
<TextBox Name="HighlightPatternTextBox" Focusable="True" Watermark="Highlight pattern"/> | ||
<Separator Height="6" Background="Transparent"/> | ||
<StackPanel Orientation="Horizontal" Spacing="5" HorizontalAlignment="Center"> | ||
<Button Command="{Binding OnOkClick}" Width="60" IsDefault="True">OK</Button> | ||
<Button Command="{Binding OnCancelClick}" Width="60">Cancel</Button> | ||
</StackPanel> | ||
</StackPanel> | ||
</Window> |
43 changes: 43 additions & 0 deletions
43
src/LogAlligator.App/Controls/Dialogs/EditHighlightDialog.axaml.cs
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,43 @@ | ||
using System; | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
using LogAlligator.App.Utils; | ||
|
||
namespace LogAlligator.App.Controls; | ||
|
||
public partial class EditHighlightDialog : Window | ||
{ | ||
Highlight? _highlightToEdit = null; | ||
|
||
public EditHighlightDialog() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public void Initialize(Highlight highlight) | ||
{ | ||
_highlightToEdit = highlight; | ||
HighlightPatternTextBox.Text = highlight.Pattern.Pattern.ToString(); | ||
} | ||
|
||
public void OnEscape() | ||
{ | ||
Close(); | ||
} | ||
|
||
public void OnOkClick() | ||
{ | ||
if (!string.IsNullOrEmpty(HighlightPatternTextBox.Text)) | ||
{ | ||
_highlightToEdit!.Pattern.Pattern = HighlightPatternTextBox.Text.AsMemory(); | ||
} | ||
|
||
Close(); | ||
} | ||
|
||
public void OnCancelClick() | ||
{ | ||
Close(); | ||
} | ||
} |
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