public EnumTweak(Tweak tweak) { this.InitializeComponent(); ValuesList.SetValue(ListPicker.ItemCountThresholdProperty, 20); _tweak = tweak; _tweak.ValueChanged += ValueChanged; }
public RowInfo() { changeType = ChangeType.None; values = new ValuesList(); serverKey = string.Empty; _dbSetInfo = null; _changeState = null; }
public override void EvaluateNode(EvaluationContext context, AstMode mode) { var result = new ValuesList(); foreach (var expr in ChildNodes) { expr.Evaluate(context, AstMode.Read); result.Add(context.Data.Pop()); } //Push list on the stack context.Data.Push(result); }
public double GetMedianValue() { if (Type == FeatureType.Numeric) { var intList = ValuesList.Select(x => double.Parse(x, CultureInfo.InvariantCulture)).ToList(); var median = intList.Median(); return(median); } return(-1); }
/// <summary> /// 将指定字段值数组添加到ValuesList属性。 /// </summary> /// <param name="values">字段值数组(一条记录的动态参数值)。</param> /// <exception cref="ArgumentNullException">如果values为空引用,则抛出该异常。</exception> public void AddValues(object[] values) { if (values == null) { throw new ArgumentNullException("values"); } if (values.Length > 0) { ValuesList.Add(values); } }
public override void EvaluateNode(EvaluationContext context, AstMode mode) { var result = new ValuesList(); foreach (var expr in ChildNodes) { expr.Evaluate(context, AstMode.Read); result.Add(context.Data.Pop()); } //Push list on the stack context.Data.Push(result); }
private void GenerateResitorSeries(int decade, ResitorListGenerator.Series serie) { if (!_loaded) { return; } ValuesList.Clear(); double multiply = 1; switch (decade) { case 1: multiply = 0.01; break; case 10: multiply = 0.1; break; case 1000: multiply = 10; break; case 10000: multiply = 100; break; case 100000: multiply = 1000; break; case 1000000: multiply = 10000; break; case 100: default: multiply = 1; break; } StringBuilder sb = new StringBuilder(); var list = ResitorListGenerator.GenerateList(serie, multiply); foreach (var i in list) { sb.AppendFormat("{0}\r\n", i); } ValuesList.Text = sb.ToString(); sb.Clear(); sb = null; }
public FormFieldViewModel(FormField field, string[] languageCodes) : this() { var names = field.GetNames(true); var values = field.GetValues(false); IEnumerable <Option> options = typeof(OptionsField).IsAssignableFrom(field.GetType()) ? ((OptionsField)field).Options : new List <Option>(); foreach (var name in names) { if (languageCodes.Contains(name.LanguageCode)) { Names.Add(name.LanguageCode, name.Value); } } foreach (var value in values) { if (languageCodes.Contains(value.LanguageCode)) { if (Values.ContainsKey(value.LanguageCode)) { Values = new Dictionary <string, string>(); ValuesList.Add(Values); Values.Add(value.LanguageCode, value.Value); } else { Values.Add(value.LanguageCode, value.Value); } } } foreach (string code in languageCodes) { SelectedOptions.Add(code, new List <string>()); } foreach (var option in options) { if (option.Selected) { foreach (var optionVal in option.Value) { if (languageCodes.Contains(optionVal.LanguageCode)) { SelectedOptions[optionVal.LanguageCode].Add(optionVal.Value); } } } } }
public void SetAndCheckType() { var isOnlyDigital = ValuesList.All(x => IsDigitsOnly(x)); if (isOnlyDigital) { Type = FeatureType.Numeric; } else { Type = FeatureType.Alphanumeric; } }
public async Task <ValuesList> Get() { var model = new ValuesList { Items = new[] { new Value { Id = 1, Name = "value 1", CreatedAtUtc = DateTime.UtcNow } } }; return(await Task.FromResult(model)); }
/// <summary> /// 将指定数据表中的值添加到ValuesList属性。 /// </summary> /// <param name="dt">数据表。</param> /// <exception cref="ArgumentNullException">如果dt为空引用,则抛出该异常。</exception> public void AddValues(DataTable dt) { if (dt == null) { throw new ArgumentNullException("dt"); } if (dt.Columns.Count == 0 || dt.Rows.Count == 0) { return; } //将数据表中每条记录的字段值数组,复制到ValuesList属性中 foreach (DataRow row in dt.Rows) { ValuesList.Add(row.ItemArray); } }
public void UpdateEntityFromRowInfo(object entity, RowInfo rowInfo, bool isOriginal) { DbSetInfo dbSetInfo = rowInfo.GetDbSetInfo(); ValuesList values = rowInfo.values; ApplyValues(entity, rowInfo, "", values.ToArray(), isOriginal); if (!isOriginal && rowInfo.changeType == ChangeType.Added) { foreach (ParentChildNode pn in rowInfo.GetChangeState().ParentRows) { if (!_dataHelper.SetValue(entity, pn.Association.childToParentName, pn.ParentRow.GetChangeState().Entity, false)) { throw new DomainServiceException(string.Format(ErrorStrings.ERR_CAN_NOT_SET_PARENT_FIELD, pn.Association.childToParentName, dbSetInfo.GetEntityType().Name)); } } } }
public List <string> GetPrintableValues() { switch (Type) { case FeatureType.Alphanumeric: return(ValuesList.ToList()); case FeatureType.Numeric: var median = GetMedianValue(); return(new List <string>() { $"to {median} {(Type == FeatureType.Numeric ? Unit : string.Empty)}", $"from {median} {(Type == FeatureType.Numeric ? Unit : string.Empty)}", }); default: return(new List <string>()); } }
protected override void Execute(CodeActivityContext context) { var regEx = new Regex("[^a-zA-Z0-9]+"); var minDistance = 99999; var toBeMatched = regEx.Replace(ToBeMatched.Get(context), "").ToLower(); var valueDictionary = new Dictionary <string, int>(); var findClosestMatch = FindClosestMatch.Get(context); foreach (var value in ValuesList.Get(context)) { var val = regEx.Replace(value, "").ToLower(); if (!findClosestMatch && val == toBeMatched) { this.MatchedItem.Set(context, value); break; } if (findClosestMatch) { var distance = LevenshteinDistance.Compute(toBeMatched, val); valueDictionary.Add(value, distance); if (minDistance > distance) { minDistance = distance; } } } if (findClosestMatch) { var result = valueDictionary.FirstOrDefault(val => val.Value == minDistance).Key; this.MatchedItem.Set(context, result); } }
/// <summary> /// Removes all items from the Table. /// </summary> public void Clear() { if (!_isAlive) { throw new InvalidOperationException(string.Format("Attempting to Clear on dead Table")); } if (m_ValuesList != null) { ValuesList.Clear(); } if (m_StringMap != null) { m_StringMap.Clear(); } if (m_ArrayMap != null) { m_ArrayMap.Clear(); } if (m_ValueMap != null) { m_ValueMap.Clear(); } m_CachedLength = -1; }
public void AddValue(params string[] values) { if (values.Length == IndiciesCount) { string ready = "("; for (int i = 0; i < values.Length; i++) { if (values[i] == values.Last()) { ready += $"'{values[i]}')"; } else { ready += $"'{values[i]}', "; } } ValuesList.Add(ready); } else { throw new FormatException($"Incorrect values count for adding to statement. Need: '{IndiciesCount}', received: {values.Length}"); } }
void IVisitor.VisitBefore(ValuesList valuesList) { this.ParentExists(valuesList); }
public override QsiTableNode VisitValuesList(ValuesList valuesList) { throw new QsiException(QsiError.Syntax); }
void IVisitor.VisitOnSeparator(ValuesList valuesList, int offset, int i) { this.ParentExists(valuesList); }
void IVisitor.VisitAfter(ValuesList valuesList) { this.ParentExists(valuesList); }
public void RemoveValues(int index) => ValuesList.Remove(GetValuesByIndex(index));
public bool LoadTiff(string Filename, out Exception errorMsg) { errorMsg = new Exception(); try { using (var stream = File.Open(Filename, FileMode.Open)) { var reader = TiffReader.Create(stream); reader.ReadHeader(); // Read Header // Read Image File Directories for (var count = reader.ReadImageFileDirectory(); count != 0; count = reader.ReadImageFileDirectory()) { Dictionary.Clear(); // Read Tags for (ITag tag = reader.ReadTag(); tag != null; tag = reader.ReadTag()) { Dictionary.Add(tag.TagId, new Collection <object>()); switch (tag.TagId) { case TiffTags.StripOffsets: // Read Values of Tag for (object value = reader.ReadHandle(); value != null; value = reader.ReadHandle()) { Dictionary[tag.TagId].Add(value); } break; default: // Read Values of Tag for (object value = reader.ReadValue(); value != null; value = reader.ReadValue()) { Dictionary[tag.TagId].Add(value); } break; } } // Read Strips for (int i = 0; i < Dictionary[TiffTags.StripOffsets].Count; i++) { ValuesList.Clear(); var data = reader.ReadData((TiffHandle)Dictionary[TiffTags.StripOffsets][i], Convert.ToInt64(Dictionary[TiffTags.StripByteCounts][i])); ValuesList.Add(data); } ImageHeight = (ushort)Dictionary[TiffTags.ImageLength][0]; ImageWidth = (ushort)Dictionary[TiffTags.ImageWidth][0]; } } } catch (Exception e) { ValuesList.Add(new byte[0]); errorMsg = e; return(false); } return(true); }
public RowInfo() { changeType = ChangeType.None; values = new ValuesList(); serverKey = string.Empty; }