Add some error handling

This commit is contained in:
Alexey Golub
2017-09-28 21:36:17 +03:00
parent f2178a0445
commit 8afe9852fb
11 changed files with 165 additions and 34 deletions

View File

@@ -0,0 +1,25 @@
using MaterialDesignThemes.Wpf
UserControl "DiscordChatExporter.Views.ErrorDialog" {
DataContext: bind ErrorViewModel from $resource Container
Width: 250
StackPanel {
// Message
TextBlock {
Margin: 8
FontSize: 16
HorizontalAlignment: Center
TextWrapping: WrapWithOverflow
Text: bind Message
}
// OK
Button {
Command: DialogHost.CloseDialogCommand
Content: "OK"
Margin: 8
Style: resource dyn "MaterialDesignFlatButton"
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DiscordChatExporter.Views
{
public partial class ErrorDialog
{
public ErrorDialog()
{
InitializeComponent();
}
}
}

View File

@@ -17,6 +17,7 @@ namespace DiscordChatExporter.Views
InitializeComponent();
Title += $" v{Assembly.GetExecutingAssembly().GetName().Version}";
Messenger.Default.Register<ShowErrorMessage>(this, m => DialogHost.Show(new ErrorDialog()).Forget());
Messenger.Default.Register<ShowSettingsMessage>(this, m => DialogHost.Show(new SettingsDialog()).Forget());
}