Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Test Driven Development with C#: Developing Real World Applications with TDD
This is the forum to discuss the Wrox book Professional Test Driven Development with C#: Developing Real World Applications with TDD by James Bender, Jeff McWherter; ISBN: 978-0-470-64320-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Test Driven Development with C#: Developing Real World Applications with TDD section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 23rd, 2014, 11:12 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 11 WPF example doesn't use Ninject

Just wondering why the code contains Ninject Modules but does not actual use them. This is frustrating for me when trying to use this as a base for my own project.

Is there a good example of Caliburn.Micro being used with Ninject?

Thanks.
Reply With Quote
  #2 (permalink)  
Old July 24th, 2014, 03:45 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If anyone is interested, I managed to get it working with the following bootstrapper:

Caliburn.Micro v2.0.0.6
Ninject v3.2.0.0

Code:
    public class AppBootstrapper : BootstrapperBase
    {
        private IKernel kernel;

        public AppBootstrapper()
        {
            Initialize();
        }

        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            DisplayRootViewFor<IShellViewModel>();
        }

        protected override void Configure()
        {
            kernel = new StandardKernel();

            kernel.Bind<IWindowManager>().To<WindowManager>().InSingletonScope();
            kernel.Bind<IEventAggregator>().To<EventAggregator>().InSingletonScope();

            kernel.Bind<IShellViewModel>().To<ShellViewModel>().InSingletonScope();
        }

        protected override void OnExit(object sender, EventArgs e)
        {
            kernel.Dispose();
            base.OnExit(sender, e);
        }

        protected override object GetInstance(Type service, string key)
        {
            if (service == null)
                throw new ArgumentNullException("service");

            return kernel.Get(service);
        }

        protected override IEnumerable<object> GetAllInstances(Type service)
        {
            return kernel.GetAll(service);
        }

        protected override void BuildUp(object instance)
        {
            kernel.Inject(instance);
        }
    }
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 18 WPF Toolkit and Silverlight SDK Problems vikingdriver BOOK: Professional Visual Studio 2010 0 May 10th, 2012 12:50 PM
Error with Chapter 2 Src code for WPF that uses Lists.asmx treycarroll BOOK: Beginning SharePoint 2010 Development 4 April 28th, 2011 02:47 AM
WPF basics Chapter 6 mhccStudent BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 8 May 12th, 2010 07:37 AM
Chapter 7 - WPF Text Editor - pg 236 Crissytenav BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 2 April 14th, 2010 10:38 AM
chapter 11 figure 11-7 relative positioning pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 November 29th, 2007 05:11 AM



All times are GMT -4. The time now is 12:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.