Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            iniFile   = IniFileHandler.CopyFile();
            viewModel = new ViewModel();

            ItemsView.ItemsSource = viewModel.TreeDatas;

            // 窗口关闭事件
            Closing += MainWindow_Closing;
        }
Пример #2
0
 /// <summary>
 /// 初始化Tree中的Data(Data从Ini文件中读取)
 /// </summary>
 private void InitData()
 {
     foreach (string section in IniFileHandler.ReadSections())
     {
         int sectionId = _nodeId;
         _nodeId += 1;
         Nodes.Add(new TreeData {
             NodeId = sectionId, NodeValue = section, ParentId = 0
         });
         foreach (string key in IniFileHandler.ReadKeys(section))
         {
             Nodes.Add(new TreeData {
                 NodeId = _nodeId, NodeValue = $"{key}  =   {IniFileHandler.ReadValue(section, key)}", ParentId = sectionId
             });
             _nodeId += 1;
         }
     }
 }