Opc.Ua.ConditionState.OnEnableCalled C# (CSharp) Method

OnEnableCalled() protected method

Handles the Enable method.
protected OnEnableCalled ( ISystemContext context, MethodState method, IList inputArguments, IList outputArguments ) : ServiceResult
context ISystemContext
method MethodState
inputArguments IList
outputArguments IList
return ServiceResult
        protected virtual ServiceResult OnEnableCalled(
            ISystemContext context,
            MethodState method,
            IList<object> inputArguments,
            IList<object> outputArguments)
        {
            ServiceResult error = ProcessBeforeEnableDisable(context, true);

            if (ServiceResult.IsGood(error))
            {
                UpdateStateAfterEnable(context);
            }

            if (this.AreEventsMonitored)
            {
                // report a state change event.
                if (ServiceResult.IsGood(error))
                {
                    ReportStateChange(context, false);
                }

                // raise the audit event.
                AuditConditionCommentEventState e = new AuditConditionCommentEventState(null);

                TranslationInfo info = new TranslationInfo(
                    "AuditConditionEnable",
                    "en-US",
                    "The Enable method was called.");

                e.Initialize(
                    context,
                    this,
                    EventSeverity.Low,
                    new LocalizedText(info),
                    ServiceResult.IsGood(error),
                    DateTime.UtcNow);

                e.SourceName.Value = "Attribute/Call";

                e.MethodId = new PropertyState<NodeId>(e);
                e.MethodId.Value = method.NodeId;

                ReportEvent(context, e);
            }

            return error;
        }