Update App.xaml.cs

Implemented guard clause to improve readability of OnActivated
This commit is contained in:
philliprobinson 2024-09-10 10:47:40 +12:00 committed by GitHub
commit 1189ce9086
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -73,8 +73,8 @@ namespace CalculatorApp
protected override void OnActivated(IActivatedEventArgs args) protected override void OnActivated(IActivatedEventArgs args)
{ {
if (args.Kind == ActivationKind.Protocol) if (args.Kind != ActivationKind.Protocol) return;
{
if (args.IsSnapshotProtocol()) if (args.IsSnapshotProtocol())
{ {
var protoArgs = (IProtocolActivatedEventArgs)args; var protoArgs = (IProtocolActivatedEventArgs)args;
@ -92,7 +92,6 @@ namespace CalculatorApp
OnAppLaunch(args, null, false); OnAppLaunch(args, null, false);
} }
} }
}
private void OnAppLaunch(IActivatedEventArgs args, object arguments, bool isPreLaunch) private void OnAppLaunch(IActivatedEventArgs args, object arguments, bool isPreLaunch)
{ {