mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-03-26 00:15:28 +00:00
Add some error handling
This commit is contained in:
25
DiscordChatExporter/Views/ErrorDialog.ammy
Normal file
25
DiscordChatExporter/Views/ErrorDialog.ammy
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
16
DiscordChatExporter/Views/ErrorDialog.ammy.cs
Normal file
16
DiscordChatExporter/Views/ErrorDialog.ammy.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user