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>
|
||||
|
||||
+19
-12
@@ -206,23 +206,30 @@ class MainViewModel : BaseViewModel, IFontResolver
|
||||
|
||||
public async void BuildPDF()
|
||||
{
|
||||
try
|
||||
if (string.IsNullOrWhiteSpace(ReportTitle))
|
||||
{
|
||||
// TODO: use already found files and information
|
||||
await Task.Run(() => CreatePDF(_workingFolder));
|
||||
} catch (Exception e)
|
||||
await DialogHost.Show(new WarningViewModel("You must provide a report title!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo("PDF process failed! Reason: " + e.Message);
|
||||
if (e.StackTrace != null)
|
||||
try
|
||||
{
|
||||
LogInfo(e.StackTrace);
|
||||
}
|
||||
if (e.InnerException != null)
|
||||
// TODO: use already found files and information
|
||||
await Task.Run(() => CreatePDF(_workingFolder));
|
||||
} catch (Exception e)
|
||||
{
|
||||
LogInfo("Inner exception: " + e.InnerException.Message);
|
||||
if (e.InnerException.StackTrace != null)
|
||||
LogInfo("PDF process failed! Reason: " + e.Message);
|
||||
if (e.StackTrace != null)
|
||||
{
|
||||
LogInfo(e.InnerException.StackTrace);
|
||||
LogInfo(e.StackTrace);
|
||||
}
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
LogInfo("Inner exception: " + e.InnerException.Message);
|
||||
if (e.InnerException.StackTrace != null)
|
||||
{
|
||||
LogInfo(e.InnerException.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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