Nice Exception Dialog

This commit is contained in:
2020-03-01 23:37:43 +01:00
parent aa24f80fe2
commit 8953ac1808
10 changed files with 273 additions and 10 deletions

View File

@@ -1,8 +1,14 @@
using System;
using System.Threading.Tasks;
using EstusShots.Client;
using EstusShots.Gtk.Controls;
using EstusShots.Gtk.Dialogs;
using EstusShots.Shared.Dto;
using EstusShots.Shared.Models;
using Gdk;
using GLib;
using Gtk;
using Application = Gtk.Application;
using UI = Gtk.Builder.ObjectAttribute;
using Window = Gtk.Window;
@@ -18,6 +24,8 @@ namespace EstusShots.Gtk
[UI] public readonly Label InfoLabel = null;
[UI] public readonly Box LoadingSpinner = null;
[UI] public readonly Notebook Navigation = null;
private EstusShotsClient Client { get; }
private BindableListControl<Episode> EpisodesControl { get; set; }
@@ -31,6 +39,8 @@ namespace EstusShots.Gtk
builder.Autoconnect(this);
Client = new EstusShotsClient(ApiUrl);
ErrorDialog.MainWindow = this;
ExceptionManager.UnhandledException += ExceptionManagerOnUnhandledException;
DeleteEvent += Window_DeleteEvent;
Icon = Pixbuf.LoadFromResource("icon.png");
@@ -49,6 +59,12 @@ namespace EstusShots.Gtk
UpdateTitle();
}
private void ExceptionManagerOnUnhandledException(UnhandledExceptionArgs args)
{
Console.WriteLine(args.ExceptionObject);
args.ExitApplication = false;
}
private void Window_DeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();