Search Results for

    Show / Hide Table of Contents

    Class ModelAction

    Encapsulates information about a piece of executable code that is exposed by some kind of Binding.

    ModelActions can be executed with or without a Parameter. Up to now, actions only support TypedParameters. That is, a ModelEntity has to be defined that serves as a parameter (ModelEntity). Optionally a parameter may provide a custom EntityView that is taken, when the form for the parameter is rendered (see ModelEntityForm).

    A ModelAction may have conditions when a ModelAction is allowed to be executed. Up to now ModelEntityTypeConditions are supported. That is, a condition determines on which ModelEntity an action can be executed.

    A ModelAction must provide a Binding. Up to now only IronPythonBindings are supported. If no Binding is provided, nothing can be executed and an System.ArgumentException is thrown.

    When executing a ModelAction, an instance of ExecutionContext must be provided. An ExecutionContext passes an EntityObject (basing on ModelEntity), and an InputSet to executable code. As up to now only IronPythonBindings are supported, executable code is written in IronPython. A ModelAction can be executed with or without an InputSet. If an InputSet is passed to the executable code of the ModelActionBinding, operations are usually performed on the items of the InputSet.

    Inheritance
    System.Object
    DynamicObject
    NamedDynamicObject
    ModelElement
    ModelAction
    Implements
    System.Dynamic.IDynamicMetaObjectProvider
    System.ComponentModel.INotifyPropertyChanged
    System.ComponentModel.IDataErrorInfo
    Inherited Members
    ModelElement.IsValidIdentifier(String)
    ModelElement.Detach()
    ModelElement.SetOwnershipPrefix(String)
    ModelElement.UpdateChildren(NotifyCollectionChangedEventArgs)
    ModelElement.SetPersistBehavior(PersistBehavior)
    ModelElement.SetName(String)
    ModelElement.SetOwnership(Ownership)
    ModelElement.ElementGuid
    ModelElement.Name
    ModelElement.Parent
    ModelElement.Children
    ModelElement.PersistBehavior
    ModelElement.IsFullPersistBehavior
    ModelElement.IsNonePersistBehavior
    ModelElement.IsSystemElement
    ModelElement.IsApplicationSpecificElement
    ModelElement.IsUserElement
    ModelElement.IsSystemOrApplicationSpecificElement
    ModelElement.InvariantFriendlyName
    ModelElement.CreationVersion
    ModelElement.LastUpdateVersion
    ModelElement.Error
    ModelElement.ErrorSummary
    ModelElement.IsValid
    ModelElement.Ownership
    ModelElement.OwnershipPrefix
    ModelElement.NonPrefixedName
    NamedDynamicObject.OnPropertyChanged(String)
    NamedDynamicObject.PropertyChanged
    DynamicObject.GetMember(String)
    DynamicObject.SetMember(String, Object)
    DynamicObject.GetMetaObject(Expression)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: TimeCockpit.Data.DataModel.Actions
    Assembly: TimeCockpit.Data.dll
    Syntax
    public class ModelAction : ModelElement, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo

    Constructors

    ModelAction()

    Initializes a new instance of the ModelAction class

    Declaration
    public ModelAction()

    ModelAction(IEnumerable<KeyValuePair<Object, Object>>)

    Initializes a new instance of the ModelAction class.

    Declaration
    public ModelAction(IEnumerable<KeyValuePair<object, object>> properties)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Object, System.Object>> properties

    Collection of properties.

    ModelAction(ModelAction)

    Initializes a new instance of the ModelAction class.

    Declaration
    public ModelAction(ModelAction element)
    Parameters
    Type Name Description
    ModelAction element

    The element to copy.

    Properties

    Binding

    Gets or sets the binding of the model action.

    Declaration
    public ModelActionBinding Binding { get; set; }
    Property Value
    Type Description
    ModelActionBinding

    Conditions

    Gets a collection of conditions that determine if a model action can be executed or not.

    Declaration
    public ModelCollection<Condition> Conditions { get; }
    Property Value
    Type Description
    ModelCollection<Condition>

    ExecuteWithoutPrompt

    Gets or sets a value indicating whether the action should be executed without asking the user for confirmation first.

    Declaration
    public bool ExecuteWithoutPrompt { get; set; }
    Property Value
    Type Description
    System.Boolean

    Parameter

    Gets or sets the single parameter of the action

    Declaration
    public ModelActionParameterDefinition Parameter { get; set; }
    Property Value
    Type Description
    ModelActionParameterDefinition
    Remarks

    Up to now, only instances of TypedParameters are supported.

    Permissions

    Gets the execution permissions of the ModelAction.

    Declaration
    public ModelCollection<Permission> Permissions { get; }
    Property Value
    Type Description
    ModelCollection<Permission>

    RunsOnUIThread

    Gets or sets a value indicating whether the action supports asynchronous operations. What this means, is that the action can execute on thread different from the UI thread. A script supporting this, has to wrap calls to the UI thread in Dispatcher Invoke calls.

    Declaration
    public bool RunsOnUIThread { get; set; }
    Property Value
    Type Description
    System.Boolean

    ShowInFormsExpression

    Gets or sets an expression indicating whether to show an action in forms.

    Declaration
    public string ShowInFormsExpression { get; set; }
    Property Value
    Type Description
    System.String

    ShowInListsExpression

    Gets or sets an expression indicating whether to show an action in lists.

    Declaration
    public string ShowInListsExpression { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    Accept(ModelElementVisitor)

    Accepts a visitor. Dispatches to the Visit(ModelAction) override.

    Declaration
    public override void Accept(ModelElementVisitor visitor)
    Parameters
    Type Name Description
    ModelElementVisitor visitor

    the visitor to accept.

    Overrides
    ModelElement.Accept(ModelElementVisitor)

    Attach(ModelElement)

    Attaches a model element to a parent model element.

    Declaration
    protected override void Attach(ModelElement newParent)
    Parameters
    Type Name Description
    ModelElement newParent

    Parent model element.

    Overrides
    ModelElement.Attach(ModelElement)
    Remarks

    Note to implementers: If your model element has sub-elements, your implementation of Attach should call the base class' implementation and afterwards attach all sub-elements.

    Exceptions
    Type Condition
    System.ArgumentNullException

    newParent is null.

    System.ArgumentException

    Thrown in case of a recursion in the model element tree.

    Execute(ExecutionContext)

    Calls a piece of executable code that is associated with the Binding of the current ModelAction instance.

    Declaration
    public void Execute(ExecutionContext context)
    Parameters
    Type Name Description
    ExecutionContext context

    An instance of ExecutionContext in which to execute code.

    Exceptions
    Type Condition
    System.ArgumentException

    If the instance of ExecutionContext is null, or no Binding was provided.

    System.InvalidOperationException

    The exception is thrown if the status of the current instance is NotEvaluated, or NotValid or Disabled.

    GetStatus(ModelActionContext)

    Checks the status a ModelAction has in respect to an instance of ModelActionContext.

    Declaration
    public Status GetStatus(ModelActionContext context)
    Parameters
    Type Name Description
    ModelActionContext context

    An instance of ModelActionContext the ModelAction is to be executed in.

    Returns
    Type Description
    Status

    The status the ModelAction has in respect to the given ModelActionContext.

    Remarks

    This methods iterates over all Conditions of the ModelAction and return an overall status.

    OnDeserializing(StreamingContext)

    Called whenever deserialization of the model element is happening

    Declaration
    [OnDeserializing]
    public void OnDeserializing(StreamingContext context)
    Parameters
    Type Name Description
    System.Runtime.Serialization.StreamingContext context

    Stream context used for deserialization.

    Remarks

    This method is necessary to instantiate an instance of the current ModelElement after deserialization. As for the System.Runtime.Serialization.DataContractSerializer, constructors are not always called and fields not correctly initialized. While deserializing, this method is called and the fields of the ModelElement are correctly initialized.

    ShowInForms(IDataContext)

    Evaluates whether the action should be shown in forms.

    Declaration
    public bool ShowInForms(IDataContext dataContext)
    Parameters
    Type Name Description
    IDataContext dataContext

    The data context to execute with.

    Returns
    Type Description
    System.Boolean

    Returns false if the action should not be shown, true otherwise.

    ShowInLists(IDataContext)

    Evaluates whether the action should be shown in lists.

    Declaration
    public bool ShowInLists(IDataContext dataContext)
    Parameters
    Type Name Description
    IDataContext dataContext

    The data context to execute with.

    Returns
    Type Description
    System.Boolean

    Returns false if the action should not be shown, true otherwise.

    Validate(ref IList<PropertyValidationMessage>, Boolean)

    Validates a ModelElement according to certain rules.

    Declaration
    protected override void Validate(ref IList<PropertyValidationMessage> messages, bool validateRecursively)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<PropertyValidationMessage> messages

    An list of strings that stores that picks up the validation errors of a model element.

    System.Boolean validateRecursively

    Indicates wheter to validate only the current model element or all its children (recursively) as well.

    Overrides
    ModelElement.Validate(ref IList<PropertyValidationMessage>, Boolean)
    Remarks

    The rules the ModelElement is validated against are dependent on the type of ModelElement that is validated. This method can be overridden to provide custom validation behavior for subclasses of ModelElement

    When Validate(ref IList<PropertyValidationMessage>, Boolean) is called on a modelelement, the Validate(ref IList<PropertyValidationMessage>, Boolean) method of all children attatched to the modelelemnt are validated recursivly.

    In This Article
    Back to top Copyright © 2020 software architects gmbh