当前位置: 首页>>代码示例>>C#>>正文


C# Ua.LocalizedText类代码示例

本文整理汇总了C#中Opc.Ua.LocalizedText的典型用法代码示例。如果您正苦于以下问题:C# LocalizedText类的具体用法?C# LocalizedText怎么用?C# LocalizedText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LocalizedText类属于Opc.Ua命名空间,在下文中一共展示了LocalizedText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LocalizedText

        /// <summary>
        /// Creates a deep copy of the value.
        /// </summary>
        /// <remarks>
        /// Creates a deep copy of the value.
        /// </remarks>
        /// <param name="value">The text to create an instance from</param>
        /// <exception cref="ArgumentNullException">Thrown when the value is null</exception>
        public LocalizedText(LocalizedText value)
        {
            if (value == null) throw new ArgumentNullException("value");

            Locale = value.Locale;
            Text = value.Text;
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:15,代码来源:LocalizedText.cs

示例2: EUInformation

        /// <summary>
        /// Initializes the object with the unitName and namespaceUri.
        /// </summary>
        public EUInformation(string shortName, string longName, string namespaceUri)
        {
            Initialize();

            m_displayName  = new LocalizedText(shortName);
            m_description  = new LocalizedText(longName);
            m_namespaceUri = namespaceUri;
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:11,代码来源:EUInformation.cs

示例3: ServiceResult

 /// <summary>
 /// Constructs a object by specifying each property.
 /// </summary>
 public ServiceResult(
     StatusCode    code,
     string        symbolicId,
     string        namespaceUri,
     LocalizedText localizedText,
     string        additionalInfo)
 :
     this(code, symbolicId, namespaceUri, localizedText, additionalInfo, (ServiceResult)null)
 {
 }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:13,代码来源:ServiceResult.cs

示例4: Initialize

 /// <summary>
 /// Initializes the instance with the default values.
 /// </summary>
 protected override void Initialize(ISystemContext context)
 {
     SuperTypeId = Opc.Ua.NodeId.Create(Opc.Ua.ObjectTypes.BaseObjectType, Opc.Ua.Namespaces.OpcUa, context.NamespaceUris);
     NodeId = Opc.Ua.NodeId.Create(Opc.Ua.ObjectTypes.BaseObjectType, Opc.Ua.Namespaces.OpcUa, context.NamespaceUris);
     BrowseName = Opc.Ua.QualifiedName.Create(Opc.Ua.BrowseNames.BaseObjectType, Opc.Ua.Namespaces.OpcUa, context.NamespaceUris);
     DisplayName = new LocalizedText(Opc.Ua.BrowseNames.BaseObjectType, String.Empty, Opc.Ua.BrowseNames.BaseObjectType);
     Description = null;
     WriteMask = AttributeWriteMask.None;
     UserWriteMask = AttributeWriteMask.None;
     IsAbstract = false;
 }
开发者ID:OPCFoundation,项目名称:Misc-Tools,代码行数:14,代码来源:BaseObjectTypeState.cs

示例5: SetEffectiveSubState

        /// <summary>
        /// Called when one or more sub-states change state.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="displayName">The display name for the effective state.</param>
        /// <param name="transitionTime">The transition time.</param>
        public virtual void SetEffectiveSubState(ISystemContext context, LocalizedText displayName, DateTime transitionTime)
        {
            if (this.EnabledState.EffectiveDisplayName != null)
            {
                this.EnabledState.EffectiveDisplayName.Value = displayName;
            }

            if (this.EnabledState.EffectiveTransitionTime != null)
            {
                if (transitionTime != DateTime.MinValue)
                {
                    this.EnabledState.EffectiveTransitionTime.Value = transitionTime;
                }
                else
                {
                    this.EnabledState.EffectiveTransitionTime.Value = DateTime.UtcNow;
                }
            }
        }
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:25,代码来源:ConditionState.cs

示例6: Initialize

        /// <summary>
        /// Initializes a new event.
        /// </summary>
        /// <param name="context">The current system context.</param>
        /// <param name="source">The source of the event.</param>
        /// <param name="severity">The severity for the event.</param>
        /// <param name="message">The default message.</param>
        public virtual void Initialize(
            ISystemContext context, 
            NodeState source, 
            EventSeverity severity,
            LocalizedText message)
        {
            m_eventId = new PropertyState<byte[]>(this);
            m_eventId.Value = Guid.NewGuid().ToByteArray();

            m_eventType = new PropertyState<NodeId>(this);
            m_eventType.Value = GetDefaultTypeDefinitionId(context.NamespaceUris);

            TypeDefinitionId = m_eventType.Value;

            if (source != null)
            {
                if (!NodeId.IsNull(source.NodeId))
                {
                    m_sourceNode = new PropertyState<NodeId>(this);
                    m_sourceNode.Value = source.NodeId;
                }

                if (!QualifiedName.IsNull(source.BrowseName))
                {
                    m_sourceName = new PropertyState<string>(this);
                    m_sourceName.Value = source.BrowseName.Name;
                }
            }

            m_time = new PropertyState<DateTime>(this);
            m_time.Value = DateTime.UtcNow;

            m_receiveTime = new PropertyState<DateTime>(this);
            m_receiveTime.Value = DateTime.UtcNow;

            m_severity = new PropertyState<ushort>(this);
            m_severity.Value = (ushort)severity;

            m_message = new PropertyState<LocalizedText>(this);
            m_message.Value = message;
        }
开发者ID:OPCFoundation,项目名称:Misc-Tools,代码行数:48,代码来源:BaseEventState.cs

示例7: Initialize

        /// <summary>
        /// Initializes a new event.
        /// </summary>
        /// <param name="context">The current system context.</param>
        /// <param name="source">The source of the event.</param>
        /// <param name="severity">The severity for the event.</param>
        /// <param name="message">The default message.</param>
        /// <param name="status">Whether the operation that caused the event succeeded.</param>
        /// <param name="actionTimestamp">When the operation started.</param>
        public virtual void Initialize(
            ISystemContext context, 
            NodeState source, 
            EventSeverity severity,
            LocalizedText message,
            bool status,
            DateTime actionTimestamp)
        {
            base.Initialize(context, source, severity, message);

            m_status = new PropertyState<bool>(this);
            m_status.Value = status;

            if (actionTimestamp != DateTime.MinValue)
            {
                m_actionTimeStamp = new PropertyState<DateTime>(this);
                m_actionTimeStamp.Value = actionTimestamp;
            }

            if (context.NamespaceUris != null)
            {
                m_serverId = new PropertyState<string>(this);
                m_serverId.Value = context.NamespaceUris.GetString(1);
            }

            if (context.AuditEntryId != null)
            {
                m_clientAuditEntryId = new PropertyState<string>(this);
                m_clientAuditEntryId.Value = context.AuditEntryId;
            }

            if (context.UserIdentity != null)
            {
                m_clientUserId = new PropertyState<string>(this);
                m_clientUserId.Value = context.UserIdentity.DisplayName;
            }
        }
开发者ID:OPCFoundation,项目名称:Misc-Tools,代码行数:46,代码来源:AuditEventState.cs

示例8: Initialize

 /// <summary>
 /// Initializes the instance with the default values.
 /// </summary>
 protected override void Initialize(ISystemContext context)
 {
     SuperTypeId = Opc.Ua.NodeId.Create(Opc.Ua.VariableTypes.BaseVariableType, Opc.Ua.Namespaces.OpcUa, context.NamespaceUris);
     NodeId = Opc.Ua.NodeId.Create(Opc.Ua.VariableTypes.PropertyType, Opc.Ua.Namespaces.OpcUa, context.NamespaceUris);
     BrowseName = Opc.Ua.QualifiedName.Create(Opc.Ua.BrowseNames.PropertyType, Opc.Ua.Namespaces.OpcUa, context.NamespaceUris);
     DisplayName = new LocalizedText(Opc.Ua.BrowseNames.PropertyType, String.Empty, Opc.Ua.BrowseNames.PropertyType);
     Description = null;
     WriteMask = AttributeWriteMask.None;
     UserWriteMask = AttributeWriteMask.None;
     IsAbstract = false;
     Value = null;
     DataType = Opc.Ua.NodeId.Create(Opc.Ua.DataTypes.BaseDataType, Opc.Ua.Namespaces.OpcUa, context.NamespaceUris);
     ValueRank = ValueRanks.Any;
     ArrayDimensions = null;
 }
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:18,代码来源:BaseVariableTypeState.cs

示例9: TranslateApplicationDescription

        /// <summary>
        /// Translates the discovery URLs based on the client url and returns an updated ApplicationDescription.
        /// </summary>
        /// <param name="clientUrl">The client URL.</param>
        /// <param name="description">The application description.</param>
        /// <param name="baseAddresses">The base addresses.</param>
        /// <param name="applicationName">The localized application name.</param>
        /// <returns>A copy of the application description</returns>
        protected ApplicationDescription TranslateApplicationDescription(
            Uri clientUrl,
            ApplicationDescription description,
            IList<BaseAddress> baseAddresses,
            LocalizedText applicationName)
        {
            // get the discovery urls.
            StringCollection discoveryUrls = new StringCollection();

            foreach (BaseAddress baseAddress in baseAddresses)
            {
                discoveryUrls.Add(GetBestDiscoveryUrl(clientUrl, baseAddress));
            }

            // copy the description.
            ApplicationDescription copy = new ApplicationDescription();

            copy.ApplicationName = description.ApplicationName;
            copy.ApplicationUri = description.ApplicationUri;
            copy.ApplicationType = description.ApplicationType;
            copy.ProductUri = description.ProductUri;
            copy.GatewayServerUri = description.DiscoveryProfileUri;
            copy.DiscoveryUrls = discoveryUrls;

            if (!LocalizedText.IsNullOrEmpty(applicationName))
            {
                copy.ApplicationName = applicationName;
            }

            // return the copy.
            return copy;
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:40,代码来源:ServerBase.cs

示例10: Initialize

        /// <summary>
        /// Initializes the node from the element.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="element">The element.</param>
        /// <param name="namespaceIndex">Index of the namespace.</param>
        public void Initialize(ISystemContext context, DaElement element, ushort namespaceIndex)
        {
            m_element = element;

            if (element == null)
            {
                return;
            }

            this.NodeId = DaModelUtils.ConstructIdForDaElement(element.ItemId, -1, namespaceIndex);
            this.BrowseName = new QualifiedName(element.Name, namespaceIndex);
            this.DisplayName = new LocalizedText(element.Name);

            // check if TimeZone is supported.
            if (element.TimeZone != null)
            {
                PropertyState property = this.AddProperty<Range>(Opc.Ua.BrowseNames.LocalTime, DataTypeIds.TimeZoneDataType, ValueRanks.Scalar);
                property.NodeId = DaModelUtils.ConstructIdForComponent(property, namespaceIndex);
                property.Value = new Range(element.HighIR, element.LowIR);
            }

            // set the TypeDefinition based on the ElementType.
            switch (element.ElementType)
            {
                case DaElementType.AnalogItem:
                {
                    this.TypeDefinitionId = Opc.Ua.VariableTypeIds.AnalogItemType;

                    // EURange is always present.
                    PropertyState property = this.AddProperty<Range>(Opc.Ua.BrowseNames.EURange, DataTypeIds.Range, ValueRanks.Scalar);
                    property.NodeId = DaModelUtils.ConstructIdForComponent(property, namespaceIndex); 
                    property.Value = new Range(element.HighEU, element.LowEU);

                    // check if InstrumentRange is supported.
                    if (element.HighIR != 0 || element.LowIR != 0)
                    {
                        property = this.AddProperty<Range>(Opc.Ua.BrowseNames.InstrumentRange, DataTypeIds.Range, ValueRanks.Scalar);
                        property.NodeId = DaModelUtils.ConstructIdForComponent(property, namespaceIndex);
                        property.Value = new Range(element.HighIR, element.LowIR);
                    }

                    // check if EngineeringUnits is supported.
                    if (element.EngineeringUnits != null)
                    {
                        property = this.AddProperty<EUInformation>(Opc.Ua.BrowseNames.EngineeringUnits, DataTypeIds.EUInformation, ValueRanks.Scalar);
                        property.NodeId = DaModelUtils.ConstructIdForComponent(property, namespaceIndex); 

                        // use the server's namespace uri to qualify the engineering units.
                        string namespaceUri = context.NamespaceUris.GetString(namespaceIndex);
                        property.Value = new EUInformation(element.EngineeringUnits, namespaceUri);
                    }

                    break;
                }

                case DaElementType.DigitalItem:
                {
                    this.TypeDefinitionId = Opc.Ua.VariableTypeIds.TwoStateDiscreteType;

                    // check if CloseLabel is supported.
                    if (element.CloseLabel != null)
                    {
                        PropertyState property = this.AddProperty<LocalizedText>(Opc.Ua.BrowseNames.TrueState, DataTypeIds.LocalizedText, ValueRanks.Scalar);
                        property.NodeId = DaModelUtils.ConstructIdForComponent(property, namespaceIndex); 
                        property.Value = element.CloseLabel;
                    }

                    // check if OpenLabel is supported.
                    if (element.OpenLabel != null)
                    {
                        PropertyState property = this.AddProperty<LocalizedText>(Opc.Ua.BrowseNames.FalseState, DataTypeIds.LocalizedText, ValueRanks.Scalar);
                        property.NodeId = DaModelUtils.ConstructIdForComponent(property, namespaceIndex); 
                        property.Value = element.OpenLabel;
                    }

                    break;
                }

                case DaElementType.EnumeratedItem:
                {
                    this.TypeDefinitionId = Opc.Ua.VariableTypeIds.MultiStateDiscreteType;

                    // check if EuInfo is supported.
                    if (element.EuInfo != null)
                    {
                        PropertyState property = this.AddProperty<LocalizedText[]>(Opc.Ua.BrowseNames.EnumStrings, DataTypeIds.LocalizedText, ValueRanks.OneDimension);
                        property.NodeId = DaModelUtils.ConstructIdForComponent(property, namespaceIndex); 

                        LocalizedText[] strings = new LocalizedText[element.EuInfo.Length];

                        for (int ii = 0; ii < strings.Length; ii++)
                        {
                            strings[ii] = element.EuInfo[ii];
                        }
//.........这里部分代码省略.........
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:101,代码来源:DaItemState.cs

示例11: WriteLocalizedText

        /// <summary>
        /// Writes an LocalizedText to the stream.
        /// </summary>
        public void WriteLocalizedText(string fieldName, LocalizedText value)
        {
            if (BeginField(fieldName, value == null, true))
            {
                PushNamespace(Namespaces.OpcUaXsd);
                
                if (value != null)
                {
                    WriteString("Locale", value.Locale);
                    WriteString("Text", value.Text);
                }

                PopNamespace();
                
                EndField(fieldName);
            }
        }
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:20,代码来源:XmlEncoder.cs

示例12: OnUserArrayValue2

        private ServiceResult OnUserArrayValue2(
            ISystemContext context,
            MethodState method,
            NodeId objectId,
            DateTime[] dateTimeIn,
            Uuid[] guidIn,
            byte[][] byteStringIn,
            XmlElement[] xmlElementIn,
            NodeId[] nodeIdIn,
            ExpandedNodeId[] expandedNodeIdIn,
            QualifiedName[] qualifiedNameIn,
            LocalizedText[] localizedTextIn,
            StatusCode[] statusCodeIn,
            Variant[] variantIn,
            ref DateTime[] dateTimeOut,
            ref Uuid[] guidOut,
            ref byte[][] byteStringOut,
            ref XmlElement[] xmlElementOut,
            ref NodeId[] nodeIdOut,
            ref ExpandedNodeId[] expandedNodeIdOut,
            ref QualifiedName[] qualifiedNameOut,
            ref LocalizedText[] localizedTextOut,
            ref StatusCode[] statusCodeOut,
            ref Variant[] variantOut)
        {
            dateTimeOut = dateTimeIn;
            guidOut = guidIn;
            byteStringOut = byteStringIn;
            xmlElementOut = xmlElementIn;
            nodeIdOut = nodeIdIn;
            expandedNodeIdOut = expandedNodeIdIn;
            qualifiedNameOut = qualifiedNameIn;
            localizedTextOut = localizedTextIn;
            statusCodeOut = statusCodeIn;
            variantOut = variantIn;

            return ServiceResult.Good;
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:38,代码来源:MethodTestState.cs

示例13: OnUserScalarValue2

        private ServiceResult OnUserScalarValue2(
            ISystemContext context,
            MethodState method,
            NodeId objectId,
            DateTime dateTimeIn,
            Uuid guidIn,
            byte[] byteStringIn,
            XmlElement xmlElementIn,
            NodeId nodeIdIn,
            ExpandedNodeId expandedNodeIdIn,
            QualifiedName qualifiedNameIn,
            LocalizedText localizedTextIn,
            StatusCode statusCodeIn,
            object variantIn,
            ref DateTime dateTimeOut,
            ref Uuid guidOut,
            ref byte[] byteStringOut,
            ref XmlElement xmlElementOut,
            ref NodeId nodeIdOut,
            ref ExpandedNodeId expandedNodeIdOut,
            ref QualifiedName qualifiedNameOut,
            ref LocalizedText localizedTextOut,
            ref StatusCode statusCodeOut,
            ref object variantOut)
        {
            dateTimeOut = dateTimeIn;
            guidOut = guidIn;
            byteStringOut = byteStringIn;
            xmlElementOut = xmlElementIn;
            nodeIdOut = nodeIdIn;
            expandedNodeIdOut = expandedNodeIdIn;
            qualifiedNameOut = qualifiedNameIn;
            localizedTextOut = localizedTextIn;
            statusCodeOut = statusCodeIn;
            variantOut = variantIn;

            return ServiceResult.Good;
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:38,代码来源:MethodTestState.cs

示例14: UpdateEffectiveState

        /// <summary>
        /// Updates the effective state for the condition.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void UpdateEffectiveState(ISystemContext context)
        {
            if (!this.EnabledState.Id.Value)
            {
                base.UpdateEffectiveState(context);
                return;
            }

            StringBuilder builder = new StringBuilder();

            string locale = null;

            if (this.ActiveState.Value != null)
            {
                locale = this.ActiveState.Value.Locale;

                if (this.ActiveState.Id.Value)
                {
                    if (this.ActiveState.EffectiveDisplayName != null && !LocalizedText.IsNullOrEmpty(this.ActiveState.EffectiveDisplayName.Value))
                    {
                        builder.Append(this.ActiveState.EffectiveDisplayName.Value);
                    }
                    else
                    {
                        builder.Append(this.ActiveState.Value);
                    }
                }
                else
                {
                    builder.Append(this.ActiveState.Value);
                }
            }

            LocalizedText suppressedState = null;

            if (this.SuppressedState != null)
            {
                if (this.SuppressedState.Id.Value)
                {
                    suppressedState = this.SuppressedState.Value;
                }
            }

            if (this.ShelvingState != null)
            {
                if (this.ShelvingState.CurrentState.Id.Value != ObjectIds.ShelvedStateMachineType_Unshelved)
                {
                    suppressedState = this.ShelvingState.CurrentState.Value;
                }
            }

            if (suppressedState != null)
            {
                builder.Append(" | ");
                builder.Append(suppressedState);
            }

            LocalizedText ackState = null;

            if (!this.ConfirmedState.Id.Value)
            {
                if (!this.ConfirmedState.Id.Value)
                {
                    ackState = this.ConfirmedState.Value;
                }
            }

            if (!this.AckedState.Id.Value)
            {
                if (!this.AckedState.Id.Value)
                {
                    ackState = this.AckedState.Value;
                }
            }

            if (ackState != null)
            {
                builder.Append(" | ");
                builder.Append(ackState);
            }

            LocalizedText effectiveState = new LocalizedText(locale, builder.ToString());

            SetEffectiveSubState(context, effectiveState, DateTime.MinValue);
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:89,代码来源:AlarmConditionState.cs

示例15: WriteLocalizedText

        /// <summary>
        /// Writes an LocalizedText to the stream.
        /// </summary>
        public void WriteLocalizedText(string fieldName, LocalizedText value)
        {
            if (UseReversibleEncoding)
            {
                PushStructure(fieldName);

                WriteSimpleField("Text", value.Text.ToString(), true);

                if (!String.IsNullOrEmpty(value.Locale))
                {
                    WriteSimpleField("Locale", value.Locale.ToString(), true);
                }

                PopStructure();
            }
            else
            {
                WriteSimpleField(fieldName, value.Text, true);
            }
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:23,代码来源:JsonEncoder.cs


注:本文中的Opc.Ua.LocalizedText类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。