Exemplo n.º 1
0
        public async Task OnLaunched(LaunchActivatedEventArgs e)
        {
            var args = e?.Arguments;

#if !WINDOWS_UWP
            if (string.IsNullOrEmpty(args))
            {
                var cliArgs = Environment.GetCommandLineArgs();
                if (cliArgs?.Length > 1)
                {
                    args = cliArgs[1];
                }
            }
#endif

            if (args?.StartsWith(AppActionsExtensions.AppActionPrefix) ?? false)
            {
                var id = AppActionsExtensions.ArgumentsToId(args);

                if (!string.IsNullOrEmpty(id))
                {
                    var actions = await GetAsync();

                    var appAction = actions.FirstOrDefault(a => a.Id == id);

                    if (appAction != null)
                    {
                        AppActionActivated?.Invoke(null, new AppActionEventArgs(appAction));
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            if (shortcutItem.Type == ShortcutType)
            {
                var appAction = shortcutItem.ToAppAction();

                AppActionActivated?.Invoke(null, new AppActionEventArgs(appAction));
            }
        }
Exemplo n.º 3
0
        public void OnNewIntent(Intent intent)
        {
            if (intent?.Action == IntentAction)
            {
                var appAction = intent.ToAppAction();

                if (!string.IsNullOrEmpty(appAction?.Id))
                {
                    AppActionActivated?.Invoke(null, new AppActionEventArgs(appAction));
                }
            }
        }
Exemplo n.º 4
0
        public void OnNewIntent(Intent intent)
        {
            if (intent?.Action == IntentAction && !intent.GetBooleanExtra(extraAppActionHandled, false))
            {
                // prevent launch intent getting handled on activity resume
                intent.PutExtra(extraAppActionHandled, true);

                var appAction = intent.ToAppAction();

                if (!string.IsNullOrEmpty(appAction?.Id))
                {
                    AppActionActivated?.Invoke(null, new AppActionEventArgs(appAction));
                }
            }
        }