저는 처음으로 XML을 사용하여 저축 /로드 측면에 매달 렸습니다. 응용 프로그램이 닫힐 때 텍스트 상자의 정보를 xml 파일에 저장하려면 오른쪽 위 모서리에있는 "X"를 사용하여 응용 프로그램을 닫을 수 없습니다. xml 파일을 삭제하려고 시도했습니다. 그것을 다시 만들었지 만 여전히 도움이되지는 않습니다.C# 응용 프로그램이 xml에 저장되지 않았습니다.
이제 앱을 닫았으며 저장 기능이 XML에서 작동하지만로드 기능은 xml에서 정보를 추가하는 foreach 루프를 거치지 않습니다. 응용 프로그램
XmlDocument xDoc = new XmlDocument();
xDoc.Load(path + place);
foreach(XmlNode xNode in xDoc.SelectNodes("ClientMeasurements\\Client"))
{
Client c = new Client();
c.Name = xNode.SelectSingleNode("Name").InnerText;
c.InitialForearm = xNode.SelectSingleNode("InitialForearm").InnerText;
c.InitialUpperArmR = xNode.SelectSingleNode("InitialUpperArmRight").InnerText;
c.InitialUpperArmL = xNode.SelectSingleNode("InitialUpperArmLeft").InnerText;
c.InitialChest = xNode.SelectSingleNode("InitialChest").InnerText;
c.InitialWaist = xNode.SelectSingleNode("InitialWaist").InnerText;
c.InitialHips = xNode.SelectSingleNode("InitialHips").InnerText;
c.InitialThighR = xNode.SelectSingleNode("InitialThighRight").InnerText;
c.InitialThighL = xNode.SelectSingleNode("InitialThighLeft").InnerText;
c.InitialCalfR = xNode.SelectSingleNode("InitialCalfRight").InnerText;
c.InitialCalfL = xNode.SelectSingleNode("InitialCalfLeft").InnerText;
c.MostRecentForearm = xNode.SelectSingleNode("MostRecentForearm").InnerText;
c.MostRecentUpperArmR = xNode.SelectSingleNode("MostRecentUpperArmRight").InnerText;
c.MostRecentUpperArmL = xNode.SelectSingleNode("MostRecentUpperArmLeft").InnerText;
c.MostRecentChest = xNode.SelectSingleNode("MostRecentChest").InnerText;
c.MostRecentWaist = xNode.SelectSingleNode("MostRecentWaist").InnerText;
c.MostRecentHips = xNode.SelectSingleNode("MostRecentHips").InnerText;
c.MostRecentThighR = xNode.SelectSingleNode("MostRecentThighRight").InnerText;
c.MostRecentThighL = xNode.SelectSingleNode("MostRecentThighLeft").InnerText;
c.MostRecentCalfR = xNode.SelectSingleNode("MostRecentCalfRight").InnerText;
c.MostRecentCalfL = xNode.SelectSingleNode("MostRecentCalfLeft").InnerText;
client.Add(c);
listView1.Items.Add(c.Name);
}
}
:
은 기본적으로 당신이
[Serializeable]
와 클라이언트 클래스를 장식 한 후 저장하고clients
개체를로드하기 위해이 같은 것을 사용하려는 XML 파일에서 (내가 있으리라 믿고있어 수집의 일종) 닫기 버튼을 클릭 할 수 없다는 것은 무엇을 의미합니까? 회색으로 표시됩니까? 그것을 클릭하면 멈 춥니 다? – mclaassen앱을 클릭하면 응답이 없습니다. 회색으로 표시되지 않고 버튼이 클릭되지만 앱을 종료하지는 않습니다. –
중단 점을 두어 코드 또는 메서드 호출 중 어떤 줄이 문제인지 확인해 보았습니까? – TheVillageIdiot