コード例 #1
0
        private void btn_loadNodes_Click(object sender, EventArgs e)
        {
            OpenFileDialog choofdlog = new OpenFileDialog();

            choofdlog.Filter      = "json files (*.json)|*.json|All Files (*.*)|*.*";
            choofdlog.FilterIndex = 1;
            choofdlog.Multiselect = false;

            string sFileName = "";

            if (choofdlog.ShowDialog() == DialogResult.OK)
            {
                sFileName = choofdlog.FileName;
                Console.WriteLine(sFileName);
            }

            if (sFileName != "")
            {
                PlainNodeCollection plainNodesCollection = JsonSerialization.ReadFromJsonFile <PlainNodeCollection>(sFileName);

                this.nodeCollection = plainNodesCollection.toNodeCollection();

                treeView1.Nodes[0].Nodes.Clear();
                foreach (var node in nodeCollection.Nodes)
                {
                    treeView1.Nodes[0].Nodes.Add(node.name);
                }

                updatePathFinderComboBox();
            }
        }
コード例 #2
0
        public PlainNodeCollection serialize()
        {
            PlainNodeCollection plainNodesCollection = new PlainNodeCollection();

            plainNodesCollection.populateNodes(Nodes);

            return(plainNodesCollection);
        }