public virtual object Clone() { NamedCollection namedCollection = (NamedCollection)GetType().GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic)[0].Invoke(new object[2] { parent, common }); namedCollection.parent = parent; namedCollection.common = common; namedCollection.elementType = elementType; IEnumerator enumerator = GetEnumerator(); try { while (enumerator.MoveNext()) { NamedElement namedElement = (NamedElement)((ICloneable)enumerator.Current).Clone(); namedCollection.InnerList.Add(namedElement); namedElement.collection = namedCollection; } return(namedCollection); } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
internal ScaleBase GetScaleBase() { if (Common == null) { return(null); } if (scaleName == string.Empty) { return(null); } GaugeBase gaugeBase = GetGaugeBase(); NamedCollection namedCollection = null; if (gaugeBase is CircularGauge) { namedCollection = ((CircularGauge)gaugeBase).Scales; } if (gaugeBase is LinearGauge) { namedCollection = ((LinearGauge)gaugeBase).Scales; } if (namedCollection == null) { return(null); } return((ScaleBase)namedCollection.GetByName(scaleName)); }
internal string GetDefaultScaleName(string scaleName) { NamedCollection namedCollection = null; if (this is CircularGauge) { namedCollection = ((CircularGauge)this).Scales; } if (this is LinearGauge) { namedCollection = ((LinearGauge)this).Scales; } if (namedCollection.GetIndex(scaleName) != -1) { return(scaleName); } if (scaleName == "Default" && namedCollection.Count > 0) { return(namedCollection.GetByIndex(0).Name); } return(scaleName); }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { ArrayList arrayList = new ArrayList(); if (context != null && context.Instance != null) { NamedElement namedElement = null; NamedCollection namedCollection = null; if (context.Instance is NamedElement) { namedElement = (NamedElement)context.Instance; } if (context.Instance is IList && ((IList)context.Instance).Count > 0) { namedElement = (NamedElement)((IList)context.Instance)[0]; } if (namedElement != null && namedElement.Common != null && namedElement.ParentElement != null) { if (namedElement.ParentElement is CircularGauge) { namedCollection = ((CircularGauge)namedElement.ParentElement).Scales; } if (namedElement.ParentElement is LinearGauge) { namedCollection = ((LinearGauge)namedElement.ParentElement).Scales; } } if (namedCollection != null) { foreach (NamedElement item in namedCollection) { arrayList.Add(item.Name); } } } return(new StandardValuesCollection(arrayList)); }