Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Multiselect = false;
            openFileDialog1.Filter      = "dll files|*.dll";
            openFileDialog1.Title       = "Select a dll";
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string sFileName = openFileDialog1.FileName;
                var    dll       = Assembly.LoadFile(sFileName);

                foreach (Type type in dll.GetExportedTypes())
                {
                    var t = Activator.CreateInstance(type);
                    if (t is Form1)
                    {
                        ListOfForms.Add((Form1)Activator.CreateInstance(type));
                        // classSelection.Items.Add(type);
                    }
                    if (t is Animal)
                    {
                        classSelection.Items.Add(type);
                        types.Add(type);
                    }
                }
            }
        }
Example #2
0
        public void GetFormNames()
        {
            listOfForms.Clear();
            string      xfile = fileloc + "\\" + selectedfile + ".xml";
            XmlDocument xdoc  = new XmlDocument();

            xdoc.Load(xfile);
            XmlNodeList nodes = xdoc.GetElementsByTagName("FormName");

            foreach (XmlNode node in nodes)
            {
                ListOfForms.Add(node.Attributes["FormName"].Value.Trim());
            }
        }