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); } }
// /// <summary> /// 最短路径 /// </summary> /// <returns></returns> public static string GetTheMinCostPath() { bool isStart = false; string startKey = "end"; string path = "end=>"; while (!isStart) { path += ParentDictionary[startKey] + "=>"; startKey = ParentDictionary[startKey]; if (!ParentDictionary.ContainsKey(ParentDictionary[startKey])) { path += ParentDictionary[startKey]; isStart = true; } } return(path); }