Opc.Ua.DialogConditionState.SetResponse C# (CSharp) Method

SetResponse() public method

Sets the response to the dialog.
public SetResponse ( ISystemContext context, int response ) : void
context ISystemContext The system context.
response int The selected response.
return void
        public virtual void SetResponse(ISystemContext context, int response)
        {
            this.LastResponse.Value = response;

            TranslationInfo state = new TranslationInfo(
                "ConditionStateDialogInactive",
                "en-US",
                ConditionStateNames.Inactive);

            this.DialogState.Value = new LocalizedText(state);
            this.DialogState.Id.Value = false;

            if (this.DialogState.TransitionTime != null)
            {
                this.DialogState.TransitionTime.Value = DateTime.UtcNow;
            }

            UpdateEffectiveState(context);
        }
        #endregion

Usage Example

コード例 #1
0
ファイル: SourceState.cs プロジェクト: OPCFoundation/UA-.NET
        /// <summary>
        /// Called when the dialog receives a response.
        /// </summary>
        private ServiceResult OnRespond(
            ISystemContext context,
            DialogConditionState dialog,
            int selectedResponse)
        {
            // response 0 means set the source online.
            if (selectedResponse == 0)
            {
                m_source.SetOfflineState(false);
            }

            // response 1 means set the source offine.
            if (selectedResponse == 1)
            {
                m_source.SetOfflineState(true);
            }

            // other responses mean do nothing.
            dialog.SetResponse(context, selectedResponse);

            // dialog no longer interesting once it is deactivated.
            dialog.Message.Value = "The dialog was deactivated";
            dialog.Retain.Value = false;

            return ServiceResult.Good;
        }