private void button1_Click(object sender, EventArgs e) { OpenFileDialog wSchemaDialog = new OpenFileDialog(); wSchemaDialog.DefaultExt = "dll"; wSchemaDialog.CheckFileExists = true; wSchemaDialog.Filter = "DLL Files (*.dll;*.exe)|*.dll;*.exe|All Files (*.*)|*.*"; wSchemaDialog.ShowReadOnly = true; MenuItemList wMenuItemList = new MenuItemList(); if (wSchemaDialog.ShowDialog() == DialogResult.OK) { MenuItem wMenuItem = new MenuItem(); Assembly ass = new Assembly(wSchemaDialog.FileName); lblFileName.Text = wSchemaDialog.FileName; foreach (AssemblyClass wAssemblyClass in ass.ClassCollections) { if (wAssemblyClass.BaseType != null) { if (wAssemblyClass.BaseType.Name.Contains("Form")) { wMenuItem = new MenuItem(); wMenuItem.AssemblyInfo = wAssemblyClass.FullyQualifiedName; wMenuItem.FormName = wAssemblyClass.Name; wMenuItemList.Add(wMenuItem); } } } listBox1.DataSource = wMenuItemList; } }
//MenuItemList LoadMenuItemList() //{ // _MenuItemList = MenuItemList.GetMenuItemListFromXml(GetXmlChilds()); // return _MenuItemList; //} public void AddChild(MenuItem pMenuItemChild) { SearchEntityArg search = new SearchEntityArg("DisplayName", pMenuItemChild.DisplayName); if (_MenuItemList.FindAll(search).Count == 0) { _MenuItemList.Add(pMenuItemChild); } else { _MenuItemList.Remove(_MenuItemList.Find(search)); } }