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

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.

主站蜘蛛池模板: 民县| 池州市| 鄂温| 烟台市| 林甸县| 获嘉县| 醴陵市| 嘉祥县| 广德县| 健康| 浦县| 上犹县| 长岭县| 永宁县| 商水县| 曲周县| 玉山县| 遂平县| 汉阴县| 余姚市| 齐河县| 凤翔县| 舒兰市| 余干县| 民县| 石阡县| 宣武区| 宁夏| 台州市| 平江县| 大冶市| 湖口县| 哈巴河县| 尉氏县| 余姚市| 化隆| 紫阳县| 平远县| 灵山县| 长乐市| 乌兰浩特市|