I am trying to handle protocol activation and as per docs I should handle all of that within OnLaunched method so that is what I am trying to do here, but Microsoft.Windows.AppLifecycle.ProtocolActivatedEventArgs doesnt exist.
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
var activatedArgs = AppInstance.GetCurrent().GetActivatedEventArgs();
var e = args.UWPLaunchActivatedEventArgs;
InitializeRootFrame(e);
if (activatedArgs.Kind is ExtendedActivationKind.Launch)
{
if (!e.PrelaunchActivated)
{
if (RootFrame.Content == null)
{
RootFrame.Navigate(typeof(LoginPage), e.Arguments);
}
Window.Current.Activate();
}
}
else //Launched by some other means other than normal launching
{
try
{
if (activatedArgs.Kind is ExtendedActivationKind.Protocol && activatedArgs is Microsoft.Windows.AppLifecycle.ProtocolActivatedEventArgs eventArgs)
{
//var a = activatedArgs.Data as ProtocolActivatedEventArgs;
var queryParameters = HttpUtility.ParseQueryString(activatedArgs.Data.Uri.Query);
PocessQueryForToken(queryParameters);
}
}
catch (Exception)
{
}
finally
{
RootFrame.Navigate(typeof(LoginPage));
Window.Current.Activate();
HasLaunched = true;
}
}
HasLaunched = true;
}