Пример #1
0
        private void button_add_Click(object sender, EventArgs e)
        {
            if (DialogResult.OK == save.ShowDialog())
            {
                XmlTextWriter xml_writer = new XmlTextWriter(save.FileName, null);
                xml_writer.WriteStartElement("scad");
                xml_writer.WriteEndElement();
                xml_writer.Close();

                string name = Path.GetFileNameWithoutExtension(save.FileName);
                Library_control_class.load_functions(name, save.FileName);
            }
            update_listview();
            Library_control_class.Save_librarys();
        }
Пример #2
0
        private void button_load_Click(object sender, EventArgs e)
        {
            bool          load          = true;
            List <string> alrady_loaded = new List <string>();

            if (DialogResult.OK == open.ShowDialog())
            {
                for (int i_load = 0; i_load < open.FileNames.Length; i_load++)
                {
                    string name = Path.GetFileNameWithoutExtension(open.FileNames[i_load]);
                    for (int i_library = 0; i_library < librarys_functions.Count; i_library++)
                    {
                        if (open.FileNames[i_load] == librarys_functions[i_library].pfad)
                        {
                            alrady_loaded.Add("The file " + open.FileNames[i_load] + " alrady loaded");
                            load = false;
                        }
                        else if (name == librarys_functions[i_library].name)
                        {
                            alrady_loaded.Add("The name " + name + " alrady exist");
                            load = false;
                        }
                    }
                    if (load)
                    {
                        Library_control_class.load_functions(name, open.FileName);
                    }
                    load = true;
                }
            }
            if (0 < alrady_loaded.Count)
            {
                string error = alrady_loaded.Count + " librarys could not be loaded\r";
                for (int i = 0; i < alrady_loaded.Count && i < 5; i++)
                {
                    error += alrady_loaded[i] + "\r";
                }
                if (5 < alrady_loaded.Count)
                {
                    error += ".....";
                }
                MessageBox.Show(error);
            }
            update_listview();
            Library_control_class.Save_librarys();
        }