public static List <SWF.Control> GetControlsFromProvider(ErrorProvider errorProvider) { FragmentRootControlProvider parent = (FragmentRootControlProvider)errorProvider.Navigate(NavigateDirection.Parent); if (parent == null) { return(null); } if (parentDictionary == null || parentDictionary.ContainsKey(parent.Control) == false) { return(null); } ErrorProviderControlList parentControls = parentDictionary [parent.Control]; List <SWF.Control> controls = (from c in parentControls where dictionary [c] == errorProvider.SWFErrorProvider select c).ToList(); return(controls); }
public static void AddControl(SWF.Control control, SWF.Control parent, SWF.ErrorProvider provider) { if (dictionary == null) { dictionary = new ErrorProviderControlDictionary(); parentDictionary = new ParentDictionary(); } dictionary [control] = provider; ErrorProviderControlList parentControls; if (parentDictionary.TryGetValue(parent, out parentControls) == false) { parentControls = new ErrorProviderControlList(); parentDictionary [parent] = parentControls; } if (parentControls.Contains(control) == false) { parentControls.Add(control); ErrorProvider errorProvider = (ErrorProvider)ProviderFactory.FindProvider(provider); if (errorProvider == null) { errorProvider = (ErrorProvider)ProviderFactory.GetProvider(provider); } errorProvider.AddControl(control); } }