Exemplo n.º 1
0
        private void loadJobAssemblies()
        {
            var assemblies = AssemblyRepository.GetAssemblies();
            SortedList <string, string> jobTypes = new SortedList <string, string>();

            foreach (var assemblyName in assemblies)
            {
                Assembly assembly = Assembly.LoadFile(Path.Combine(Environment.CurrentDirectory, assemblyName));
                foreach (Type type in assembly.GetTypes())
                {
                    if (typeof(IJob).IsAssignableFrom(type) && type.IsClass)
                    {
                        jobTypes.Add(type.FullName, assembly.GetName().Name);
                    }
                }
            }
            foreach (var item in jobTypes)
            {
                cboJobType.Items.Add(new JobType()
                {
                    AssemblyName = item.Value, FullName = item.Key
                });
            }
            //cboJobType.Items.AddRange(jobTypes.Values.ToArray<string>());
        }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (lbxAssemblies.SelectedItem != null)
     {
         AssemblyRepository.DeleteAssembly(lbxAssemblies.SelectedItem as string);
         lbxAssemblies.DataSource = AssemblyRepository.GetAssemblies().ToList();
     }
 }
 private void DeleteAssembliesForm_Load(object sender, EventArgs e)
 {
     lbxAssemblies.DataSource = AssemblyRepository.GetAssemblies().ToList();
 }