private void add(ObservableCollection <CameraNameWrapper> list) { CameraNameWrapper item = new CameraNameWrapper(null); item.NotAssociated = true; CameraNameList.Add(item); }
private void set(int?index) { if (index < CameraNameList.Count && !string.IsNullOrEmpty(CameraNameList[SelectedIndex].CameraName)) { CameraNameWrapper cam = CameraNameList[SelectedIndex]; foreach (CameraNameWrapper item in CameraNameList) { if (item.CameraName == CameraName) { item.AssociatedIP = ""; item.NotAssociated = true; item.username = ""; item.password = ""; break; } } cam.NotAssociated = false; cam.AssociatedIP = camera.IP; cam.username = camera.UserName; cam.password = camera.Password; CameraName = cam.CameraName; camera.CameraName = cam.CameraName; } else { MessageBox.Show("Invalid Camera Name", "Warning"); } }
public void parse(Dictionary <string, string> CameraName2IP, Dictionary <string, string> IP2CameraName, ObservableCollection <CameraNameWrapper> cameraNameList) { XmlTextReader reader = new XmlTextReader(fileName); XmlDocument doc = new XmlDocument(); doc.Load(fileName); XmlNodeList nodes = doc.DocumentElement.SelectNodes("/CameraNames/Camera"); foreach (XmlNode node in nodes) { string cameraName = node.SelectSingleNode("Name").InnerText; string ip = node.SelectSingleNode("IP").InnerText; string username = node.SelectSingleNode("Username").InnerText; string password = node.SelectSingleNode("Password").InnerText; var item = new CameraNameWrapper(cameraName); item.AssociatedIP = ip; if (ip != "") { CameraName2IP[cameraName] = ip; IP2CameraName[ip] = cameraName; item.NotAssociated = false; string decryptedUsername = coder.Decrypt(username); string decryptedPassword = coder.Decrypt(password); item.username = decryptedUsername; item.password = decryptedPassword; } else { item.NotAssociated = true; } cameraNameList.Add(item); } }