void OnNodeViewModelRemoved(object sender, EventArgs e) { var currentNode = SelectedNode; //Remove m_Nodes.Remove(currentNode); m_AgentConfig.Nodes.Remove(currentNode); //Select a new node SelectedNode = m_Nodes.First(); //Save m_AgentConfig.Save(); FireEventHandler(Removed, currentNode); }
public void testReadAndWriteMappings() { String FILE_NAME = "tmp.cfg"; // TODO: Right now we don't have a way to build up a Mappings hierarchy // without reading it from a file. This should be fixed and this // test should be updated as a result. AgentConfig cfg = createMappings(); debug(cfg.Document); // save the mappings to a file FileInfo f = new FileInfo(FILE_NAME); if (f.Exists) { f.Delete(); } using (StreamWriter fs = new StreamWriter(FILE_NAME)) { try { cfg.Save(fs); } finally { fs.Close(); } } // Read the new mappings cfg = new AgentConfig(); cfg.Read(FILE_NAME, false); Mappings reparsed = cfg.Mappings; assertMappings(reparsed); }