コード例 #1
0
        //--------------------------------------------------------------------------
        // Begin IoC methodology
        //--------------------------------------------------------------------------

        private static void StartUpIoC()
        {
            // Use this instead because of (bad design) the need to tell ninject
            // which constructor to use for IoC/DI. Found at:
            // http://stackoverflow.com/questions/8777475/whats-the-difference-between-toconstructor-and-tomethod-in-ninject-3

            // Kick off the IoC container.
            // Initialize the service locator (InstanceFactory)
            InitializeNinject.StartUp();

            // Instantiate the instance
            // Once again, we are forced to use a Bad Design (the "Service Locator"
            // pattern, but, also again, there is no other way to invoke IoC.
            _MainForm = InstanceFactory.GetInstance <mfIoCWinForm>();
        }
コード例 #2
0
        //--------------------------------------------------------------------------
        // End IoC methodology
        //--------------------------------------------------------------------------

        //--------------------------------------------------------------------------
        // Begin Standard methodology
        //--------------------------------------------------------------------------

        private static void StartUpStandard()
        {
            _MainForm =
                new mfIoCWinForm(new IoCExampleClass(new IoCDependedOnClass()));
        }