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

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.

主站蜘蛛池模板: 乌什县| 衡水市| 东明县| 重庆市| 马关县| 得荣县| 公主岭市| 苍梧县| 郓城县| 汶川县| 克什克腾旗| 谢通门县| 尚志市| 安岳县| 营口市| 永泰县| 洱源县| 阿荣旗| 衡水市| 乌什县| 苗栗县| 东辽县| 高台县| 富裕县| 栖霞市| 云浮市| 桃园市| 阿拉尔市| 顺昌县| 广州市| 文山县| 康马县| 裕民县| 陇南市| 株洲县| 庆云县| 南平市| 岚皋县| 白朗县| 玉山县| 滨海县|