Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            var files = Directory.GetFiles(".", "G9PX_*.dll");

            string where = Directory.GetCurrentDirectory();



            AppDomain   ad = AppDomain.CreateDomain("TestDomain1");
            ITypeFinder tt = (ITypeFinder)ad.CreateInstanceFromAndUnwrap(where + "/" + "LoadAssemblyHelpers.dll", "LoadAssemblyHelpers.TypeFinder");
            //ITypeFinder tz = (ITypeFinder)ad.CreateInstanceAndUnwrap("LoadAssemblyHelpers.dll", "LoadAssemblyHelpers.TypeFinder");

            //ad.

            string result      = tt.WhatAmI();
            string otherResult = tt.WhereAmI();

            foreach (string file in files)
            {
                var item = Assembly.LoadFile(where + "/" + file);

                System.Type[]   stuff    = item.GetExportedTypes();
                MyTestInterface myObject = (MyTestInterface)Activator.CreateInstance(stuff[0]);

                string name = myObject.TestMethod();

                //var otherItem = Assembly.LoadFrom(file);
            }
        }