Beispiel #1
0
        private void TreeView1_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (!working)
            {
                for (int i = 0; i < e.Node.Nodes.Count; i++)
                {
                    e.Node.Nodes[i].Checked = e.Node.Checked;
                }
            }

            if (initial)
            {
                if (e.Node.Nodes.Count == 0)
                {
                    string path = e.Node.FullPath;
                    Console.WriteLine("caminho node " + path);
                    paths.Add(path.Replace(@"Pastas :\", ""));
                }
            }
            else
            {
                Pastapref.checkifexist(f1.prefpastas, e.Node.FullPath.Replace(@"Pastas :\", ""), e.Node.Checked);
                if (File.Exists(f1.pastapath))
                {
                    File.Delete(f1.pastapath);
                }
                StreamWriter sw = new StreamWriter(f1.pastapath);
                sw.Write(Newtonsoft.Json.JsonConvert.SerializeObject(f1.prefpastas));
                sw.Close();
            }
            //if (f1.prefpastas!=null)
            // f1.prefpastas.Print();
        }