CreateAction() static private method

static private CreateAction ( Type actionType, Application application, Content context, string backUri, object parameters ) : ActionBase
actionType System.Type
application Application
context Content
backUri string
parameters object
return ActionBase
Esempio n. 1
0
        public static ActionBase GetAction(string name, Content context, string backUri, object parameters,
                                           Func <string, Content, object, ActionBase> getDefaultAction = null, object state = null)
        {
            if (context == null)
            {
                return(null);
            }

            bool existingApplication;
            var  app = ApplicationStorage.Instance.GetApplication(name, context, out existingApplication, GetDevice());

//UNDONE: REMOVE HACK
            if (name == "SetPermissions")
            {
                existingApplication = false;
                app = null;
            }
            // if app is null, than create action in memory only if this is _not_ an existing application
            // (existing app can be null because of denied access or cleared/disabled status)
            // (we create Service and ClientAction types in memory this way - they do not exist in the tree)
            var action = app != null?
                         CreateActionWithPermissions(app, context, backUri, parameters) :
                             (existingApplication ? null : ActionFactory.CreateAction(name, context, backUri, parameters, getDefaultAction, state));

            return(action);
        }
Esempio n. 2
0
        public static ActionBase GetAction(string name, Content context, string backUri, object parameters,
                                           Func <string, Content, object, ActionBase> getDefaultAction = null, object state = null)
        {
            if (context == null)
            {
                return(null);
            }

            bool existingApplication;
            var  app = ApplicationStorage.Instance.GetApplication(name, context, out existingApplication, GetDevice());

            if (app == null && existingApplication)
            {
                SnTrace.System.Write($"GetAction: app {name} exists but not available for " +
                                     $"content {context.Path} and user {User.Current.Username}.");
            }

            // if app is null, than create action in memory only if this is _not_ an existing application
            // (existing app can be null because of denied access or cleared/disabled status)
            // (we create Service and ClientAction types in memory this way - they do not exist in the tree)
            var action = app != null?
                         CreateActionWithPermissions(app, context, backUri, parameters) :
                             (existingApplication ? null : ActionFactory.CreateAction(name, context, backUri, parameters, getDefaultAction, state));

            return(action);
        }
Esempio n. 3
0
        // ================================================================== Action framework

        public ActionBase CreateAction(Content context, string backUrl, object parameters)
        {
            try
            {
                return(ActionFactory.CreateAction(GetActionTypeName(), this, context, backUrl, parameters));
            }
            catch (InvalidOperationException)
            {
                // not enough permissions to access actiontype name, return null
            }

            return(null);
        }