Show warning if no report title
This commit is contained in:
@@ -97,6 +97,9 @@
|
||||
<DataTemplate DataType="{x:Type viewModels:AboutViewModel}">
|
||||
<views:AboutView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:WarningViewModel}">
|
||||
<views:WarningView/>
|
||||
</DataTemplate>
|
||||
</Application.DataTemplates>
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
@@ -205,6 +205,12 @@ class MainViewModel : BaseViewModel, IFontResolver
|
||||
}
|
||||
|
||||
public async void BuildPDF()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ReportTitle))
|
||||
{
|
||||
await DialogHost.Show(new WarningViewModel("You must provide a report title!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -227,6 +233,7 @@ class MainViewModel : BaseViewModel, IFontResolver
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public byte[]? GetFont(string faceName)
|
||||
{
|
||||
|
||||
@@ -10,16 +10,20 @@
|
||||
x:DataType="vm:WarningViewModel">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Spacing="4">
|
||||
<TextBlock TextAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
FontSize="18"
|
||||
Text="Error!"/>
|
||||
<TextBlock TextAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
FontSize="16"
|
||||
FontSize="14"
|
||||
MaxWidth="350"
|
||||
Text="{Binding Error}"/>
|
||||
<Button Command="{Binding Close}"
|
||||
Classes="accent"
|
||||
Content="Close"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,4,4"/>
|
||||
Margin="0,4,4,4"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user