Example #1
0
        static private void test2()
        {
            LibsLoader <ILoadable> loader = new LibsLoader <ILoadable>(true);

            String[] paths;

            if ((paths = loader.ShowDialogDLL()) != null)
            {
                foreach (string path in paths)
                {
                    loader.LoadDLL(path);
                }
            }

            IEnumerable <Lazy <ILoadable> > loaded = loader.GetLoaded();

            if (loaded != null && loaded.Count() > 0)
            {
                Console.WriteLine("Items:");
                foreach (Lazy <ILoadable> load in loaded)
                {
                    Console.WriteLine(load.Value.getResult());
                }
            }
        }
Example #2
0
        static private void test1()
        {
            LibsLoader <DelegateToStr> loader = new LibsLoader <DelegateToStr>(true);

            String[] paths;

            //loader.Clear();
            if ((paths = loader.ShowDialogDLL()) != null)
            {
                foreach (string path in paths)
                {
                    loader.LoadDLL(path);
                }
            }

            IEnumerable <Lazy <DelegateToStr> > loaded = loader.GetLoaded();

            if (loaded != null && loaded.Count() > 0)
            {
                Console.WriteLine("Items:");
                foreach (Lazy <DelegateToStr> str in loaded)
                {
                    Console.WriteLine(str.Value()); //invoke delegate
                }
            }
        }