wabbajack/Wabbajack.App/Screens/ErrorPageViewModel.cs

31 lines
781 B
C#
Raw Normal View History

2021-10-19 23:19:06 +00:00
using System;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Wabbajack.App.Messages;
using Wabbajack.App.ViewModels;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.App.Screens;
public class ErrorPageViewModel : ViewModelBase, IActivatableViewModel, IReceiver<Error>
2021-10-19 23:19:06 +00:00
{
2021-10-23 16:51:17 +00:00
public ErrorPageViewModel()
{
Activator = new ViewModelActivator();
}
[Reactive] public string ShortMessage { get; set; }
[Reactive] public string Prefix { get; set; }
public void Receive(Error val)
2021-10-19 23:19:06 +00:00
{
2021-10-23 16:51:17 +00:00
Prefix = val.Prefix;
ShortMessage = val.Exception.Message;
}
2021-10-19 23:19:06 +00:00
2021-10-23 16:51:17 +00:00
public static void Display(string prefix, Exception ex)
{
MessageBus.Instance.Send(new Error(prefix, ex));
MessageBus.Instance.Send(new NavigateTo(typeof(ErrorPageViewModel)));
2021-10-19 23:19:06 +00:00
}
}