本文整理汇总了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;
}
示例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;
}
示例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)
{
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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];
}
//.........这里部分代码省略.........
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}