IoC with Windows Phone

Implementing IoC with Windows Phone is very much the same as iOS and Android. We simply add the same function, InitIoC, at our application's starting point; in this case, it is the MainPage constructor of the Windows Phone project (try not to get the two confused), and we call it right before the LoadApplication function:

public MainPage() 
    { 
        InitializeComponent(); 
 
        InitIoC(); 
 
        NavigationCacheMode = NavigationCacheMode.Required; 
        LoadApplication(new SpeechTalk.App()); 
    } 
 
    private void InitIoC() 
    { 
        IoC.CreateContainer(); 
        IoC.RegisterModule(new WinPhoneModule ()); 
        IoC.RegisterModule(new PCLModule ()); 
        IoC.StartContainer(); 
    } 

Simple! Now we can run the Windows application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.156.250