コード例 #1
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();
            TreeViewModel viewModel = new TreeViewModel();

            Compose(viewModel);
            Console.WriteLine("Welcome in reflection Tree View program.");

            viewModel.ExecuteBrowseFile();
            viewModel.LoadDLL();


            Console.Clear();
            foreach (TreeViewNode node in viewModel.HierarchicalAreas)
            {
                DisplayTree(node, 0);
            }
            ConsoleKey control = Console.ReadKey().Key;

            while (control != ConsoleKey.Escape)
            {
                if (control == ConsoleKey.RightArrow)
                {
                    Console.Clear();
                    foreach (TreeViewNode node in viewModel.HierarchicalAreas)
                    {
                        ExpandTree(node);
                        DisplayTree(node, 0);
                    }
                }
                else if (control == ConsoleKey.LeftArrow)
                {
                    Console.Clear();
                    foreach (TreeViewNode node in viewModel.HierarchicalAreas)
                    {
                        ConvolveTree(node);
                        DisplayTree(node, 0);
                    }
                }
                else if (control == ConsoleKey.S)
                {
                    Console.Clear();
                    viewModel.Serialize();
                }
                else if (control == ConsoleKey.D)
                {
                    Console.Clear();
                    viewModel.Deserialize();
                    Console.Clear();
                    foreach (TreeViewNode node in viewModel.HierarchicalAreas)
                    {
                        ConvolveTree(node);
                        DisplayTree(node, 0);
                    }
                }
                control = Console.ReadKey().Key;
            }
        }