mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-14 02:26:50 -07:00
Update App.xaml.cs (#2230)
Implemented guard clause to improve readability of OnActivated
This commit is contained in:
parent
04650948fb
commit
6ece807db8
1 changed files with 16 additions and 17 deletions
|
@ -73,25 +73,24 @@ namespace CalculatorApp
|
|||
|
||||
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;
|
||||
OnAppLaunch(args,
|
||||
new SnapshotLaunchArguments
|
||||
{
|
||||
ActivityId = protoArgs.Uri.GetActivityId(),
|
||||
LaunchUri = protoArgs.Uri
|
||||
},
|
||||
false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle any unknown protocol launch as a normal app launch.
|
||||
OnAppLaunch(args, null, false);
|
||||
}
|
||||
var protoArgs = (IProtocolActivatedEventArgs)args;
|
||||
OnAppLaunch(args,
|
||||
new SnapshotLaunchArguments
|
||||
{
|
||||
ActivityId = protoArgs.Uri.GetActivityId(),
|
||||
LaunchUri = protoArgs.Uri
|
||||
},
|
||||
false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle any unknown protocol launch as a normal app launch.
|
||||
OnAppLaunch(args, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAppLaunch(IActivatedEventArgs args, object arguments, bool isPreLaunch)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue