public static void UpdateControllerAddress(string cType, string newIP, string controllerName) { string oldMergeName = MergeTypeNameAndControllerName(cType, controllerName); controllerDict[oldMergeName] = newIP; ControllerListSource cls = FindNameListItemByName(oldMergeName); if (cls != null) { cls.IP = newIP; } }
public static void AddController(string controllerType, string controllerName, string controllerAddress, bool bindingAdd = false) { string mergeName = MergeTypeNameAndControllerName(controllerType, controllerName); controllerDict.Add(mergeName, controllerAddress); //Add new dataset to its data dict and initialize three tables DataSet ds = new DataSet(mergeName); dataDict.Add(mergeName, ds); InitialControllerDataSet(mergeName); if (bindingAdd) { ControllerListSource ncs = new ControllerListSource(mergeName, controllerAddress); controllerNameList.Add(ncs); } }
public static void RemoveController(string cType, string controllerName, bool removeBind = false) { string oldMergeName = MergeTypeNameAndControllerName(cType, controllerName); controllerDict.Remove(oldMergeName); dataDict.Remove(oldMergeName); if (removeBind) { ControllerListSource cls = FindNameListItemByName(oldMergeName); controllerNameList.Remove(cls); } /*ACSControllerTable.Rows.Remove((from DataRow r in ACSControllerTable.Rows * where (string)r["Controller Name"] == controllerName * select r).First()); * ACSControllerTable.Rows.Add(false, "", "");*/ }
public static void UpdateControllerName(string cType, string oldKey, string newKey, bool updateBind = false) { string newMergeName = MergeTypeNameAndControllerName(cType, newKey); string oldMergeName = MergeTypeNameAndControllerName(cType, oldKey); controllerDict.Add(newMergeName, controllerDict[oldMergeName]); controllerDict.Remove(oldMergeName); dataDict.Add(newMergeName, dataDict[oldMergeName]); dataDict.Remove(oldMergeName); dataDict[newMergeName].DataSetName = newMergeName; if (updateBind) { ControllerListSource cls = FindNameListItemByName(oldMergeName); int index = controllerNameList.IndexOf(cls); ControllerListSource ncl = new ControllerListSource(newMergeName, cls.IP); controllerNameList.Insert(index, ncl); controllerNameList.Remove(cls); } }