@@ -148,23 +148,21 @@ public static void ShowWindow(object data, bool showAsDialog)
148
148
149
149
public static void RaiseException ( string context , string message )
150
150
{
151
- if ( Current is App app && app . _launcher != null )
151
+ if ( Current is App { _launcher : not null } app )
152
152
app . _launcher . DispatchNotification ( context , message , true ) ;
153
153
}
154
154
155
155
public static void SendNotification ( string context , string message )
156
156
{
157
- if ( Current is App app && app . _launcher != null )
157
+ if ( Current is App { _launcher : not null } app )
158
158
app . _launcher . DispatchNotification ( context , message , false ) ;
159
159
}
160
160
161
161
public static void SetLocale ( string localeKey )
162
162
{
163
163
var app = Current as App ;
164
- if ( app == null )
165
- return ;
166
164
167
- var targetLocale = app . Resources [ localeKey ] as ResourceDictionary ;
165
+ var targetLocale = app ? . Resources [ localeKey ] as ResourceDictionary ;
168
166
if ( targetLocale == null || targetLocale == app . _activeLocale )
169
167
return ;
170
168
@@ -286,22 +284,14 @@ public static void SetFonts(string defaultFont, string monospaceFont, bool onlyU
286
284
287
285
public static async void CopyText ( string data )
288
286
{
289
- if ( Current ? . ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop )
290
- {
291
- if ( desktop . MainWindow ? . Clipboard is { } clipboard )
292
- await clipboard . SetTextAsync ( data ?? "" ) ;
293
- }
287
+ if ( Current ? . ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow . Clipboard : { } clipboard } )
288
+ await clipboard . SetTextAsync ( data ?? "" ) ;
294
289
}
295
290
296
291
public static async Task < string > GetClipboardTextAsync ( )
297
292
{
298
- if ( Current ? . ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop )
299
- {
300
- if ( desktop . MainWindow ? . Clipboard is { } clipboard )
301
- {
302
- return await clipboard . GetTextAsync ( ) ;
303
- }
304
- }
293
+ if ( Current ? . ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow . Clipboard : { } clipboard } )
294
+ return await clipboard . GetTextAsync ( ) ;
305
295
return null ;
306
296
}
307
297
@@ -562,7 +552,7 @@ private void TryLaunchAsNormal(IClassicDesktopStyleApplicationLifetime desktop)
562
552
Models . AvatarManager . Instance . Start ( ) ;
563
553
564
554
string startupRepo = null ;
565
- if ( desktop . Args != null && desktop . Args . Length == 1 && Directory . Exists ( desktop . Args [ 0 ] ) )
555
+ if ( desktop . Args is { Length : 1 } && Directory . Exists ( desktop . Args [ 0 ] ) )
566
556
startupRepo = desktop . Args [ 0 ] ;
567
557
568
558
var pref = ViewModels . Preferences . Instance ;
0 commit comments