public static string CreateOptionValueDescription(string entityDescription, string attributeDescription, OptionMetadata optionMetadata) { List <string> lines = new List <string>(); if (!string.IsNullOrEmpty(entityDescription)) { lines.Add(string.Format("Entity:\t\t{0}", entityDescription)); } if (!string.IsNullOrEmpty(attributeDescription)) { lines.Add(string.Format("Attribute:\t{0}", attributeDescription)); } if (optionMetadata is StateOptionMetadata stateOption) { lines.Add(string.Format("DefaultStatusValue:\t{0}", stateOption.DefaultStatus)); } if (optionMetadata is StatusOptionMetadata statusOption) { lines.Add(string.Format("State:\t{0}", statusOption.State)); } CreateFileHandler.FillLabelDisplayNameAndDescription(lines, true, optionMetadata.Label, optionMetadata.Description, " "); return(string.Join(System.Environment.NewLine, lines)); }
private static void FillDescriptionAttribute(List <string> lines, AttributeIntellisenseData attribute) { if (attribute.IsPrimaryIdAttribute.GetValueOrDefault()) { lines.Add("PrimaryId"); } if (attribute.IsPrimaryNameAttribute.GetValueOrDefault()) { lines.Add("PrimaryName"); } if (attribute.Targets != null && attribute.Targets.Count > 0) { if (attribute.Targets.Count <= 6) { string targets = string.Join(",", attribute.Targets.OrderBy(s => s)); lines.Add(string.Format("Targets:\t{0}", targets)); } else { lines.Add(string.Format("Targets Count:\t{0}", attribute.Targets.Count)); } } CreateFileHandler.FillLabelDisplayNameAndDescription(lines, true, attribute.DisplayName, attribute.Description); }
public static string GetDisplayTextAttribute(string entityName, AttributeIntellisenseData attribute) { StringBuilder result = new StringBuilder(); result.AppendFormat("{0}.{1}", entityName, attribute.LogicalName); string temp = CreateFileHandler.GetLocalizedLabel(attribute.DisplayName); if (!string.IsNullOrEmpty(temp)) { result.AppendFormat(" - {0}", temp); } if (attribute.IsPrimaryIdAttribute.GetValueOrDefault()) { result.Append(" - PrimaryId"); } if (attribute.IsPrimaryNameAttribute.GetValueOrDefault()) { result.Append(" - PrimaryName"); } if (attribute.AttributeType.HasValue) { result.AppendFormat(" - {0}", attribute.AttributeType.ToString()); } return(result.ToString()); }
private ComboBoxItem CreateComboBoxItem(OptionMetadata item, bool value) { StringBuilder name = new StringBuilder(); name.Append(value); var label = CreateFileHandler.GetLocalizedLabel(item.Label); var description = CreateFileHandler.GetLocalizedLabel(item.Description); if (!string.IsNullOrEmpty(label)) { name.AppendFormat(" - {0}", label); } else if (!string.IsNullOrEmpty(description)) { name.AppendFormat(" - {0}", description); } var newItem = new ComboBoxItem() { Content = name.ToString(), Tag = value, }; cmBValue.Items.Add(newItem); return(newItem); }
public static string CreateEntityAndAttributeDescription(EntityIntellisenseData entity, AttributeIntellisenseData attribute) { List <string> lines = new List <string>(); if (entity.IsIntersectEntity) { lines.Add("IntersectEntity"); if (entity.ManyToManyRelationships != null) { var relations = entity.ManyToManyRelationships.Values.Where(r => string.Equals(r.IntersectEntityName, entity.EntityLogicalName, StringComparison.InvariantCultureIgnoreCase)); foreach (var rel in relations.OrderBy(r => r.Entity1Name).ThenBy(r => r.Entity2Name).ThenBy(r => r.Entity1IntersectAttributeName).ThenBy(r => r.Entity2IntersectAttributeName)) { lines.Add(string.Format("{0} - {1}", rel.Entity1Name, rel.Entity2Name)); } } } CreateFileHandler.FillLabelEntity(lines, true, entity.DisplayName, entity.DisplayCollectionName, entity.Description); lines.Add(string.Empty); lines.Add(string.Format("Attribute:\t{0}", GetDisplayTextAttribute(entity.EntityLogicalName, attribute))); FillDescriptionAttribute(lines, attribute); return(string.Join(System.Environment.NewLine, lines)); }
public IEnumerable <string> GetCommentsForEntity(EntityMetadata entityMetadata) { List <string> comments = new List <string>(); CreateFileHandler.FillLabelEntity(comments, _config.AllDescriptions, entityMetadata.DisplayName, entityMetadata.DisplayCollectionName, entityMetadata.Description, _config.TabSpacer); return(comments); }
public RoleEntityPrivilegeViewItem(EntityMetadata entityMetadata, IEnumerable <RolePrivilege> rolePrivileges, bool isCustomizable = false) { this.EntityMetadata = entityMetadata; this._IsCustomizable = isCustomizable; this.DisplayName = CreateFileHandler.GetLocalizedLabel(entityMetadata.DisplayName); LoadData(rolePrivileges, entityMetadata?.Privileges); }
private void FillListBox() { var optionSetOptions = AttributeMetadata.OptionSet.Options; if (_initialValues.Any()) { foreach (var item in _initialValues.OrderBy(v => v)) { if (optionSetOptions.Any(o => o.Value == item)) { continue; } var newItem = new CheckListBoxItem() { Content = string.Format("{0} - UnknownValue", item), Value = item, IsChecked = true, }; newItem.PropertyChanged += this.checkListBoxItem_PropertyChanged; lstBValues.Items.Add(newItem); } } foreach (var item in optionSetOptions.OrderBy(o => o.Value)) { StringBuilder name = new StringBuilder(); name.Append(item.Value); var label = CreateFileHandler.GetLocalizedLabel(item.Label); var description = CreateFileHandler.GetLocalizedLabel(item.Description); if (!string.IsNullOrEmpty(label)) { name.AppendFormat(" - {0}", label); } else if (!string.IsNullOrEmpty(description)) { name.AppendFormat(" - {0}", description); } var newItem = new CheckListBoxItem() { Content = name.ToString(), Value = item.Value.Value, IsChecked = _initialValues.Contains(item.Value.Value), }; newItem.PropertyChanged += this.checkListBoxItem_PropertyChanged; lstBValues.Items.Add(newItem); } }
public LinkedEntityMetadata(string logicalName, EntityMetadata entityMetadata1, EntityMetadata entityMetadata2) { this.LogicalName = logicalName; this.EntityMetadata1 = entityMetadata1; this.EntityMetadata2 = entityMetadata2; if (entityMetadata1 != null) { this.DisplayName1 = CreateFileHandler.GetLocalizedLabel(entityMetadata1.DisplayName); } if (entityMetadata2 != null) { this.DisplayName2 = CreateFileHandler.GetLocalizedLabel(entityMetadata2.DisplayName); } }
public LinkedOptionSetMetadata(string name, OptionSetMetadata optionSetMetadata1, OptionSetMetadata optionSetMetadata2) { this.Name = name; this.OptionSetMetadata1 = optionSetMetadata1; this.OptionSetMetadata2 = optionSetMetadata2; if (optionSetMetadata1 != null) { this.DisplayName1 = CreateFileHandler.GetLocalizedLabel(optionSetMetadata1.DisplayName); } if (optionSetMetadata2 != null) { this.DisplayName2 = CreateFileHandler.GetLocalizedLabel(optionSetMetadata2.DisplayName); } }
public string GenerateDescriptionSingle(SolutionComponent component, bool withManaged, bool withSolutionInfo, bool withUrls) { if (this.AllManagedProperties.Any()) { if (this.AllManagedProperties.ContainsKey(component.ObjectId.Value)) { var managedProperty = this.AllManagedProperties[component.ObjectId.Value]; FormatTextTableHandler handler = new FormatTextTableHandler(); handler.SetHeader( "LogicalName" , "DisplayName" , "Description" , "EnablesEntityName" , "EnablesAttributeName" , "ErrorCode" , "EvaluationPriority" , "IsPrivate" , "IsGlobalForOperation" , "ManagedPropertyType" , "Operation" ); handler.AddLine( managedProperty.LogicalName , CreateFileHandler.GetLocalizedLabel(managedProperty.DisplayName) , CreateFileHandler.GetLocalizedLabel(managedProperty.Description) , managedProperty.EnablesEntityName , managedProperty.EnablesAttributeName , managedProperty.ErrorCode.ToString() , managedProperty.EvaluationPriority.ToString() , managedProperty.IsPrivate.ToString() , managedProperty.IsGlobalForOperation.ToString() , managedProperty.ManagedPropertyType.ToString() , managedProperty.Operation.ToString() ); var str = handler.GetFormatedLinesWithHeadersInLine(false).FirstOrDefault(); return(string.Format("{0} {1}", this.ComponentTypeEnum.ToString(), str)); } } return(component.ToString()); }
public bool IgnoreOptionSet(OptionSetMetadata optionSetMetadata, AttributeMetadata attributeMetadata) { if (optionSetMetadata.Options == null || !optionSetMetadata.Options.Any(o => o.Value.HasValue) ) { return(true); } if (attributeMetadata != null && CreateFileHandler.IgnoreAttribute(attributeMetadata.EntityLogicalName, attributeMetadata.LogicalName) ) { return(true); } return(false); }
public void LoadData1(EntityMetadata entityMetadata1, IEnumerable <RolePrivilege> rolePrivileges1) { this._availablePrivilegesTypes1.Clear(); this.EntityMetadata1 = entityMetadata1; this.DisplayName1 = CreateFileHandler.GetLocalizedLabel(entityMetadata1.DisplayName); this._CreateRight1 = this._initialCreate1 = GetPrivilegeLevel(entityMetadata1?.Privileges, rolePrivileges1, _availablePrivilegesTypes1, PrivilegeType.Create); this._ReadRight1 = this._initialRead1 = GetPrivilegeLevel(entityMetadata1?.Privileges, rolePrivileges1, _availablePrivilegesTypes1, PrivilegeType.Read); this._UpdateRight1 = this._initialUpdate1 = GetPrivilegeLevel(entityMetadata1?.Privileges, rolePrivileges1, _availablePrivilegesTypes1, PrivilegeType.Write); this._DeleteRight1 = this._initialDelete1 = GetPrivilegeLevel(entityMetadata1?.Privileges, rolePrivileges1, _availablePrivilegesTypes1, PrivilegeType.Delete); this._AppendRight1 = this._initialAppend1 = GetPrivilegeLevel(entityMetadata1?.Privileges, rolePrivileges1, _availablePrivilegesTypes1, PrivilegeType.Append); this._AppendToRight1 = this._initialAppendTo1 = GetPrivilegeLevel(entityMetadata1?.Privileges, rolePrivileges1, _availablePrivilegesTypes1, PrivilegeType.AppendTo); this._ShareRight1 = this._initialShare1 = GetPrivilegeLevel(entityMetadata1?.Privileges, rolePrivileges1, _availablePrivilegesTypes1, PrivilegeType.Share); this._AssignRight1 = this._initialAssign1 = GetPrivilegeLevel(entityMetadata1?.Privileges, rolePrivileges1, _availablePrivilegesTypes1, PrivilegeType.Assign); }
public static string GetDisplayTextEntity(EntityIntellisenseData entityData) { StringBuilder result = new StringBuilder(entityData.EntityLogicalName); string temp = CreateFileHandler.GetLocalizedLabel(entityData.DisplayName); if (!string.IsNullOrEmpty(temp)) { result.AppendFormat(" - {0}", temp); } if (entityData.IsIntersectEntity) { result.Append(" - IntersectEntity"); } return(result.ToString()); }
public void LoadData(EntityMetadata entityMetadata, IEnumerable <RolePrivilege> rolePrivileges) { this.EntityMetadata = entityMetadata; this._availablePrivilegesTypes.Clear(); this.DisplayName = CreateFileHandler.GetLocalizedLabel(entityMetadata.DisplayName); this._CreateRight = this._initialCreate = GetPrivilegeLevel(rolePrivileges, PrivilegeType.Create); this._ReadRight = this._initialRead = GetPrivilegeLevel(rolePrivileges, PrivilegeType.Read); this._UpdateRight = this._initialUpdate = GetPrivilegeLevel(rolePrivileges, PrivilegeType.Write); this._DeleteRight = this._initialDelete = GetPrivilegeLevel(rolePrivileges, PrivilegeType.Delete); this._AppendRight = this._initialAppend = GetPrivilegeLevel(rolePrivileges, PrivilegeType.Append); this._AppendToRight = this._initialAppendTo = GetPrivilegeLevel(rolePrivileges, PrivilegeType.AppendTo); this._ShareRight = this._initialShare = GetPrivilegeLevel(rolePrivileges, PrivilegeType.Share); this._AssignRight = this._initialAssign = GetPrivilegeLevel(rolePrivileges, PrivilegeType.Assign); this._IsChanged = false; }
public static void SetGroupBoxNameByAttributeMetadata(GroupBox gbAttribute, AttributeMetadata attributeMetadata) { StringBuilder header = new StringBuilder(); header.Append(attributeMetadata.LogicalName.Replace("_", "__")); var displayName = CreateFileHandler.GetLocalizedLabel(attributeMetadata.DisplayName); var description = CreateFileHandler.GetLocalizedLabel(attributeMetadata.Description); if (!string.IsNullOrEmpty(displayName)) { header.AppendFormat(" - {0}", displayName.Replace("_", "__")); } else if (!string.IsNullOrEmpty(description)) { header.AppendFormat(" - {0}", description.Replace("_", "__")); } gbAttribute.Header = header.ToString(); }
public static void SetGroupBoxNameByAttributeMetadata(GroupBox gbAttribute, AttributeMetadata attributeMetadata) { StringBuilder header = new StringBuilder(attributeMetadata.LogicalName); var displayName = CreateFileHandler.GetLocalizedLabel(attributeMetadata.DisplayName); var description = CreateFileHandler.GetLocalizedLabel(attributeMetadata.Description); if (attributeMetadata.AttributeTypeName != null && !string.IsNullOrEmpty(attributeMetadata.AttributeTypeName.Value)) { header.AppendFormat(" - {0}", attributeMetadata.AttributeTypeName.Value); } else if (attributeMetadata.AttributeType.HasValue) { header.AppendFormat(" - {0}", attributeMetadata.AttributeType.ToString()); } var attrType = attributeMetadata.GetType(); if (attrType != typeof(AttributeMetadata)) { header.AppendFormat(" - {0}", attrType.Name); } if (!string.IsNullOrEmpty(displayName)) { header.AppendFormat(" - {0}", displayName); } else if (!string.IsNullOrEmpty(description)) { header.AppendFormat(" - {0}", description); } header.Replace("_", "__"); gbAttribute.Header = header.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="CameraClient"/> class. /// </summary> /// <param name="ipEndPoint">The camera ip address and port.</param> /// <param name="createFile">Optional handler to override local file creation.</param> /// <param name="createClient">Optional handler to override http client creation.</param> public CameraClient(IPEndPoint ipEndPoint, CreateFileHandler createFile = null, HttpClientFactoryHandler createClient = null) : this(new Uri($"http://{ipEndPoint}"), createFile, createClient) { }
private void FillComboBox(Entity entity) { cmBValue.Items.Clear(); cmBValue.Items.Add("<Null>"); ComboBoxItem currentItem = null; var statusOptionSetOptions = AttributeMetadata.OptionSet.Options.OfType <StatusOptionMetadata>(); if (_initialValueStatus.HasValue && !statusOptionSetOptions.Any(o => o.Value == _initialValueStatus.Value)) { StringBuilder name = new StringBuilder(); name.Append(_initialValueStatus.Value); if (entity != null && entity.FormattedValues.ContainsKey(AttributeMetadata.LogicalName) && !string.IsNullOrEmpty(entity.FormattedValues[AttributeMetadata.LogicalName]) ) { name.AppendFormat(" - {0}", entity.FormattedValues[AttributeMetadata.LogicalName]); } else { name.Append(" - UnknownValue"); } currentItem = new ComboBoxItem() { Content = name.ToString(), Tag = _initialValueStatus.Value, }; cmBValue.Items.Add(currentItem); } statusOptionSetOptions = AttributeMetadata.OptionSet.Options.OfType <StatusOptionMetadata>().Where(o => o.State == _initialValueState); foreach (var item in statusOptionSetOptions.OfType <StatusOptionMetadata>().OrderBy(o => o.Value)) { StringBuilder name = new StringBuilder(); name.Append(item.Value); var label = CreateFileHandler.GetLocalizedLabel(item.Label); var description = CreateFileHandler.GetLocalizedLabel(item.Description); if (!string.IsNullOrEmpty(label)) { name.AppendFormat(" - {0}", label); } else if (!string.IsNullOrEmpty(description)) { name.AppendFormat(" - {0}", description); } var newItem = new ComboBoxItem() { Content = name.ToString(), Tag = item.Value, }; cmBValue.Items.Add(newItem); if (item.Value == _initialValueStatus) { currentItem = newItem; } } if (currentItem != null) { cmBValue.SelectedItem = currentItem; } else { cmBValue.SelectedIndex = 0; } }
private void FillComboBox() { cmBValue.Items.Clear(); cmBValue.Items.Add("<Null>"); ComboBoxItem currentItem = null; var optionSetOptions = AttributeMetadata.OptionSet.Options; if (_initialValue.HasValue && !optionSetOptions.Any(o => o.Value == _initialValue.Value)) { StringBuilder name = new StringBuilder(); name.Append(_initialValue.Value); if (!string.IsNullOrEmpty(_initialFormattedValue)) { name.AppendFormat(" - {0}", _initialFormattedValue); } else { name.Append(" - UnknownValue"); } currentItem = new ComboBoxItem() { Content = name.ToString(), Tag = _initialValue.Value, }; cmBValue.Items.Add(currentItem); } foreach (var item in optionSetOptions.OrderBy(o => o.Value)) { StringBuilder name = new StringBuilder(); name.Append(item.Value); var label = CreateFileHandler.GetLocalizedLabel(item.Label); var description = CreateFileHandler.GetLocalizedLabel(item.Description); if (!string.IsNullOrEmpty(label)) { name.AppendFormat(" - {0}", label); } else if (!string.IsNullOrEmpty(description)) { name.AppendFormat(" - {0}", description); } var newItem = new ComboBoxItem() { Content = name.ToString(), Tag = item.Value.Value, }; cmBValue.Items.Add(newItem); if (item.Value == _initialValue) { currentItem = newItem; } } if (currentItem != null) { cmBValue.SelectedItem = currentItem; } else { cmBValue.SelectedIndex = 0; } }
/// <summary> /// Initializes a new instance of the <see cref="CameraClient"/> class. /// </summary> /// <param name="endPoint">The camera http end point.</param> /// <param name="createFile">Optional handler to override local file creation.</param> /// <param name="createClient">Optional handler to override http client creation.</param> public CameraClient(Uri endPoint, CreateFileHandler createFile = null, HttpClientFactoryHandler createClient = null) { EndPoint = endPoint; CreateFile = createFile ?? DefaultCreateFile; CreateClient = createClient ?? DefaultCreateClient; }
private async Task ShowExistingOptionSets() { if (!this.IsControlsEnabled) { return; } var service = await GetService(); ToggleControls(service.ConnectionData, false, Properties.WindowStatusStrings.LoadingOptionSets); this._itemsSource.Clear(); IEnumerable <OptionSetMetadata> list = Enumerable.Empty <OptionSetMetadata>(); try { if (service != null) { if (!_cacheOptionSetMetadata.ContainsKey(service.ConnectionData.ConnectionId)) { OptionSetRepository repository = new OptionSetRepository(service); var task = repository.GetOptionSetsAsync(); var optionSets = await task; _cacheOptionSetMetadata.Add(service.ConnectionData.ConnectionId, optionSets); } list = _cacheOptionSetMetadata[service.ConnectionData.ConnectionId]; } } catch (Exception ex) { this._iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex); } string entityName = string.Empty; string textName = string.Empty; this.Dispatcher.Invoke(() => { textName = txtBFilter.Text.Trim().ToLower(); if (!string.IsNullOrEmpty(cmBEntityName.Text) && cmBEntityName.Items.Contains(cmBEntityName.Text) ) { entityName = cmBEntityName.Text.Trim().ToLower(); } }); string filterEntity = null; if (service.ConnectionData.IsValidEntityName(entityName)) { filterEntity = entityName; } if (!string.IsNullOrEmpty(filterEntity)) { var entityId = service.ConnectionData.GetEntityMetadataId(filterEntity); if (entityId.HasValue) { var source = GetMetadataSource(service); var entityMetadata = await source.GetEntityMetadataAsync(entityId.Value); var entityOptionSets = new HashSet <Guid>(entityMetadata .Attributes .OfType <EnumAttributeMetadata>() .Where(a => a.OptionSet != null && a.OptionSet.IsGlobal.GetValueOrDefault()) .Select(a => a.OptionSet.MetadataId.Value) ); list = list.Where(o => entityOptionSets.Contains(o.MetadataId.Value)); } } list = FilterList(list, textName); this.lstVwOptionSets.Dispatcher.Invoke(() => { foreach (var entity in list) { string name = entity.Name; string displayName = CreateFileHandler.GetLocalizedLabel(entity.DisplayName); OptionSetMetadataListViewItem item = new OptionSetMetadataListViewItem(name, displayName, entity); this._itemsSource.Add(item); } if (this.lstVwOptionSets.Items.Count == 1) { this.lstVwOptionSets.SelectedItem = this.lstVwOptionSets.Items[0]; } }); ToggleControls(service.ConnectionData, true, Properties.WindowStatusStrings.LoadingOptionSetsCompletedFormat1, list.Count()); }
public void GenerateDescription(StringBuilder builder, IEnumerable <SolutionComponent> components, bool withManaged, bool withSolutionInfo, bool withUrls) { FormatTextTableHandler handler = new FormatTextTableHandler(); handler.SetHeader( "LogicalName" , "DisplayName" , "Description" , "EnablesEntityName" , "EnablesAttributeName" , "ErrorCode" , "EvaluationPriority" , "IsPrivate" , "IsGlobalForOperation" , "ManagedPropertyType" , "Operation" , "Behavior" ); //public Label Description { get; } //public Label DisplayName { get; } //public string EnablesAttributeName { get; } //public string EnablesEntityName { get; } //public int? ErrorCode { get; } //public ManagedPropertyEvaluationPriority? EvaluationPriority { get; } //public string IntroducedVersion { get; } //public bool? IsGlobalForOperation { get; } //public bool? IsPrivate { get; } //public string LogicalName { get; } //public ManagedPropertyType? ManagedPropertyType { get; } //public ManagedPropertyOperation? Operation { get; } foreach (var comp in components) { if (this.AllManagedProperties.ContainsKey(comp.ObjectId.Value)) { var behavior = SolutionComponent.GetRootComponentBehaviorName(comp.RootComponentBehavior?.Value); var managedProperty = this.AllManagedProperties[comp.ObjectId.Value]; handler.AddLine( managedProperty.LogicalName , CreateFileHandler.GetLocalizedLabel(managedProperty.DisplayName) , CreateFileHandler.GetLocalizedLabel(managedProperty.Description) , managedProperty.EnablesEntityName , managedProperty.EnablesAttributeName , managedProperty.ErrorCode.ToString() , managedProperty.EvaluationPriority.ToString() , managedProperty.IsPrivate.ToString() , managedProperty.IsGlobalForOperation.ToString() , managedProperty.ManagedPropertyType.ToString() , managedProperty.Operation.ToString() , behavior ); } else { handler.AddLine(comp.ObjectId.ToString()); } } List <string> lines = handler.GetFormatedLines(true); lines.ForEach(item => builder.AppendFormat(formatSpacer, item).AppendLine()); }
public EntityMetadataListViewItem(EntityMetadata entityMetadata) { this.DisplayName = CreateFileHandler.GetLocalizedLabel(entityMetadata.DisplayName); this.EntityMetadata = entityMetadata; }
public IEnumerable <string> GetCommentsForAttribute(EntityMetadata entityMetadata, AttributeMetadata attributeMetadata) { var listStrings = CreateFileHandler.UnionStrings(attributeMetadata.DisplayName, attributeMetadata.Description, null, null, _config.AllDescriptions, _config.TabSpacer); return(listStrings); }
private async Task RetrieveEntityInformation() { try { ToggleControls(false, Properties.WindowStatusStrings.GettingEntityMetadataFormat1, _entityName); var repositoryEntityMetadata = new EntityMetadataRepository(_service); this._entityMetadata = await repositoryEntityMetadata.GetEntityMetadataWithAttributesAsync(_entityName); ToggleControls(true, Properties.WindowStatusStrings.GettingEntityMetadataCompletedFormat1, _entityName); if (this._entityMetadata != null && this._entityMetadata.Attributes != null ) { var stateCodeAttributeMetadata = this._entityMetadata.Attributes.OfType <StateAttributeMetadata>().FirstOrDefault(); var statusCodeAttributeMetadata = this._entityMetadata.Attributes.OfType <StatusAttributeMetadata>().FirstOrDefault(); if (stateCodeAttributeMetadata != null && stateCodeAttributeMetadata.OptionSet != null && stateCodeAttributeMetadata.OptionSet.Options != null && statusCodeAttributeMetadata != null && statusCodeAttributeMetadata.OptionSet != null && statusCodeAttributeMetadata.OptionSet.Options != null ) { foreach (var statusCodeOption in statusCodeAttributeMetadata .OptionSet .Options .OfType <StatusOptionMetadata>() .OrderBy(o => o.State) .ThenBy(o => o.Value) ) { var stateCodeOption = stateCodeAttributeMetadata.OptionSet.Options.OfType <StateOptionMetadata>().FirstOrDefault(o => o.Value == statusCodeOption.State); if (stateCodeOption != null) { string stateName = CreateFileHandler.GetLocalizedLabel(stateCodeOption.Label); string statusName = CreateFileHandler.GetLocalizedLabel(statusCodeOption.Label); _sourceStatusCodes.Add(new StatusCodeViewItem( stateCodeOption.Value.Value , stateName , statusCodeOption.Value.Value , statusName , stateCodeOption.Label , statusCodeOption.Label , statusCodeOption )); } } } } FilterStatusCodes(); } catch (Exception ex) { _iWriteToOutput.WriteErrorToOutput(_service.ConnectionData, ex); } }
public static string GetDisplayTextOptionSetValue(string entityName, string attributeName, OptionMetadata optionMetadata) { return(string.Format("{0}.{1} {2} - {3}", entityName, attributeName, CreateFileHandler.GetLocalizedLabel(optionMetadata.Label), optionMetadata.Value)); }
/// <summary> /// Initializes a new instance of the <see cref="CameraClient"/> class using <see cref="DefaultIpEndPoint"/>. /// </summary> /// <param name="createFile">Optional handler to override local file creation.</param> /// <param name="createClient">Optional handler to override http client creation.</param> public CameraClient(CreateFileHandler createFile = null, HttpClientFactoryHandler createClient = null) : this(DefaultIpEndPoint, createFile, createClient) { }