@@ -32,11 +32,15 @@ public override void Initialize()
32
32
switch ( notif )
33
33
{
34
34
case CustomNotificationEventArgs custom :
35
- Notify ( custom . Message , custom . Title ,
36
- custom . RawType . HardCast < NotificationType > ( ) ,
35
+ var notificationType = custom . RawType . HardCast < NotificationType > ( ) ;
36
+ Notify (
37
+ custom . Message ,
38
+ custom . Title ,
39
+ Enum . IsDefined ( notificationType ) ? notificationType : NotificationType . Information ,
37
40
custom . Expiration ,
38
- notif . Clicked , notif . Closed
39
- ) ;
41
+ notif . Clicked ,
42
+ notif . Closed
43
+ ) ;
40
44
break ;
41
45
case ErrorNotificationEventArgs custom :
42
46
NotifyError ( custom . Error , custom . Expiration , notif . Clicked , notif . Closed ) ;
@@ -47,43 +51,40 @@ public override void Initialize()
47
51
48
52
public override void OnFrameworkInitializationCompleted ( )
49
53
{
50
- if ( AvaloniaHelper . TryGetDesktop ( out var desktop ) )
54
+ if ( ! AvaloniaHelper . TryGetDesktop ( out var desktop ) ) return ;
55
+
56
+ XamlRoot = desktop . MainWindow = new UIShellView ( ) ;
57
+
58
+ desktop . MainWindow . Loaded += ( _ , _ ) => _notificationManager = new ( XamlRoot )
51
59
{
52
- XamlRoot = desktop . MainWindow = new UIShellView ( ) ;
53
-
54
- desktop . MainWindow . Loaded += ( _ , _ ) => _notificationManager = new ( XamlRoot )
55
- {
56
- Position = NotificationPosition . BottomRight ,
57
- MaxItems = 4 ,
58
- Margin = new ( 0 , 0 , 4 , 30 )
59
- } ;
60
-
61
- desktop . MainWindow . Closing += ( _ , _ ) =>
62
- {
63
- LogsViewModel . UnregisterHandler ( ) ;
64
- VolteManager . Stop ( ) ;
65
- } ;
66
-
67
- TaskScheduler . UnobservedTaskException += ( _ , eventArgs ) =>
68
- {
69
- NotifyError ( eventArgs . Exception ) ;
70
- eventArgs . SetObserved ( ) ;
71
- } ;
60
+ Position = NotificationPosition . BottomRight ,
61
+ MaxItems = 4 ,
62
+ Margin = new ( 0 , 0 , 4 , 30 )
63
+ } ;
64
+
65
+ desktop . MainWindow . Closing += ( _ , _ ) =>
66
+ {
67
+ LogsViewModel . UnregisterHandler ( ) ;
68
+ VolteManager . Stop ( ) ;
69
+ } ;
70
+
71
+ TaskScheduler . UnobservedTaskException += ( _ , eventArgs ) =>
72
+ {
73
+ NotifyError ( eventArgs . Exception ) ;
74
+ eventArgs . SetObserved ( ) ;
75
+ } ;
76
+
77
+ PageManager . Init ( ) ;
72
78
73
- PageManager . Init ( ) ;
74
-
75
79
#if DEBUG
76
- XamlRoot . AttachDevTools ( new DevToolsOptions
77
- {
78
- Gesture = OpenDevTools ,
79
- Size = new Size ( 800 , 800 ) ,
80
- LaunchView = DevToolsViewKind . LogicalTree ,
81
- FocusHighlighterBrush = Brushes . Crimson
82
- } ) ;
80
+ this . AttachDevTools ( new DevToolsOptions
81
+ {
82
+ Gesture = OpenDevTools ,
83
+ Size = new Size ( 800 , 800 ) ,
84
+ LaunchView = DevToolsViewKind . LogicalTree ,
85
+ FocusHighlighterBrush = Brush . Parse ( "#7000FB" )
86
+ } ) ;
83
87
#endif
84
- }
85
-
86
- VolteManager . Start ( ) ;
87
88
}
88
89
89
90
public static void Notify ( Notification notification )
@@ -114,7 +115,7 @@ public static void NotifyError<TException>(
114
115
Action ? onClick = null ,
115
116
Action ? onClose = null
116
117
) where TException : Exception
117
- => Notify ( new Notification
118
+ => Notify ( new Notification
118
119
{
119
120
Title = typeof ( TException ) . AsPrettyString ( ) ,
120
121
Message = ex . Message ,
0 commit comments