diff --git a/CRSim.ScreenSimulator/Abstractions/IScreenViewModel.cs b/CRSim.ScreenSimulator/Abstractions/IScreenViewModel.cs index 91c3ef7..7a961af 100644 --- a/CRSim.ScreenSimulator/Abstractions/IScreenViewModel.cs +++ b/CRSim.ScreenSimulator/Abstractions/IScreenViewModel.cs @@ -1,17 +1,16 @@ -using CRSim.Core.Abstractions; -using CRSim.Core.Services; +using CRSim.Core.Abstractions; +using CRSim.Core.Models; using System.Windows.Threading; namespace CRSim.ScreenSimulator.Abstractions { public interface IScreenViewModel { - public TimeService TimeService { get; } - public Dispatcher UIDispatcher { get; set; } - public string Text { get; set; } - public int Location { get; set; } - public string Video { get; set; } - - public void LoadData(string station, string ticketCheck, string platformName); + ITimeService TimeService { get; } + Dispatcher UIDispatcher { get; set; } + void LoadData(Station station, TicketCheck? ticketCheck, string platform); + string? Text { get; set; } + Uri Video { get; set; } + int Location { get; set; } } } diff --git a/CRSim/App.xaml.cs b/CRSim/App.xaml.cs index d6bc60f..9556b41 100644 --- a/CRSim/App.xaml.cs +++ b/CRSim/App.xaml.cs @@ -1,3 +1,6 @@ +using CRSim.ScreenSimulator.Views; +using System.Windows.Threading; + namespace CRSim { public partial class App : Application @@ -12,6 +15,7 @@ public App() { InitializeComponent(); + this.DispatcherUnhandledException += App_DispatcherUnhandledException; } public static T GetService() @@ -113,5 +117,12 @@ Console.WriteLine("Debug console started.\n"); Console.ForegroundColor = ConsoleColor.White; } + + private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) + { + var dialog = new ErrorDialog(e.Exception.ToString()); + dialog.ShowDialog(); + e.Handled = true; + } } }