Example #1
0
        private void LoadKABSCommand()
        {
            TreeViewItem item = new TreeViewItem();

            string[] keys     = new string[50];
            string[] values   = new string[50];
            string[] sections = new string[100];

            CMDTree = new ObservableCollection <CMDNode>();

            IniOperations.GetAllSectionNames(out sections, "config/KABS_COMMAND.ini");

            int i = 0, j = 0;

            for (i = 0; i < sections.Length; i++)
            {
                IniOperations.GetAllKeyValues(sections[i], out keys, out values, "config/KABS_COMMAND.ini");
                CMDNode node = new CMDNode()
                {
                    NodeName = sections[i], ID = 1
                };
                for (j = 0; j < keys.Length; j++)
                {
                    node.NextNode.Add(new CMDNode {
                        NodeName = keys[j], ID = 2
                    });
                    SP2.SendBox.AddItem(keys[j]);
                }

                CMDTree.Add(node);
            }
            treeView.ItemsSource = CMDTree;
        }
 private void Save_button_Click(object sender, RoutedEventArgs e)
 {
     if (ConfigState1 && ConfigState2 && ConfigState3)
     {
         IniOperations.Write("python", "python_path", path1.Text, "config/conf.ini");
         IniOperations.Write("python", "python_lib1", path2.Text, "config/conf.ini");
         IniOperations.Write("python", "python_lib2", path3.Text, "config/conf.ini");
         IniOperations.Write("editor", "path", EditorPath.Text, "config/conf.ini");
         IniOperations.Write("editor", "enable", editorEnableFlag, "config/conf.ini");
         this.Close();
     }
 }
        private void Load_config()
        {
            string[] keys   = new string[20];
            string[] values = new string[20];

            path1.Text       = IniOperations.Read("python", "python_path", "config/conf.ini");
            path2.Text       = IniOperations.Read("python", "python_lib1", "config/conf.ini");
            path3.Text       = IniOperations.Read("python", "python_lib2", "config/conf.ini");
            EditorPath.Text  = IniOperations.Read("editor", "path", "config/conf.ini");
            editorEnableFlag = IniOperations.Read("editor", "enable", "config/conf.ini");
            if (editorEnableFlag == "1")
            {
                editorEnable.IsChecked = true;
            }
            else
            {
                editorEnable.IsChecked = false;
            }
        }