/// <summary> /// 根据SizeTypes生成对应的Bootstrap所适应的尺寸class /// </summary> /// <param name="attributes">该元素设置的 HTML 特性。</param> /// <param name="prefix">前缀,例如按钮是btn。</param> /// <param name="size">尺寸</param> public static void BuildSizeClass(this IDictionary <string, object> attributes, string prefix = null, SizeTypes size = SizeTypes.Normal) { if (size == SizeTypes.Normal) { return; } attributes.AddOrMerge("class", " {0}{1} ".StringFormat(prefix, size.ToString().ToLower())); }
public string GetXML() { string strdata = "<CameraData>"; strdata = strdata + "<Name>" + strName + "</Name>"; strdata = strdata + "<Size>" + SizeTypestmp.ToString() + "</Size></CameraData>"; return(strdata); }
private void Init(string value, IFormatProvider provider, SizeTypes defaultType) { if (provider == null) { provider = CultureInfo.CurrentCulture; } string text = value.Trim(); int length = text.Length; NumberFormatInfo numberFormatInfo = provider.GetFormat(typeof(NumberFormatInfo)) as NumberFormatInfo; if (numberFormatInfo == null) { numberFormatInfo = CultureInfo.InvariantCulture.NumberFormat; } int num = -1; for (int i = 0; i < length; i++) { char c = text[i]; if (!char.IsDigit(c) && c != numberFormatInfo.NegativeSign[0] && c != numberFormatInfo.NumberDecimalSeparator[0] && c != numberFormatInfo.NumberGroupSeparator[0]) { break; } num = i; } if (num == -1) { throw new FormatException(SRErrors.UnitParseNoDigits(value)); } if (num < length - 1) { try { m_type = GetTypeFromString(text.Substring(num + 1).Trim().ToLowerInvariant()); } catch (ArgumentException ex) { throw new FormatException(ex.Message); } } else { if (defaultType == SizeTypes.Invalid) { throw new FormatException(SRErrors.UnitParseNoUnit(value)); } m_type = defaultType; } string text2 = text.Substring(0, num + 1); try { m_value = double.Parse(text2, provider); } catch { throw new FormatException(SRErrors.UnitParseNumericPart(value, text2, m_type.ToString("G"))); } }