private void SaveButtonClick(object sender, EventArgs e) { PassportLib.Passport passport = new PassportLib.Passport(); TreeNode groupNode = passTree.TopNode; for (int i = 0; i < groupNode.Nodes.Count; i++) { PassportGroup group = new PassportGroup(groupNode.Nodes[i].Text); TreeNode cardNode = groupNode.Nodes[i]; for (int j = 0; j < cardNode.Nodes.Count; j++) { PassportCard card = new PassportCard(cardNode.Nodes[j].Text); TreeNode itemNode = cardNode.Nodes[j]; for (int k = 0; k < itemNode.Nodes.Count; k++) { PassportItem item = new PassportItem(itemNode.Nodes[k].Text, itemNode.Nodes[k].ToolTipText); card.Items.Add(item); } group.Cards.Add(card); } passport.Groups.Add(group); } if (!passport.Save(passFile, "123")) { MessageBox.Show(Resources.SaveFailed, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void SaveButtonClick(object sender, EventArgs e) { PassportLib.Passport passport = new PassportLib.Passport(); TreeNode groupNode = passTree.TopNode; for (int i = 0; i < groupNode.Nodes.Count; i++) { PassportGroup group = new PassportGroup(groupNode.Nodes[i].Text); TreeNode cardNode = groupNode.Nodes[i]; for (int j = 0; j < cardNode.Nodes.Count; j++) { PassportCard card = new PassportCard(cardNode.Nodes[j].Text); TreeNode itemNode = cardNode.Nodes[j]; for (int k = 0; k < itemNode.Nodes.Count; k++) { PassportItem item = new PassportItem(itemNode.Nodes[k].Text, itemNode.Nodes[k].ToolTipText); card.Items.Add(item); } group.Cards.Add(card); } passport.Groups.Add(group); } if (!passport.Save(passFile, "123")) MessageBox.Show(Resources.SaveFailed, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); }