Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 private void MainFormLoad(object sender, EventArgs e)
 {
     PassportLib.Passport passport = new PassportLib.Passport();
     if (!passport.Load(passFile, "123"))
     {
         MessageBox.Show(Resources.PassFileOpenError, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     foreach (PassportGroup group in passport.Groups)
     {
         TreeNode gNode = new TreeNode(group.Name, groupImg, groupImg);
         passTree.TopNode.Nodes.Add(gNode);
         foreach (PassportCard card in group.Cards)
         {
             TreeNode cNode = new TreeNode(card.Name, cardImg, cardImg);
             gNode.Nodes.Add(cNode);
             foreach (PassportItem item in card.Items)
             {
                 int      itemImg = PassportLib.Passport.GetImageIndex(item.Param) + 3;
                 TreeNode iNode   = new TreeNode(item.Param, itemImg, itemImg)
                 {
                     ToolTipText = item.Value
                 };
                 cNode.Nodes.Add(iNode);
             }
         }
     }
     passTree.TopNode.Expand();
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 private void MainFormLoad(object sender, EventArgs e)
 {
     PassportLib.Passport passport = new PassportLib.Passport();
     if (!passport.Load(passFile, "123"))
     {
         MessageBox.Show(Resources.PassFileOpenError, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     foreach (PassportGroup group in passport.Groups)
     {
         TreeNode gNode = new TreeNode(group.Name, groupImg, groupImg);
         passTree.TopNode.Nodes.Add(gNode);
         foreach (PassportCard card in group.Cards)
         {
             TreeNode cNode = new TreeNode(card.Name, cardImg, cardImg);
             gNode.Nodes.Add(cNode);
             foreach (PassportItem item in card.Items)
             {
                 int itemImg = PassportLib.Passport.GetImageIndex(item.Param) + 3;
                 TreeNode iNode = new TreeNode(item.Param, itemImg, itemImg) {ToolTipText = item.Value};
                 cNode.Nodes.Add(iNode);
             }
         }
     }
     passTree.TopNode.Expand();
 }