Baconit.App.OnActivated C# (CSharp) Method

OnActivated() protected method

Fired when the app is opened from a toast message.
protected OnActivated ( IActivatedEventArgs args ) : void
args IActivatedEventArgs
return void
        protected override void OnActivated(IActivatedEventArgs args)
        {
            base.OnActivated(args);

            if (args is ToastNotificationActivatedEventArgs)
            {
                ToastNotificationActivatedEventArgs toastArgs = (ToastNotificationActivatedEventArgs)args;
                SetupAndALaunchApp(toastArgs.Argument);
            }
            else if(args is ProtocolActivatedEventArgs)
            {
                ProtocolActivatedEventArgs protcolArgs = (ProtocolActivatedEventArgs)args;
                string argsString = protcolArgs.Uri.OriginalString;
                int protEnd = argsString.IndexOf("://");
                argsString = protEnd == -1 ? argsString : argsString.Substring(protEnd + 3);
                SetupAndALaunchApp(argsString);
            }
            else
            {
                SetupAndALaunchApp(String.Empty);
            }
        }