/// <summary> /// Clear and intialize all dictionaries /// </summary> public void ClearControlMaps() { if (null == ControlMapMarkup) { ControlMapMarkup = new Dictionary <string, ControlMap>(); } else { ControlMapMarkup.Clear(); } if (null == ControlMapOffsetKey) { ControlMapOffsetKey = new Dictionary <string, ControlMap>(); } else { ControlMapOffsetKey.Clear(); } if (null == ControlMapControlType) { ControlMapControlType = new Dictionary <Type, ControlMap>(); } else { ControlMapControlType.Clear(); } }
/// <summary> /// Entry point for adding a new <c>ControlMap</c> to /// all relevant Dictionaries /// </summary> /// <param name="controlMap"></param> /// <returns></returns> public ControlMap Add(ControlMap controlMap) { if (null == controlMap) { throw new ArgumentNullException(); } if (null != controlMap.MarkupTag) { if (!controlMap.HasAttributeDependency()) { string markuptag = controlMap.MarkupTag.ToLowerInvariant(); if (!ControlMapMarkup.ContainsKey(markuptag)) { ControlMapMarkup.Add(markuptag, controlMap); } if (controlMap.AdditionalMarkupTags.Count > 0) { foreach (string tag in controlMap.AdditionalMarkupTags) { string tmpTag = tag.ToLowerInvariant(); if (!ControlMapMarkup.ContainsKey(tmpTag)) { ControlMapMarkup.Add(tmpTag, controlMap); } } } } } if (null != controlMap.ControlType) { if (!ControlMapControlType.ContainsKey(controlMap.ControlType)) { ControlMapControlType.Add(controlMap.ControlType, controlMap); } } if (!ControlMapOffsetKey.ContainsKey(controlMap.OffsetKey)) { ControlMapOffsetKey.Add(controlMap.OffsetKey, controlMap); } return(controlMap); }