官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 买车| 新昌县| 高陵县| 汾西县| 东乌珠穆沁旗| 大城县| 平山县| 龙海市| 临桂县| 称多县| 利川市| 朝阳市| 汉沽区| 江川县| 洮南市| 镇巴县| 崇文区| 绍兴市| 鄱阳县| 芷江| 定远县| 满城县| 峡江县| 买车| 彰武县| 易门县| 汉中市| 安塞县| 静宁县| 贡山| 开化县| 石棉县| 囊谦县| 金昌市| 边坝县| 石楼县| 和田县| 长垣县| 新乡县| 友谊县| 宁安市|