Add WarningView
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
#nullable enable
|
||||||
|
|
||||||
|
using DialogHostAvalonia;
|
||||||
|
|
||||||
|
namespace ReceiptPDFBuilder.ViewModels;
|
||||||
|
|
||||||
|
class WarningViewModel
|
||||||
|
{
|
||||||
|
private string _error;
|
||||||
|
|
||||||
|
public WarningViewModel(string error)
|
||||||
|
{
|
||||||
|
_error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Error
|
||||||
|
{
|
||||||
|
get => _error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
DialogHost.Close("DialogHost", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<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="ReceiptPDFBuilder.Views.WarningView"
|
||||||
|
xmlns:models="clr-namespace:ReceiptPDFBuilder.Models"
|
||||||
|
xmlns:vm="clr-namespace:ReceiptPDFBuilder.ViewModels"
|
||||||
|
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
|
||||||
|
x:DataType="vm:WarningViewModel">
|
||||||
|
<StackPanel Orientation="Vertical"
|
||||||
|
Spacing="4">
|
||||||
|
<TextBlock TextAlignment="Center"
|
||||||
|
FontWeight="Bold"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
FontSize="16"
|
||||||
|
MaxWidth="350"
|
||||||
|
Text="{Binding Error}"/>
|
||||||
|
<Button Command="{Binding Close}"
|
||||||
|
Classes="accent"
|
||||||
|
Content="Close"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Margin="0,0,4,4"/>
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace ReceiptPDFBuilder.Views
|
||||||
|
{
|
||||||
|
public partial class WarningView : UserControl
|
||||||
|
{
|
||||||
|
public WarningView()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user